Package org.apache.solr.response
Class PrometheusResponseWriter
- java.lang.Object
-
- org.apache.solr.response.RawResponseWriter
-
- org.apache.solr.response.PrometheusResponseWriter
-
- All Implemented Interfaces:
BinaryQueryResponseWriter
,QueryResponseWriter
,NamedListInitializedPlugin
public class PrometheusResponseWriter extends RawResponseWriter
Response writer for Prometheus metrics. This is used only by theMetricsHandler
-
-
Field Summary
-
Fields inherited from class org.apache.solr.response.RawResponseWriter
CONTENT, CONTENT_TYPE
-
Fields inherited from interface org.apache.solr.response.QueryResponseWriter
CONTENT_TYPE_TEXT_ASCII, CONTENT_TYPE_TEXT_UTF8, CONTENT_TYPE_XML_UTF8
-
-
Constructor Summary
Constructors Constructor Description PrometheusResponseWriter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getContentType(SolrQueryRequest request, SolrQueryResponse response)
Return the applicable Content Type for a request, this method must be thread safe.static SolrPrometheusFormatter
getFormatterType(String registryName)
static void
toPrometheus(com.codahale.metrics.MetricRegistry registry, String registryName, List<com.codahale.metrics.MetricFilter> shouldMatchFilters, com.codahale.metrics.MetricFilter mustMatchFilter, Predicate<CharSequence> propertyFilter, boolean skipHistograms, boolean skipAggregateValues, boolean compact, Consumer<SolrPrometheusFormatter> consumer)
Provides a representation of the given Dropwizard metric registry asSolrPrometheusCoreFormatter
-s.void
write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response)
Use it to write the response in a binary format-
Methods inherited from class org.apache.solr.response.RawResponseWriter
getBaseWriter, init, write
-
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.response.BinaryQueryResponseWriter
serializeResponse
-
-
-
-
Method Detail
-
write
public void write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) throws IOException
Description copied from interface:BinaryQueryResponseWriter
Use it to write the response in a binary format- Specified by:
write
in interfaceBinaryQueryResponseWriter
- Overrides:
write
in classRawResponseWriter
- Throws:
IOException
-
getContentType
public String getContentType(SolrQueryRequest request, SolrQueryResponse response)
Description copied from interface:QueryResponseWriter
Return the applicable Content Type for a request, this method must be thread safe.QueryResponseWriter's must implement this method to return a valid HTTP Content-Type header for the request, that will logically correspond with the output produced by the write method.
- Specified by:
getContentType
in interfaceQueryResponseWriter
- Overrides:
getContentType
in classRawResponseWriter
- Returns:
- a Content-Type string, which may not be null.
-
toPrometheus
public static void toPrometheus(com.codahale.metrics.MetricRegistry registry, String registryName, List<com.codahale.metrics.MetricFilter> shouldMatchFilters, com.codahale.metrics.MetricFilter mustMatchFilter, Predicate<CharSequence> propertyFilter, boolean skipHistograms, boolean skipAggregateValues, boolean compact, Consumer<SolrPrometheusFormatter> consumer)
Provides a representation of the given Dropwizard metric registry asSolrPrometheusCoreFormatter
-s. Only those metrics are converted which match at least one of the given MetricFilter instances.- Parameters:
registry
- theMetricRegistry
to be convertedshouldMatchFilters
- a list ofMetricFilter
instances. A metric must match any one of the filters from this list to be included in the outputmustMatchFilter
- aMetricFilter
. A metric must match this filter to be included in the output.propertyFilter
- limit what properties of a metric are returnedskipHistograms
- discard anyHistogram
-s and histogram parts ofTimer
-s.skipAggregateValues
- discard internal values ofAggregateMetric
-s.compact
- use compact representation for counters and gauges.consumer
- consumer that accepts producedSolrPrometheusCoreFormatter
-s
-
getFormatterType
public static SolrPrometheusFormatter getFormatterType(String registryName)
-
-