Package org.apache.solr.util.stats
Class InstrumentedHttpListenerFactory
- java.lang.Object
-
- org.apache.solr.util.stats.InstrumentedHttpListenerFactory
-
- All Implemented Interfaces:
AutoCloseable,org.apache.solr.client.solrj.impl.HttpListenerFactory,SolrMetricProducer
public class InstrumentedHttpListenerFactory extends Object implements SolrMetricProducer, org.apache.solr.client.solrj.impl.HttpListenerFactory
A HttpListenerFactory tracking metrics and distributed tracing. The Metrics are inspired and partially copied from dropwizard httpclient library.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceInstrumentedHttpListenerFactory.NameStrategy
-
Field Summary
Fields Modifier and Type Field Description static Map<String,InstrumentedHttpListenerFactory.NameStrategy>KNOWN_METRIC_NAME_STRATEGIESprotected InstrumentedHttpListenerFactory.NameStrategynameStrategyprotected Stringscopeprotected SolrMetricsContextsolrMetricsContext
-
Constructor Summary
Constructors Constructor Description InstrumentedHttpListenerFactory(InstrumentedHttpListenerFactory.NameStrategy nameStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.solr.client.solrj.impl.HttpListenerFactory.RequestResponseListenerget()SolrMetricsContextgetSolrMetricsContext()Implementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)to ensure proper cleanup of metrics at the end of the life-cycle of this component.voidinitializeMetrics(SolrMetricsContext parentContext, String scope)Initialize metrics specific to this producer.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
-
-
-
Field Detail
-
KNOWN_METRIC_NAME_STRATEGIES
public static final Map<String,InstrumentedHttpListenerFactory.NameStrategy> KNOWN_METRIC_NAME_STRATEGIES
-
solrMetricsContext
protected SolrMetricsContext solrMetricsContext
-
scope
protected String scope
-
nameStrategy
protected InstrumentedHttpListenerFactory.NameStrategy nameStrategy
-
-
Constructor Detail
-
InstrumentedHttpListenerFactory
public InstrumentedHttpListenerFactory(InstrumentedHttpListenerFactory.NameStrategy nameStrategy)
-
-
Method Detail
-
get
public org.apache.solr.client.solrj.impl.HttpListenerFactory.RequestResponseListener get()
- Specified by:
getin interfaceorg.apache.solr.client.solrj.impl.HttpListenerFactory
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducerInitialize metrics specific to this producer.- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Parameters:
parentContext- parent metrics context. If this component has the same life-cycle as the parent it can simply use the parent context, otherwise it should obtain a child context usingSolrMetricsContext.getChildContext(Object)passingthisas the child object.scope- component scope
-
getSolrMetricsContext
public SolrMetricsContext getSolrMetricsContext()
Description copied from interface:SolrMetricProducerImplementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)to ensure proper cleanup of metrics at the end of the life-cycle of this component. This should be the child context if one was created, or null if the parent context was used.- Specified by:
getSolrMetricsContextin interfaceSolrMetricProducer
-
-