Package org.apache.solr.metrics
Class SolrMetricsContext
java.lang.Object
org.apache.solr.metrics.SolrMetricsContext
- Direct Known Subclasses:
SolrDelegateRegistryMetricsContext
This class represents a metrics context that ties together components with the same life-cycle
and provides convenient access to the metric registry.
Additionally it's used for registering and reporting metrics specific to the components that use the same instance of context.
-
Constructor Summary
ConstructorsConstructorDescriptionSolrMetricsContext(SolrMetricManager metricManager, String registryName, String tag) -
Method Summary
Modifier and TypeMethodDescriptioncom.codahale.metrics.CounterConvenience method forSolrMetricManager.counter(SolrMetricsContext, String, String, String...).voidgetChildContext(Object child) Get a context with the same registry name but a tag that represents a parent-child relationship.Return the instance ofSolrMetricManagerused in this context.Return a modifiable set of metric names that this component registers.com.codahale.metrics.MetricRegistryGet theMetricRegistryinstance that is used for registering metrics in this context.Return a snapshot of metric values that this component reports.Return metric registry name used in this context.getTag()Metrics tag that represents objects with the same life-cycle.com.codahale.metrics.HistogramConvenience method forSolrMetricManager.histogram(SolrMetricsContext, String, String, String...).com.codahale.metrics.MeterConvenience method forSolrMetricManager.meter(SolrMetricsContext, String, String, String...).voidregisterMetricName(String name) Register a metric name that this component reports.com.codahale.metrics.TimerConvenience method forSolrMetricManager.meter(SolrMetricsContext, String, String, String...).voidUnregister allGaugemetrics that use this context's tag.
-
Constructor Details
-
SolrMetricsContext
-
-
Method Details
-
nullNumber
-
notANumber
-
nullString
-
nullObject
-
getTag
Metrics tag that represents objects with the same life-cycle. -
getRegistryName
Return metric registry name used in this context. -
getMetricManager
Return the instance ofSolrMetricManagerused in this context. -
getMetricNames
Return a modifiable set of metric names that this component registers. -
unregister
public void unregister()Unregister allGaugemetrics that use this context's tag.NOTE: This method MUST be called at the end of a life-cycle (typically in
close()) of components that register gauge metrics with references to the current object's instance. Failure to do so may result in hard-to-debug memory leaks. -
getChildContext
Get a context with the same registry name but a tag that represents a parent-child relationship. Since it's a different tag than the parent's context it is assumed that the life-cycle of the parent and child are different.- Parameters:
child- child object that produces metrics with a different life-cycle than the parent.
-
registerMetricName
Register a metric name that this component reports. This method is called by various metric registration methods inSolrMetricManagerin order to capture what metric names are reported from this component (which in turn is called fromSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)). -
getMetricsSnapshot
Return a snapshot of metric values that this component reports. -
meter
Convenience method forSolrMetricManager.meter(SolrMetricsContext, String, String, String...). -
counter
Convenience method forSolrMetricManager.counter(SolrMetricsContext, String, String, String...). -
gauge
-
timer
Convenience method forSolrMetricManager.meter(SolrMetricsContext, String, String, String...). -
histogram
Convenience method forSolrMetricManager.histogram(SolrMetricsContext, String, String, String...). -
getMetricRegistry
public com.codahale.metrics.MetricRegistry getMetricRegistry()Get theMetricRegistryinstance that is used for registering metrics in this context.
-