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

[SEMCONV] Metrics are incorrectly prefixed with metric. #3226

Closed
sjinks opened this issue Jan 4, 2025 · 0 comments · Fixed by #3228
Closed

[SEMCONV] Metrics are incorrectly prefixed with metric. #3226

sjinks opened this issue Jan 4, 2025 · 0 comments · Fixed by #3228
Assignees
Labels
bug Something isn't working triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@sjinks
Copy link
Contributor

sjinks commented Jan 4, 2025

Describe your environment OpenTelemetry 1.18

Steps to reproduce
When using CreateXXXMetricYY() functions from opentelemetry/api/semconv (for example, CreateAsyncInt64MetricProcessContextSwitches() or any other similar function), they create a metric prefixed with metric. (for example, metric.process.context_switches).

I believe this is not correct: for example, for the Context Switches metric, the specification says that the name is process.context_switches, not metric.process.context_switches.

What is the expected behavior?
Metric names match the specification.

What is the actual behavior?
Metric names have an additional prefix of metric..

Additional context
I think this bug was introduced in #3105, here:

static constexpr const char *{{v_metric_name}} = "{{metric.id}}";

By looking at the Process Metrics Model, we see:

  - id: metric.process.context_switches
    type: metric
    metric_name: process.context_switches
    stability: experimental
    brief: "Number of times the process has been context switched."
    instrument: counter
    unit: "{count}"
    attributes:
      - ref: process.context_switch_type

id is what we have now, metric_name is what we should probably have.

The fix I think will be (buildscripts/semantic-convention/templates/registry/semantic_metrics-h.j2)

-static constexpr const char *{{v_metric_name}} = "{{metric.id}}";
+static constexpr const char *{{v_metric_name}} = "{{metric.metric_name}}";
@sjinks sjinks added the bug Something isn't working label Jan 4, 2025
@github-actions github-actions bot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Jan 4, 2025
marcalff added a commit to marcalff/opentelemetry-cpp that referenced this issue Jan 6, 2025
@marcalff marcalff self-assigned this Jan 6, 2025
@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 Jan 7, 2025
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.

2 participants