Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong percentile values for metrics shown in Datadog #2819

Closed
imiric opened this issue Dec 13, 2022 · 5 comments
Closed

Wrong percentile values for metrics shown in Datadog #2819

imiric opened this issue Dec 13, 2022 · 5 comments
Labels
bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6 metrics-output Issues related to the metrics output (a.k.a. just output) statsd Something related to the statsd

Comments

@imiric
Copy link
Contributor

imiric commented Dec 13, 2022

Brief summary

As reported several times on the forum (1, 2, 3), the percentile values users can visualize in Datadog are often wrong when compared to the end-of-test summary shown by k6.

As explained here, this is likely caused by the additional aggregation done by the DogStatsD agent, which by default only generates the 95percentile metric, which is then aggregated again by the query used in the Datadog graph.

Besides resulting in wrong values, users are unable to use raw metric data to generate any percentile value they need.

k6 version

0.41.0

OS

any

Steps to reproduce the problem

  1. Follow the steps to setup the Datadog Agent, and run a test as explained here.

  2. Go to the Datadog web UI and visualize the k6.http_req_duration.max and k6.http_req_duration.95percentile metrics, and compare them to the end-of-test summary shown by k6. Notice that they don't match.

Expected behaviour

  • The percentiles shown in Datadog should match the end-of-test summary shown by k6.

  • The user should be able to generate any percentile over raw metric data sent to Datadog. Ideally, the Datadog Agent (DogStatsD) shouldn't do any aggregation at all.

Actual behaviour

  • The percentiles are different, and the Datadog 95percentile is confusing.

  • The user can only use a limited number of metrics, and most pre-aggregated ones show wrong values.

Suggested solution

After going through the Datadog documentation, it seems it's possible to send raw data that won't be aggregated by the Datadog Agent using the distribution metric type (1, 2). This would not only avoid the aggregation, but allow users to generate any percentile value they need over the raw data.

The drawback would possibly be overloading the ingest pipeline (either of the Datadog Agent or of Datadog itself, hitting some API limits, etc.), so this needs to be thoroughly tested.

Currently we send Count, Gauge and other metric types that will be aggregated, but the datadog-go/statsd client we use also supports the Distribution metric.

In addition to evaluating whether this change works for some of our metric types, we should also ensure that we don't break support for any other StatsD backends.

@imiric imiric added bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6 labels Dec 13, 2022
@imiric imiric changed the title Wrong percentile values for metrics sent to Datadog Wrong percentile values for metrics shown in Datadog Dec 13, 2022
@imiric
Copy link
Contributor Author

imiric commented Dec 19, 2022

I think sending our Trend metric as a Distribution metric would also fix querying percentiles in New Relic. See the New Relic data types documentation, specifically for the distribution type. Notice that it supports the percentile and histogram functions, which are not supported by the other types.

Currently this is not supported, and we removed the documentation about the previously wrong query in grafana/k6-docs#895.

@vieiraes
Copy link

vieiraes commented Apr 14, 2023

waiting for a update about it... all % metrics are different in Datadog...

@imiric
Copy link
Contributor Author

imiric commented Apr 17, 2023

Sorry about that @vieiraes. 😞 You can see some updates in #2982.

What we decided to do is to split up the DataDog and New Relic outputs into separate k6 extensions, since it's clear that they can't be well supported by the generic statsd output.

This work is high priority, as we know it's a major impact for k6 users of these backends, so it's likely we'll start working on this in the next few weeks, but we can't promise any ETAs yet.

@olegbespalov olegbespalov added metrics-output Issues related to the metrics output (a.k.a. just output) statsd Something related to the statsd labels Jul 12, 2024
@LeonAdato
Copy link

Per @olegbespalov and @javaducky, this issue should probably be part of the StatsD project. Feel free to transfer it here:

https://github.com/LeonAdato/xk6-output-statsd

@olegbespalov
Copy link
Contributor

Closing in favor of LeonAdato/xk6-output-statsd#24

@olegbespalov olegbespalov closed this as not planned Won't fix, can't repro, duplicate, stale Aug 30, 2024
@olegbespalov olegbespalov removed their assignment Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug evaluation needed proposal needs to be validated or tested before fully implementing it in k6 metrics-output Issues related to the metrics output (a.k.a. just output) statsd Something related to the statsd
Projects
None yet
Development

No branches or pull requests

5 participants