metricRegistry.registerAll( new BufferPoolMetricSet( mBeanServer ) );
        metricRegistry.registerAll( new ThreadStatesGaugeSet() );
        metricRegistry.registerAll( new MemoryUsageGaugeSet() );
... right now this yields metrics named:
    "total.init" : {
      "value" : 91422720
    },
What the heck is total.init!? :-P
I have no idea what this means.. 
So.. first, I think they should either all have some sort of reasonable prefix, like ,
jvm.threads.foo.bar 
... instead of just foo.bar
of the user should be able to specify it. 
Guessing you probably found this already and the API could be a little clearer here but if you use just MetricRegistry.register(name, Metric) you can provide a prefix and your can pass a MetricSet (as a MetricSet implements the Metric interface) - there's some logic to then use the provided name as a prefix for the MetricSet here - https://github.com/
Even so, there is no explicit representation of a MetricSet in the MetricRegistry (or, alternatively, having Metric objects optionally specifying a parent MetricSet name).
If this existed, reporters and the MetricsServlet would have the chance to group these metrics to their clients, e.g. a JmxReporter could be able to register a set of related Gauges into a CompositeData object.
However, this looks like an intervention to Metrics' core API, which might be acceptable for 4.0 but probably only if there is a common demand for it... 
Any opinions? Ryan?
 
댓글 없음:
댓글 쓰기