Hi,

I'm looking at adding metrics in various places in our codebase, and
currently that's only convenient for OSGi components, using an
@Reference.

However we do have a number of classes in our core which are not OSGi
components, for good reasons.

The options that I see to provide the MetricsService to those classes are:

a) Add or modify constructors to pass the MetricsService as required.
Somewhat ugly and verbose for no good reason.

b) Implement something like we use for logs,
MetricsServiceFactory.getMetricsService(name) that doesn't need to
pass a BundleContext

I think it was Ian who observed recently that metrics are very similar
to loggers in many way, so b) seems to make sense.

What do people think?

-Bertrand (hoping for a "but we already have this" answer ;-)

Reply via email to