Closed
Description
Hello!
In its current form the DropwizardExports.collect()
throws an exception if a registered metric contains an invalid data point (e.g. a Counter with negative value).
// file: DropwizardExportsTest.java
@Test
void collectInvalidMetricFails() {
metricRegistry.counter("my.application.namedCounter1").inc(-10);
assertThatThrownBy( () -> convertToOpenMetricsFormat() ).isInstanceOf( IllegalArgumentException.class );
}
In large applications, it may be preferable to gracefully degrade the available metrics and report the successful subset of metrics, while reporting the failure via e.g. logging. This would allow operators to maintain some visibility into the application state, while at the same time becoming aware of the "invalid metric".
There seems to be a certain precedence for this, since DropwizardExports.fromGauge
currently ignores invalid gauges rather than failing the entire collection call.
Metadata
Metadata
Assignees
Labels
No labels