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 instrumentation scope attributes to otel_scope_info #5932

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

pellared
Copy link
Member

@pellared pellared commented Oct 30, 2024

Fixes #5846

Pre-work: #5806

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 84.6%. Comparing base (06ee6f2) to head (6f9faa2).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##            main   #5932     +/-   ##
=======================================
- Coverage   84.6%   84.6%   -0.1%     
=======================================
  Files        272     272             
  Lines      22854   22860      +6     
=======================================
+ Hits       19340   19344      +4     
- Misses      3170    3172      +2     
  Partials     344     344             

see 2 files with indirect coverage changes

@pellared pellared changed the title Prometheus exporter exports instrumentation scope attributes prometheus: Export instrumentation scope attributes in otel_scope_info Oct 30, 2024
@pellared pellared changed the title prometheus: Export instrumentation scope attributes in otel_scope_info prometheus: Add instrumentation scope attributes to otel_scope_info Oct 30, 2024
@pellared pellared marked this pull request as ready for review October 30, 2024 11:51
}
attrs = append(attrs, scope.Attributes.ToSlice()...)

keys, values := getAttrs(attribute.NewSet(attrs...), [2]string{}, [2]string{}, keyVals{})
Copy link
Member Author

@pellared pellared Oct 30, 2024

Choose a reason for hiding this comment

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

I thought about refactoring getAttrs into two functions like:

func getAttrs(attrs attribute.Set) ([]string, []string)

func getAttrsWithAppend(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]string, []string)
OR
func getMetricAttrs(attrs attribute.Set, ks, vs [2]string, resourceKV keyVals) ([]string, []string)

but I resisted as I thought it may be too much in a single PR

We currently have getAttrs(XYZ), [2]string{}, [2]string{}, keyVals{}) call in three places: createInfoMetric, createScopeInfoMetric, createResourceAttributes.

The getAttrs(dp.Attributes, ks, vs, resourceKV) calls are used in: addHistogramMetric, addSumMetric, addGaugeMetric.

Let me know if I should address it in this PR, separate PR, or should I leave as it is.

My preference is to make a separate PR for it as I am not sure about naming "the longer" function. Also it should make the PRs easier for review.

Copy link
Member Author

Choose a reason for hiding this comment

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

@dashpole, I am asking for your guidance and preferences 🙏

Copy link
Member Author

Choose a reason for hiding this comment

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

Here is my proposal on how to refactor it: #5937

@pellared pellared added this to the v1.32.0 milestone Oct 30, 2024
Copy link
Contributor

@MrAlias MrAlias left a comment

Choose a reason for hiding this comment

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

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 export instrumentation scope attributes
2 participants