Class Filter
- java.lang.Object
-
- io.prometheus.client.servlet.common.filter.Filter
-
public class Filter extends java.lang.Object
Filter implements the common functionality provided by the two MetricsFilter implementations:- javax version:
io.prometheus.client.filter.MetricsFilter
provided bysimpleclient_servlet
- jakarta version:
io.prometheus.client.servlet.jakarta.filter.MetricsFilter
provided bysimpleclient_servlet_jakarta
- javax version:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Filter.MetricData
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.String
BUCKET_CONFIG_PARAM
private double[]
buckets
private java.lang.String
help
(package private) static java.lang.String
HELP_PARAM
private Histogram
histogram
(package private) static java.lang.String
METRIC_NAME_PARAM
private java.lang.String
metricName
(package private) static java.lang.String
PATH_COMPONENT_PARAM
(package private) int
pathComponents
private Counter
statusCounter
(package private) static java.lang.String
STRIP_CONTEXT_PATH_PARAM
(package private) boolean
stripContextPath
-
Constructor Summary
Constructors Constructor Description Filter()
Filter(java.lang.String metricName, java.lang.String help, java.lang.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 private java.lang.String
getComponents(java.lang.String str)
void
init(FilterConfigAdapter filterConfig)
Common implementation ofjavax.servlet.Filter.init()
andjakarta.servlet.Filter.init()
.private boolean
isEmpty(java.lang.String s)
void
observeDuration(Filter.MetricData data, HttpServletResponseAdapter resp)
To be called at the end ofjavax.servlet.Filter.doFilter()
orjakarta.servlet.Filter.doFilter()
.Filter.MetricData
startTimer(HttpServletRequestAdapter request)
To be called at the beginning ofjavax.servlet.Filter.doFilter()
orjakarta.servlet.Filter.doFilter()
.
-
-
-
Field Detail
-
PATH_COMPONENT_PARAM
static final java.lang.String PATH_COMPONENT_PARAM
- See Also:
- Constant Field Values
-
HELP_PARAM
static final java.lang.String HELP_PARAM
- See Also:
- Constant Field Values
-
METRIC_NAME_PARAM
static final java.lang.String METRIC_NAME_PARAM
- See Also:
- Constant Field Values
-
BUCKET_CONFIG_PARAM
static final java.lang.String BUCKET_CONFIG_PARAM
- See Also:
- Constant Field Values
-
STRIP_CONTEXT_PATH_PARAM
static final java.lang.String STRIP_CONTEXT_PATH_PARAM
- See Also:
- Constant Field Values
-
histogram
private Histogram histogram
-
statusCounter
private Counter statusCounter
-
pathComponents
int pathComponents
-
metricName
private java.lang.String metricName
-
stripContextPath
boolean stripContextPath
-
help
private java.lang.String help
-
buckets
private double[] buckets
-
-
Constructor Detail
-
Filter
public Filter()
-
Filter
public Filter(java.lang.String metricName, java.lang.String help, java.lang.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 Detail
-
isEmpty
private boolean isEmpty(java.lang.String s)
-
getComponents
private java.lang.String getComponents(java.lang.String str)
-
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()
.
-
-