Skip to content

Provide means for DropwizardExports to deal with data point validation errors #1353

Closed
@mnssn

Description

@mnssn

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions