-
Notifications
You must be signed in to change notification settings - Fork 769
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
Default Resource should have service.name attribute #1744
Default Resource should have service.name attribute #1744
Conversation
/// semantic conventions</a> for details. | ||
/// </summary> | ||
/// <returns>Created <see cref="ResourceBuilder"/>.</returns> | ||
public static ResourceBuilder CreateSDK() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should stick with the casing "Sdk" since it is used elsewhere (eg AddTelemetrySdk
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, do we need a CreateSdk
? How will user know which one to call (CreateDefault()
or CreatedSdk()
)? Probably better for us to give them just one path (pit of success).
What if we combined both into one thing?
public static ResourceBuilder CreateDefault(bool addTelemetrySdk = true)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix the Sdk casing immediately. I like the idea of the optional parameter on default. This way we'll always have service.name and then optionally include the Telemetry SDK resource.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddTelemetrySdk
already exists on ResourceBuilder extensions, so why need it here again?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this not where we would provide access to the Telemetry Resource? We previously used CreateDefault to just link directly to AddTelemetrySDK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Users just need an API to add TelemetrySDK, which we already provide. There is no need of an additional method.
A user can do:
ResourceBuilder.CreateEmpty().AddTelemetrySdk() - Resource will only have telemetrysdk attributes.
or
ResourceBuilder.CreateDefault().AddTelemetrySdk() - Resource will have telemetrysdk attributes + the default. (default is service.name("unknownservice..."))
or
ResourceBuilder.CreateDefault().AddTelemetrySdk().AddServiceName("CijoService") - Resource will have telemetrysdk attributes + service.name ("CijoService"). Due the merge priority, "CijoService" overrides the default one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This thinking makes a lot of sense to me. I'll remove the various extra things we introduced in this PR, and I like @CodeBlanch 's approach too but I think this is more elegant. Will not be implementing the optional parameter.
I'm not sure I agree with this interpretation, the spec says "at least". Including the |
Some exporters export all the resource attributes with every span. With this PR as is, If a user add Resource.Default - they'll get only the MUST have resource (servicename), instead of getting TelemetrySDK attributes as well. But not opposed to making telemetrysdk to the Default itself. The spec about TelemetrySDK (https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/resource/semantic_conventions#telemetry-sdk), is not yet marked stable. So we should be able to do the following: For 1.0.0, Resource.Default - only contain "service.name". If user want teleemtrySDK, they need to manually call Post 1.0.0, when Resource Semantic Conventions gets marked as stable, we can modify Resource.Default to include TelemetrySDK as well. (This shouldn't cause duplicates anyway, so would be backward compatible as well.) Okay with this approach? |
Okay, that makes sense. |
@@ -90,7 +90,7 @@ public static class ResourceBuilderExtensions | |||
/// <summary> | |||
/// Adds service information to a <see cref="ResourceBuilder"/> | |||
/// following <a | |||
/// href="https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/resource/semantic_conventions#telemetry-sdk">semantic | |||
/// href="https://github.com/open-telemetry/opentelemetry-specification/tree/master/specification/resource/semantic_conventions#telemetry-sdk">semantic |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change is incorrect. the branch was named to "main" last week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed this, but when I use .../master/... the link doesn't properly direct to the right part of the page. /main/ will show the warning but also direct to the right section of the page.
I'll still change it to master.
src/OpenTelemetry/CHANGELOG.md
Outdated
@@ -44,6 +44,10 @@ Released 2021-Jan-29 | |||
[#1501](https://github.com/open-telemetry/opentelemetry-dotnet/pull/1655) | |||
for details on Metric release plans. | |||
* Fix Resource attribute telemetry.sdk.version to have correct file version. | |||
* Default `Resource` has been updated. No longer linked to Telemetry SDK, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a simple one liner like this is sufficient for changelog: Default resource will now contain service.name instead of telemetrysdk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes recent OTel Spec change.
Changes
Instead of by default attaching a Telemetry SDK resource with package information, the default is attaching a one-tag service.name following the requirements specified in Resource.md.
Will have a follow-up PR to have exporters actually access this default.
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes