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/dropwizard/metrics/blob/master/metrics- core/src/main/java/com/ codahale/metrics/MetricRegistr y.java#L85
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?
댓글 없음:
댓글 쓰기