Skip to content

Distribution without percentiles always has value 0 in Stackdriver #6401

@rafal-dudek

Description

@rafal-dudek

Describe the bug
StackdriverMeterRegistry is always sending 0 for count and sum for distribution metrics when percentiles are not defined.
E.g. "jvm.gc.pause"
https://github.com/micrometer-metrics/micrometer/blob/main/micrometer-core/src/main/java/io/micrometer/core/instrument/binder/jvm/JvmGcMetrics.java#L210

Timer.builder("jvm.gc.pause")
    .tags(gcTags)
    .description("Time spent in GC pause")
    .register(registry)
    .record(duration, TimeUnit.MILLISECONDS);

Since 1.14.4, we are observing only 0 in Stackdriver for count and sum:

Image

Environment

  • Micrometer version: 1.14.4 - 1.15.1 (It was working correctly in 1.14.3)
  • Micrometer registry: stackdriver
  • OS: Windows 11
  • Java version: 21.0.2

To Reproduce
How to reproduce the bug:

Configure application to use Stackdriver. Invoke System.gc();.
Observer metrics in Cloud Monitoring for jvm.gc.pause e.g. in PromQL:
custom_googleapis_com:jvm_gc_pause_sum{monitored_resource="global"}

Alternatively, create other Timer metric without percentiles and record values in code e.g.:

Timer timer = Timer.builder("test.metric")
                .description("Test metric")
                .register(meterRegistry);
...
timer.record(100, TimeUnit.MILLISECONDS);

Expected behavior
Count and sum from Distribution metrics in Stackdriver should show real values when percentiles/buckets are disabled, not zeroes.

Additional context
"jvm.gc.pause.max" is working correctly, as this is a separate metric created next to "jvm.gc.pause".
Chart for max for the same time range:
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    registry: stackdriverA StackDriver Registry related issueregressionA regression from a previous release

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions