Class Filter
- java.lang.Object
-
- io.prometheus.client.servlet.common.filter.Filter
-
public class Filter extends java.lang.ObjectFilter 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
- javax version:
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFilter.MetricData
-
Field Summary
Fields Modifier and Type Field Description (package private) static java.lang.StringBUCKET_CONFIG_PARAMprivate double[]bucketsprivate java.lang.Stringhelp(package private) static java.lang.StringHELP_PARAMprivate Histogramhistogram(package private) static java.lang.StringMETRIC_NAME_PARAMprivate java.lang.StringmetricName(package private) static java.lang.StringPATH_COMPONENT_PARAM(package private) intpathComponentsprivate CounterstatusCounter(package private) static java.lang.StringSTRIP_CONTEXT_PATH_PARAM(package private) booleanstripContextPath
-
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.StringgetComponents(java.lang.String str)voidinit(FilterConfigAdapter filterConfig)Common implementation ofjavax.servlet.Filter.init()andjakarta.servlet.Filter.init().private booleanisEmpty(java.lang.String s)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().
-
-
-
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().
-
-