Package org.restheart.metrics
Class Metrics
java.lang.Object
org.restheart.metrics.Metrics
Utility class for metrics
- Author:
- Andrea Di Cesare <andrea@softinstigate.com>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidattachMetricLabel(Request<?> request, MetricLabel label) attach metrics labels to request RequestsMetricsCollector adds labels to the collected metricsstatic voidattachMetricLabels(Request<?> request, List<MetricLabel> labels) attach metrics labels to request RequestsMetricsCollector adds labels to the collected metricsstatic voidSet the key used to collect failed auth requests, REMOTE_IP (default) or X_FORWARDED_FORstatic StringfailedAuthHistogramName(io.undertow.server.HttpServerExchange exchange) static List<MetricLabel> getMetricLabels(Request<?> request) retrives the metrics labels attached to requeststatic Stringhandles the case where the X_Forwarded_For header is set as "invalid input: '<'client-suppied-value>, ..., invalid input: '<'proxy-supplied-value>"static voidxffValueRIndex(int ridx) Set the xffReverseIndex, i.e. if X-ForwardedFor header has multiple values, take into account the n-th value from last e.g. with [x.x.x.x, y.y.y.y., z.z.z.z, k.k.k.k] 0 -> k.k.k.k 2 -> y.y.y.y
-
Constructor Details
-
Metrics
public Metrics()
-
-
Method Details
-
failedAuthHistogramName
- Parameters:
exchange-- Returns:
- the name of the histogram that stores the percentage of failed auth requests in the last 10 seconds
-
xffValue
handles the case where the X_Forwarded_For header is set as "invalid input: '<'client-suppied-value>, ..., invalid input: '<'proxy-supplied-value>"- Parameters:
xff-rindex- @see useXForwaderdedElement()- Returns:
- the rindex-th element of a comma separated list
-
collectFailedAuthBy
Set the key used to collect failed auth requests, REMOTE_IP (default) or X_FORWARDED_FOR- Parameters:
key- the key to use
-
xffValueRIndex
public static void xffValueRIndex(int ridx) Set the xffReverseIndex, i.e. if X-ForwardedFor header has multiple values, take into account the n-th value from last e.g. with [x.x.x.x, y.y.y.y., z.z.z.z, k.k.k.k] 0 -> k.k.k.k 2 -> y.y.y.y- Parameters:
ridx- the reverse index (element from last)
-
attachMetricLabels
attach metrics labels to request RequestsMetricsCollector adds labels to the collected metrics- Parameters:
request-labels-
-
attachMetricLabel
attach metrics labels to request RequestsMetricsCollector adds labels to the collected metrics- Parameters:
request-labels-
-
getMetricLabels
retrives the metrics labels attached to request- Parameters:
request-labels-
-