sling-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bertrand Delacretaz <>
Subject Something like LoggerFactory for metrics?
Date Wed, 22 Mar 2017 14:14:45 GMT

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

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 ;-)

View raw message