-
Notifications
You must be signed in to change notification settings - Fork 657
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
Resource aggregator method is missing Default Resource Bizmetric Attributes #1996
Comments
Option 2 would require a one line fix: detectors = [OTELResourceDetector()] + detectors becomes: detectors = [Resource.create()] + detectors |
This can already be done by passing opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py Line 284 in 3992778
For Option 2, you could just change the default for |
Yes but it will duplicated adding
Yes that's a good point! But we would miss out of the other stuff that opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py Lines 171 to 181 in 3992778
Also I don't think it would be an issue, but if we every treated |
I don't think Can we just include |
@lzchen That's a great call out! I came up with a similar solution in #2013, except I didn't add the But I would be okay with it also having the default attributes! |
Unrelated, where did you see these called "business metrics?" I've never heard that lol |
Oh that's weird. I'm actually confused why all of that is happening in |
Lol I hadn't heard about this either 😅 My manager was using this term a lot and it wasn't until I finally asked that I found out she was referring to "attributes which identify where the telemetry is coming from and which helps the business people use metrics to justify how many users are using this telemetry producer" 🙂 |
Describe your environment
As of OTel Python 1.4
Steps to reproduce
If you want to use custom
ResourceDetector
s, we recommend you use theget_aggregated_resources
method because it will automatically merge your customResourceDetector
with theOTELResourceDetector
(used to readResourceDetector
attributes from theOTEL_RESOURCE_ATTRIBUTES
andOTEL_SERVICE_NAME
environment variables).However, if you do that, you miss out on the "business metrics" attributes that get created with
Resource.create()
opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Lines 246 to 252 in 3992778
Resource.create()
actually usesOTELResourceDetector
too. So if you try to get the bizmetrics by doingget_aggregated_resources([ MyCustomResourceDetector(), Resource.create() ])
, you will getOTELResourceDetector
twice. (Once fromResource.create()
and once fromget_aggregated_resources
. See the code here:opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Lines 168 to 170 in 3992778
opentelemetry-python/opentelemetry-sdk/src/opentelemetry/sdk/resources/__init__.py
Line 295 in 3992778
What is the expected behavior?
Bizmetrics should be on every span which uses the aggregated Resource from
get_aggregated_resources
What is the actual behavior?
Using
get_aggregated_resources
as we recommend causes bizmetrics to be missed.Additional context
The most obvious solutions would be to
OTELResourceDetector
fromget_aggregated_resources
's default implementation so users can add eitherOTELResourceDetector
orResource.create()
depending on what they wantOTELResourceDetector
inget_aggregated_resources
withResource.create()
so spans always get bizmetrics by defaultSince we already 1.0+, I recommend Option 2. This will just "Add" attributes and won't break anyone using this method who expects
OTELResourceDetector
attributes to be there when they useget_aggregated_resources
. They will just get bizmetric attributes for free.The text was updated successfully, but these errors were encountered: