Class Exporter
- java.lang.Object
-
- io.prometheus.client.servlet.common.exporter.Exporter
-
public class Exporter extends java.lang.Object
The MetricsServlet class exists to provide a simple way of exposing the metrics values.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
NAME_MUST_BE_EQUAL_TO
static java.lang.String
NAME_MUST_NOT_BE_EQUAL_TO
static java.lang.String
NAME_MUST_NOT_START_WITH
static java.lang.String
NAME_MUST_START_WITH
private CollectorRegistry
registry
private Predicate<java.lang.String>
sampleNameFilter
-
Constructor Summary
Constructors Constructor Description Exporter(CollectorRegistry registry, Predicate<java.lang.String> sampleNameFilter)
Construct a MetricsServlet for the given registry.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
doGet(HttpServletRequestAdapter req, HttpServletResponseAdapter resp)
void
doPost(HttpServletRequestAdapter req, HttpServletResponseAdapter resp)
void
init(ServletConfigAdapter servletConfig)
private java.util.Set<java.lang.String>
parse(HttpServletRequestAdapter req)
-
-
-
Field Detail
-
NAME_MUST_BE_EQUAL_TO
public static final java.lang.String NAME_MUST_BE_EQUAL_TO
- See Also:
- Constant Field Values
-
NAME_MUST_NOT_BE_EQUAL_TO
public static final java.lang.String NAME_MUST_NOT_BE_EQUAL_TO
- See Also:
- Constant Field Values
-
NAME_MUST_START_WITH
public static final java.lang.String NAME_MUST_START_WITH
- See Also:
- Constant Field Values
-
NAME_MUST_NOT_START_WITH
public static final java.lang.String NAME_MUST_NOT_START_WITH
- See Also:
- Constant Field Values
-
registry
private CollectorRegistry registry
-
sampleNameFilter
private Predicate<java.lang.String> sampleNameFilter
-
-
Constructor Detail
-
Exporter
public Exporter(CollectorRegistry registry, Predicate<java.lang.String> sampleNameFilter)
Construct a MetricsServlet for the given registry.- Parameters:
registry
- collector registrysampleNameFilter
- programmatically set aSampleNameFilter
. If there are any filter options configured inServletConfig
, they will be merged so that samples need to pass both filters to be exported. sampleNameFilter may benull
indicating that nothing should be filtered.
-
-
Method Detail
-
init
public void init(ServletConfigAdapter servletConfig) throws ServletConfigurationException
- Throws:
ServletConfigurationException
-
doGet
public void doGet(HttpServletRequestAdapter req, HttpServletResponseAdapter resp) throws java.io.IOException
- Throws:
java.io.IOException
-
parse
private java.util.Set<java.lang.String> parse(HttpServletRequestAdapter req)
-
doPost
public void doPost(HttpServletRequestAdapter req, HttpServletResponseAdapter resp) throws java.io.IOException
- Throws:
java.io.IOException
-
-