question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Agent v6: prometheus summary counts are not sent as monotonic counters

See original GitHub issue

Prometheus check does not send the .count metric generated from summary as deltas, but the raw value is sent. A similar issue was solved for counters with send_monotonic_counter option, but send_monotonic_counter does not have any effect on counters which are part of summary metrics.

Steps to reproduce the issue:

  1. Add a summary metric to your prometheus endpoint
  2. Set the agent to scrape it
  3. Observe that the value is always increasing

Describe the results you received:

Screenshot from 2019-06-12 16-56-31

A sloped line can be seen in this graph

Describe the results you expected:

Datadog agent should send deltas and and a (more or less) flat line should be visible. It should either respect send_monotonic_counter setting or a newly introduced similar setting (for backward compatibility).

Additional information you deem important (e.g. issue happens only occasionally):

This issue is related to https://github.com/DataDog/integrations-core/issues/1303 where send_monotonic_counter was introduced and is probably also related to https://github.com/DataDog/integrations-core/issues/1303#issuecomment-496142520

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:5
  • Comments:16 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
siriannicommented, Mar 24, 2020

Shouldn’t the histograms _sum also be sent as a monotonic counter? It’s currently hardcoded to send as a gauge. This makes it impossible to divide the _sum by the _count in order to get an average for the distribution (which seems to be the point of sending the sum & count).

https://github.com/DataDog/integrations-core/blob/master/datadog_checks_base/datadog_checks/base/checks/openmetrics/mixins.py#L706-L713

            if sample[self.SAMPLE_NAME].endswith("_sum"):
                tags = self._metric_tags(metric_name, val, sample, scraper_config, hostname=custom_hostname)
                self.gauge(
                    "{}.{}.sum".format(scraper_config['namespace'], metric_name),
                    val,
                    tags=tags,
                    hostname=custom_hostname,
                )
2reactions
tonglilcommented, Sep 5, 2019

I agree with @martin-sucha that counters (and sums) collected form summaries metrics should also be sent as monotonic counters, instead of defaulting to the gauge metric type in Datadog upon ingestion.

This should be true with the send_monotonic_counter: true option because when metrics get scraped, I want both counters and summary counts to be monotonic, so it is not possible to set that option to false (which is the requirement for the solution posted above).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Mapping Prometheus Metrics to Datadog Metrics
By default, Prometheus/OpenMetrics counter is mapped to Datadog's monotonic_count . ... and _sum values of the summary are each mapped to Datadog's count...
Read more >
Metric types
Counter ; Gauge; Histogram; Summary. The Prometheus client libraries offer four core metric types. These are currently only differentiated in the client ...
Read more >
Prometheus/OpenMetrics V1 - Agent Integrations
Summary metrics ending in: _sum represent the total sum of all observed values. Generally sums are like counters but it's also possible for...
Read more >
Prometheus Vs. OpenTelemetry Metrics: A Complete Guide
The Prometheus database can handle a lot of data, but it's not ... In the Prometheus context, a counter is monotonic (continuously ...
Read more >
Working With Prometheus Counter Metrics | Level Up Coding
The insights you get from raw counter values are not valuable in most cases. If we plot the raw counter value, we see...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found