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

[EXPORTER] Prometheus: Remove explicit timestamps from metric points #2324

Merged
merged 1 commit into from
Sep 23, 2023

Conversation

punya
Copy link
Member

@punya punya commented Sep 22, 2023

Fixes #2316

Changes

Please provide a brief description of the changes here.

For significant contributions please make sure you have completed the following items:

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

@punya punya requested a review from a team September 22, 2023 18:58
@codecov
Copy link

codecov bot commented Sep 22, 2023

Codecov Report

Merging #2324 (e9f556b) into main (ca67af0) will increase coverage by 0.02%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2324      +/-   ##
==========================================
+ Coverage   87.45%   87.47%   +0.02%     
==========================================
  Files         199      199              
  Lines        5997     5997              
==========================================
+ Hits         5244     5245       +1     
+ Misses        753      752       -1     

@marcalff
Copy link
Member

@punya Thanks for the fix.

The failing CI is due to:

/home/runner/work/opentelemetry-cpp/opentelemetry-cpp/exporters/prometheus/src/exporter_utils.cc:47:12: error: unused variable 'time' [-Werror,-Wunused-variable]
      auto time          = metric_data.end_ts.time_since_epoch();

Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM once the CI is fixed.

@lalitb
Copy link
Member

lalitb commented Sep 22, 2023

Format needs to be fixed, either by running cmake-format, or adding the patch below:

--- a/exporters/prometheus/test/exporter_utils_test.cc
+++ b/exporters/prometheus/test/exporter_utils_test.cc
@@ -43,7 +43,8 @@ void assert_basic(prometheus_client::MetricFamily &metric,
   ASSERT_EQ(metric.type, type);                      // type translated
 
   // Prometheus metric data points should not have explicit timestamps
-  for (const prometheus::ClientMetric &cm : metric.metric) {
+  for (const prometheus::ClientMetric &cm : metric.metric)
+  {
     ASSERT_EQ(cm.timestamp_ms, 0);
   }

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

Thanks for the fix.

@marcalff marcalff merged commit 41a7875 into open-telemetry:main Sep 23, 2023
45 checks passed
@marcalff marcalff changed the title [exporters/prometheus] Remove explicit timestamps from metric points [EXPORTER] Prometheus: Remove explicit timestamps from metric points Oct 11, 2023
@punya punya deleted the no-explicit-timestamps branch September 1, 2024 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Prometheus exporter should not set explicit timestamps
3 participants