Skip to content

[EXPORTERS] Configure prometheus timestamps#3894

Open
carlosroman wants to merge 4 commits intoopen-telemetry:mainfrom
carlosroman:configure-prometheus-timestamps
Open

[EXPORTERS] Configure prometheus timestamps#3894
carlosroman wants to merge 4 commits intoopen-telemetry:mainfrom
carlosroman:configure-prometheus-timestamps

Conversation

@carlosroman
Copy link

@carlosroman carlosroman commented Mar 1, 2026

Fixes #2316 and #3484.

Changes

This PR adds the ability to configure Prometheus timestamps. It was originally removed in #2316 but #2213 added it back in. I have another PR (#3895) that actually removes explicit timestamps from metric points instead if you'd prefer that one over this one. The reason I created this one is that it has been like this for 3 years so maybe people rely on this behavior.

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@carlosroman carlosroman marked this pull request as ready for review March 1, 2026 16:00
@carlosroman carlosroman requested a review from a team as a code owner March 1, 2026 16:00
@carlosroman carlosroman changed the title Configure prometheus timestamps [EXPORTERS] Configure prometheus timestamps Mar 1, 2026
@marcalff marcalff added the discuss To discuss in SIG meeting label Mar 1, 2026
@codecov
Copy link

codecov bot commented Mar 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.06%. Comparing base (739862d) to head (f7b4b42).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #3894   +/-   ##
=======================================
  Coverage   90.06%   90.06%           
=======================================
  Files         226      226           
  Lines        7223     7223           
=======================================
  Hits         6505     6505           
  Misses        718      718           
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lalitb
Copy link
Member

lalitb commented Mar 9, 2026

@carlosroman - there are merge conflicts to be resolved in this PR.


inline bool GetPrometheusWithoutTimestamps()
{
constexpr char kPrometheusWithoutTypeSuffix[] = "OTEL_CPP_PROMETHEUS_EXPORTER_WITHOUT_TIMESTAMPS";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit - The variable is named kPrometheusWithoutTypeSuffix but holds the timestamps env var. Should be kPrometheusWithoutTimestamps?

@carlosroman carlosroman force-pushed the configure-prometheus-timestamps branch from 5799702 to f7b4b42 Compare March 10, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

discuss To discuss in SIG meeting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prometheus exporter should not set explicit timestamps

3 participants