[
https://issues.apache.org/jira/browse/SLING-10967?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17453939#comment-17453939
]
Carsten Ziegeler commented on SLING-10967:
------------------------------------------
Big +1 to this - its currently quiet ugly to use whiteboard for one type of
metrics and methods on the MetricsService for other metrics.
Implementation detail: the implementation should not register an OSGi service
(which then uses the whiteboard) but directly handle the gauge, similar to the
other metrics.
> Improve Gauge support in metrics
> --------------------------------
>
> Key: SLING-10967
> URL: https://issues.apache.org/jira/browse/SLING-10967
> Project: Sling
> Issue Type: Improvement
> Components: Commons
> Affects Versions: Commons Metrics 1.2.8
> Reporter: Joerg Hoh
> Priority: Major
>
> Currently Sling Metrics only support Gauges via the whiteboard approach (see
> SLING-5966).
> To leverage gauges you have to register a gauge instance by yourself using
> the OSGI Framework API and also its whole livecycle. The Sling MetricsService
> should be able to handle this for you as well like it does for the other
> metric types (e.g. counter).
> I propose to extend the MetricsService by a new method:
> {code}
> Gauge<T> registerGauge (String name, Supplier<T> supplier);
> {code}
> which registers a Gauge which on every request to {{getValue()}} calls the
> provided supplier. In most cases the returned Gauge object is not used, but
> it is returned for consistency with other methods of the MetricsService.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)