Class MetricsServlet
- java.lang.Object
-
- jakarta.servlet.GenericServlet
-
- jakarta.servlet.http.HttpServlet
-
- io.prometheus.client.servlet.jakarta.exporter.MetricsServlet
-
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable
public class MetricsServlet extends jakarta.servlet.http.HttpServlet
The MetricsServlet class provides a simple way of exposing the metrics values.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description MetricsServlet()MetricsServlet(io.prometheus.client.CollectorRegistry registry)MetricsServlet(io.prometheus.client.CollectorRegistry registry, io.prometheus.client.Predicate<String> sampleNameFilter)MetricsServlet(io.prometheus.client.Predicate<String> sampleNameFilter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)protected voiddoPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp)voidinit(jakarta.servlet.ServletConfig servletConfig)-
Methods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
-
-
-
-
Constructor Detail
-
MetricsServlet
public MetricsServlet()
-
MetricsServlet
public MetricsServlet(io.prometheus.client.Predicate<String> sampleNameFilter)
-
MetricsServlet
public MetricsServlet(io.prometheus.client.CollectorRegistry registry)
-
MetricsServlet
public MetricsServlet(io.prometheus.client.CollectorRegistry registry, io.prometheus.client.Predicate<String> sampleNameFilter)
-
-
Method Detail
-
init
public void init(jakarta.servlet.ServletConfig servletConfig) throws jakarta.servlet.ServletException
- Specified by:
initin interfacejakarta.servlet.Servlet- Overrides:
initin classjakarta.servlet.GenericServlet- Throws:
jakarta.servlet.ServletException
-
doGet
protected void doGet(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException
- Overrides:
doGetin classjakarta.servlet.http.HttpServlet- Throws:
IOException
-
doPost
protected void doPost(jakarta.servlet.http.HttpServletRequest req, jakarta.servlet.http.HttpServletResponse resp) throws IOException
- Overrides:
doPostin classjakarta.servlet.http.HttpServlet- Throws:
IOException
-
-