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
Response writer for Prometheus metrics. This is used only by the
MetricsHandler-
Field Summary
Fields inherited from class org.apache.solr.response.RawResponseWriter
CONTENT, CONTENT_TYPEFields inherited from interface org.apache.solr.response.QueryResponseWriter
CONTENT_TYPE_TEXT_ASCII, CONTENT_TYPE_TEXT_UTF8, CONTENT_TYPE_XML_UTF8 -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetContentType(SolrQueryRequest request, SolrQueryResponse response) Return the applicable Content Type for a request, this method must be thread safe.static SolrPrometheusFormattergetFormatterType(String registryName) static voidtoPrometheus(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.voidwrite(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) Use it to write the response in a binary formatMethods inherited from class org.apache.solr.response.RawResponseWriter
getBaseWriter, init, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.response.BinaryQueryResponseWriter
serializeResponse
-
Constructor Details
-
PrometheusResponseWriter
public PrometheusResponseWriter()
-
-
Method Details
-
write
public void write(OutputStream out, SolrQueryRequest request, SolrQueryResponse response) throws IOException Description copied from interface:BinaryQueryResponseWriterUse it to write the response in a binary format- Specified by:
writein interfaceBinaryQueryResponseWriter- Overrides:
writein classRawResponseWriter- Throws:
IOException
-
getContentType
Description copied from interface:QueryResponseWriterReturn 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:
getContentTypein interfaceQueryResponseWriter- Overrides:
getContentTypein 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- theMetricRegistryto be convertedshouldMatchFilters- a list ofMetricFilterinstances. 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
-