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 does not add _total suffixes to counters #2287

Closed
dashpole opened this issue Sep 1, 2023 · 3 comments
Closed

Prometheus exporter does not add _total suffixes to counters #2287

dashpole opened this issue Sep 1, 2023 · 3 comments
Assignees
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

dashpole commented Sep 1, 2023

What is the expected behavior?

From https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/compatibility/prometheus_and_openmetrics.md#sums:

If the metric name for monotonic Sum metric points does not end in a suffix of _total a suffix of _total MUST be added by default, otherwise the name MUST remain unchanged. Exporters SHOULD provide a configuration option to disable the addition of _total suffixes.

What is the actual behavior?

Based on the unit test here:

TEST(PrometheusExporterUtils, TranslateToPrometheusIntegerCounter)
{
metric_sdk::ResourceMetrics metrics_data = CreateSumPointData();
auto translated = PrometheusExporterUtils::TranslateToPrometheus(metrics_data);
ASSERT_EQ(translated.size(), 1);
auto metric1 = translated[0];
std::vector<int> vals = {10};
assert_basic(metric1, "library_name", "description", prometheus_client::MetricType::Counter, 1,
vals);
}

The counter metric does not have a _total suffix appended.

@dashpole dashpole added the bug Something isn't working label Sep 1, 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 1, 2023
@marcalff
Copy link
Member

marcalff commented Sep 1, 2023

Thanks for the report.

@esigo Sounds in the same area as #2213, please take a look.

@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 6, 2023
Copy link

github-actions bot commented Nov 6, 2023

This issue was marked as stale due to lack of activity.

@github-actions github-actions bot added the Stale label Nov 6, 2023
@esigo esigo removed the Stale label Nov 19, 2023
@dashpole
Copy link
Contributor Author

Fixed by #2213

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