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: Add otel_scope_schema_url and otel_scope_[attribute] labels #5947

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pellared
Copy link
Member

@pellared pellared commented Nov 7, 2024

Towards open-telemetry/opentelemetry-specification#4223 and #5846

  • Add instrumentation scope schema URL as otel_scope_schema_url label to otel_scope_info metric
  • Add instrumentation scope schema URL as otel_scope_schema_url label to "real" OTel metrics
  • Add instrumentation scope attributes as otel_scope_[attribute] labels to "real" OTel metrics

Side notes:

  • The exporter does not seem to work correctly if the end user adds e.g. an otel_scope_name attribute. I think the exporter should ignore all attributes with names that have prefix otel_scope_. This scenario is also not covered by the spec.
  • I remember that David was also proposing to have the new functionality behind some env var feature toggle

@pellared
Copy link
Member Author

pellared commented Nov 7, 2024

@dashpole PTAL

Copy link

codecov bot commented Nov 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.6%. Comparing base (ff07838) to head (417330c).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5947   +/-   ##
=====================================
  Coverage   84.6%   84.6%           
=====================================
  Files        272     272           
  Lines      22864   22872    +8     
=====================================
+ Hits       19348   19356    +8     
  Misses      3172    3172           
  Partials     344     344           

see 1 file with indirect coverage changes


attrKeys, attrVals := getAttrs(scopeMetrics.Scope.Attributes)
for i := range attrKeys {
attrKeys[i] = "otel_scope_" + attrKeys[i]
Copy link
Member Author

@pellared pellared Nov 7, 2024

Choose a reason for hiding this comment

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

I was thinking about also adding otel_scope_ prefix for the otel_scope_info metric, but I feel that this would be a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense. There isn't really any purpose to the otel_scope_info metric anymore, since it duplicates labels already available on metrics.

Copy link
Member Author

@pellared pellared Nov 11, 2024

Choose a reason for hiding this comment

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

What about backwards compatibility for OTel Collector Prometheus receiver? Jot needed as it is not stable?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can use an env var to gate the feature and allow migrating from otel_scope_info to otel_scope_. We probably shouldn't produce both at once.

@pellared pellared changed the title [POC] prometheus: Add otel_scope_schema_url and otel_scope_[attribute] labels prometheus: Add otel_scope_schema_url and otel_scope_[attribute] labels Nov 7, 2024
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.

2 participants