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

[bug]: Duplicated metric data values #746

Open
peterpakos opened this issue Sep 24, 2024 · 6 comments
Open

[bug]: Duplicated metric data values #746

peterpakos opened this issue Sep 24, 2024 · 6 comments
Labels

Comments

@peterpakos
Copy link

peterpakos commented Sep 24, 2024

What did you do

We are scraping custom CloudWatch metrics coming from Artillery.

Configuration snippet:

region: eu-west-2
role_arn: arn:aws:iam::xxx:role/grafana
delay_seconds: 0
use_get_metric_data: true
metrics:
  - aws_namespace: PerformanceTesting
    aws_metric_name: "http.requests"
    aws_dimensions: [Name, Test]
    aws_statistics: [Sum]

Metric data shown in CloudWatch UI:

image

Metric data returned from CloudWatch API:

{
    "MetricDataResults": [
        {
            "Id": "m1",
            "Label": "http.requests",
            "Timestamps": [
                "2024-09-24T12:31:00+00:00",
                "2024-09-24T12:30:00+00:00"
            ],
            "Values": [
                16.0,
                44.0
            ],
            "StatusCode": "Complete"
        }
    ],
    "Messages": []
}

What did you expect to see?

Prometheus metrics in Grafana matching metrics in CloudWatch.

What did you see instead? Under which circumstances?

First 2 data points matching CloudWatch then the last value repeated for 5-10 minutes.

Metric data in Grafana:

image

image

Are you currently working around this issue?

No

Environment

# docker images | grep cloudwatch-exporter
prom/cloudwatch-exporter             latest    70a238bc9c70   5 weeks ago     297MB
@peterpakos peterpakos added the bug label Sep 24, 2024
@matthiasr
Copy link
Contributor

I think this is a consequence of the range_seconds setting. On every scrape, the exporter will look that far back in CloudWatch – by default, 10 minutes. This is one of the many ugly things we need to do to bridge the gap between Prometheus' and Cloudwatch's metric-and-time models 😔

@matthiasr
Copy link
Contributor

You may want to enable set_timestamp, that way Prometheus should know that it's seeing the same sample over and over.

@peterpakos
Copy link
Author

@matthiasr AFAIK set_timestamp is set to true by default.

@matthiasr
Copy link
Contributor

Ah, true, then I'm not 100% sure what is going on. sum and range queries obscure the timing of the underlying samples in Prometheus. Could you run an instant query (table view in Prometheus UI / Grafana Explorer) with the time set to 2024-09-24 13:45 for performancetesting_http_requests_sum{…}[20m](with enough labels instead of to limit it to one raw time series)?

@matthiasr
Copy link
Contributor

this will return a single array-shaped result of (timestamp, value) pairs, those are what is really stored in Prometheus.

matthiasr added a commit that referenced this issue Nov 8, 2024
Related-to: #746

Signed-off-by: Matthias Rampke <matthias@prometheus.io>
@peterpakos
Copy link
Author

@matthiasr this is just one raw time series:

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants