Class Exporter
- java.lang.Object
-
- io.prometheus.client.servlet.common.exporter.Exporter
-
public class Exporter extends java.lang.ObjectThe MetricsServlet class exists to provide a simple way of exposing the metrics values.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringNAME_MUST_BE_EQUAL_TOstatic java.lang.StringNAME_MUST_NOT_BE_EQUAL_TOstatic java.lang.StringNAME_MUST_NOT_START_WITHstatic java.lang.StringNAME_MUST_START_WITHprivate CollectorRegistryregistryprivate 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 voiddoGet(HttpServletRequestAdapter req, HttpServletResponseAdapter resp)voiddoPost(HttpServletRequestAdapter req, HttpServletResponseAdapter resp)voidinit(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 benullindicating 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
-
-