Class Filter
- java.lang.Object
-
- io.prometheus.client.servlet.common.filter.Filter
-
public class Filter extends Object
Filter implements the common functionality provided by the two MetricsFilter implementations:- javax version:
io.prometheus.client.filter.MetricsFilterprovided bysimpleclient_servlet - jakarta version:
io.prometheus.client.servlet.jakarta.filter.MetricsFilterprovided bysimpleclient_servlet_jakarta
- Author:
- Andrew Stuart <andrew.stuart2@gmail.com>
- javax version:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFilter.MetricData
-
Constructor Summary
Constructors Constructor Description Filter()Filter(String metricName, String help, Integer pathComponents, double[] buckets, boolean stripContextPath)If you want to configure the filter programmatically instead of viaweb.xml, you can pass all configuration parameters to this constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidinit(FilterConfigAdapter filterConfig)Common implementation ofjavax.servlet.Filter.init()andjakarta.servlet.Filter.init().voidobserveDuration(Filter.MetricData data, HttpServletResponseAdapter resp)To be called at the end ofjavax.servlet.Filter.doFilter()orjakarta.servlet.Filter.doFilter().Filter.MetricDatastartTimer(HttpServletRequestAdapter request)To be called at the beginning ofjavax.servlet.Filter.doFilter()orjakarta.servlet.Filter.doFilter().
-
-
-
Constructor Detail
-
Filter
public Filter()
-
-
Method Detail
-
init
public void init(FilterConfigAdapter filterConfig) throws FilterConfigurationException
Common implementation ofjavax.servlet.Filter.init()andjakarta.servlet.Filter.init().- Throws:
FilterConfigurationException
-
startTimer
public Filter.MetricData startTimer(HttpServletRequestAdapter request)
To be called at the beginning ofjavax.servlet.Filter.doFilter()orjakarta.servlet.Filter.doFilter().
-
observeDuration
public void observeDuration(Filter.MetricData data, HttpServletResponseAdapter resp)
To be called at the end ofjavax.servlet.Filter.doFilter()orjakarta.servlet.Filter.doFilter().
-
-