Package org.apache.solr.util.stats
Class InstrumentedHttpRequestExecutor
- java.lang.Object
-
- org.apache.http.protocol.HttpRequestExecutor
-
- org.apache.solr.util.stats.InstrumentedHttpRequestExecutor
-
- All Implemented Interfaces:
AutoCloseable
,SolrMetricProducer
public class InstrumentedHttpRequestExecutor extends org.apache.http.protocol.HttpRequestExecutor implements SolrMetricProducer
Sub-class of HttpRequestExecutor which tracks metrics interesting to solr Inspired and partially copied from dropwizard httpclient library
-
-
Field Summary
Fields Modifier and Type Field Description static HttpClientMetricNameStrategy
HOST_AND_METHOD
static Map<String,HttpClientMetricNameStrategy>
KNOWN_METRIC_NAME_STRATEGIES
static HttpClientMetricNameStrategy
METHOD_ONLY
protected HttpClientMetricNameStrategy
nameStrategy
static HttpClientMetricNameStrategy
QUERYLESS_URL_AND_METHOD
protected String
scope
protected SolrMetricsContext
solrMetricsContext
-
Constructor Summary
Constructors Constructor Description InstrumentedHttpRequestExecutor(int waitForContinue, HttpClientMetricNameStrategy nameStrategy)
InstrumentedHttpRequestExecutor(HttpClientMetricNameStrategy nameStrategy)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.http.HttpResponse
execute(org.apache.http.HttpRequest request, org.apache.http.HttpClientConnection conn, org.apache.http.protocol.HttpContext context)
SolrMetricsContext
getSolrMetricsContext()
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.void
initializeMetrics(SolrMetricsContext parentContext, String scope)
Initialize metrics specific to this producer.-
Methods inherited from class org.apache.http.protocol.HttpRequestExecutor
canResponseHaveBody, doReceiveResponse, doSendRequest, postProcess, preProcess
-
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
-
QUERYLESS_URL_AND_METHOD
public static final HttpClientMetricNameStrategy QUERYLESS_URL_AND_METHOD
-
METHOD_ONLY
public static final HttpClientMetricNameStrategy METHOD_ONLY
-
HOST_AND_METHOD
public static final HttpClientMetricNameStrategy HOST_AND_METHOD
-
KNOWN_METRIC_NAME_STRATEGIES
public static final Map<String,HttpClientMetricNameStrategy> KNOWN_METRIC_NAME_STRATEGIES
-
scope
protected String scope
-
nameStrategy
protected HttpClientMetricNameStrategy nameStrategy
-
solrMetricsContext
protected SolrMetricsContext solrMetricsContext
-
-
Constructor Detail
-
InstrumentedHttpRequestExecutor
public InstrumentedHttpRequestExecutor(int waitForContinue, HttpClientMetricNameStrategy nameStrategy)
-
InstrumentedHttpRequestExecutor
public InstrumentedHttpRequestExecutor(HttpClientMetricNameStrategy nameStrategy)
-
-
Method Detail
-
getSolrMetricsContext
public SolrMetricsContext getSolrMetricsContext()
Description copied from interface:SolrMetricProducer
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. This should be the child context if one was created, or null if the parent context was used.- Specified by:
getSolrMetricsContext
in interfaceSolrMetricProducer
-
execute
public org.apache.http.HttpResponse execute(org.apache.http.HttpRequest request, org.apache.http.HttpClientConnection conn, org.apache.http.protocol.HttpContext context) throws IOException, org.apache.http.HttpException
- Overrides:
execute
in classorg.apache.http.protocol.HttpRequestExecutor
- Throws:
IOException
org.apache.http.HttpException
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducer
Initialize metrics specific to this producer.- Specified by:
initializeMetrics
in 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)
passingthis
as the child object.scope
- component scope
-
-