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

Prometheus exporter should not set explicit timestamps #2316

Closed
dashpole opened this issue Sep 19, 2023 · 1 comment · Fixed by #2324
Closed

Prometheus exporter should not set explicit timestamps #2316

dashpole opened this issue Sep 19, 2023 · 1 comment · Fixed by #2324
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@dashpole
Copy link
Contributor

Steps to reproduce

I saw second-hand that the prometheus exporter adds explicit timestamps, but don't have exact reproduction steps.

# TYPE grpc_client_attempt_started_ counter
grpc_client_attempt_started_{grpc_method="grpc.testing.TestService/UnaryCall",grpc_target="dns:///10.52.1.55:14285"} 10 1694819876572

The last number on the right is the start timestamp.

What is the expected behavior?
Metrics should not have explicit timestamps set. From the OpenMetrics specification

MetricPoints SHOULD NOT have explicit timestamps.

What is the actual behavior?

Explicit timestamps are added to prometheus metrics.

metric.timestamp_ms = time.count() / 1000000;

Additional context

In prometheus, the scrape time is used as the timestamp. Explicit timestamps can limit some functionality, such as compatibility with the prometheus push gateway, so they are generally not recommended.

@dashpole dashpole added the bug Something isn't working label Sep 19, 2023
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Sep 19, 2023
@yashykt
Copy link
Contributor

yashykt commented Sep 19, 2023

This was seen on gRPC C++'s OTel plugin, but the pattern of usage is nothing out of the ordinary from what I understand. Reference - https://github.com/grpc/grpc/blob/62521a889fe134859aed7bdf4ea0730534f15d09/src/cpp/ext/otel/otel_plugin.cc#L170

A Meter with the name "grpc" was created, and a counter instrument with the name "grpc.client.attempt.started" was created out of it.

The counter was incremented like so - https://github.com/grpc/grpc/blob/62521a889fe134859aed7bdf4ea0730534f15d09/src/cpp/ext/otel/otel_client_filter.cc#L122

@marcalff marcalff added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 20, 2023
punya added a commit to punya/opentelemetry-cpp that referenced this issue Sep 22, 2023
punya added a commit to punya/opentelemetry-cpp that referenced this issue Sep 22, 2023
punya added a commit to punya/opentelemetry-cpp that referenced this issue Sep 23, 2023
punya added a commit to punya/opentelemetry-cpp that referenced this issue Sep 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants