You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Let DropwizardExports users deal with snapshot validation errors
In the current form, if e.g. a Counter contains invalid data the entire `collect` calls fails with
InvalidArgumentException.
In large applications, it may be preferable to gracefully degrade the available metrics and report
the failure via e.g. logging. This change allows that by letting the user add a exception handler.
This allows the user to inspect the exception, and the metric name it was associated with, and
decide if the exception should be suppressed or not.
Metrics for which exceptions were suppressed will be absent from the collection.
Copy file name to clipboardExpand all lines: prometheus-metrics-instrumentation-dropwizard/src/main/java/io/prometheus/metrics/instrumentation/dropwizard/DropwizardExports.java
Copy file name to clipboardExpand all lines: prometheus-metrics-instrumentation-dropwizard/src/test/java/io/prometheus/metrics/instrumentation/dropwizard/DropwizardExportsTest.java
Copy file name to clipboardExpand all lines: prometheus-metrics-instrumentation-dropwizard5/src/main/java/io/prometheus/metrics/instrumentation/dropwizard5/DropwizardExports.java
+53-24Lines changed: 53 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -24,8 +24,8 @@
24
24
importjava.util.Collections;
25
25
importjava.util.Map;
26
26
importjava.util.Optional;
27
-
importjava.util.Set;
28
27
importjava.util.concurrent.TimeUnit;
28
+
importjava.util.function.BiFunction;
29
29
importjava.util.logging.Level;
30
30
importjava.util.logging.Logger;
31
31
@@ -35,6 +35,7 @@ public class DropwizardExports implements MultiCollector {
0 commit comments