-
Notifications
You must be signed in to change notification settings - Fork 289
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
Removing automatic service name from Lambda instrumentation #1080
Removing automatic service name from Lambda instrumentation #1080
Conversation
|
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #1080 +/- ##
==========================================
- Coverage 69.31% 69.26% -0.05%
==========================================
Files 214 212 -2
Lines 8358 8337 -21
==========================================
- Hits 5793 5775 -18
+ Misses 2565 2562 -3
|
@@ -55,7 +55,11 @@ public static class TracerProviderBuilderExtensions | |||
builder.AddSource(AWSLambdaWrapper.ActivitySourceName); | |||
builder.SetResourceBuilder(ResourceBuilder |
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 don't think this is necessary or even very useful: Using the new ConfigureResource
API introduced in open-telemetry/opentelemetry-dotnet#2909 + open-telemetry/opentelemetry-dotnet#3307, one can override the service more easily already.
But: It would be good if this call here could also be changed to use ConfigureResource
instead of SetResourceBuilder
, so it does not reset any other resources set before it. This is only tangentially related though and not a prerequisite for overriding the service afterwards.
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.
@Oberon00 Completely agree - there are fine existing ways to override the service name as is, I'm currently using the ConfigureResource
API in existing implementations.
Where I saw value here was in the lack of clarity that such an override is necessary in the first place, if one required their service name to differ from the Lambda function name. Documentation indicates that setting the OTEL_SERVICE_NAME
environment variable (or injecting attributes via OTEL_RESOURCE_ATTRIBUTES
) should set the service.name
attribute as desired, but that didn't seem to be what happened in practice.
I didn't find it immediately clear anywhere that behavior is different with Lambdas using this package, so this change wasn't intended to add functionality so much as just clarity.
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 is currently still in beta, so we may break things if we find we need to. I think that this overrides an explicitly set OTEL_SERVICE_NAME is a bug. IMHO, it would be good to completely remove setting the service name here, and we can maybe later add it back under a dedicated off-by-default option (or even just provide an API that returns the function name for users to set as service name themselves)
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.
It certainly seems more like a bug than intended behaviour, for sure.
I'm happy to repurpose this PR to remove the functionality that sets the service name, if you'd like?
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 that would be a better solution for the problem you describe. Thank you!
Please add a CHANGELOG entry and also check if the README or any xmldoc needs to be updated, then this is good to go from my perspective. Thank you! |
…hub.com/ehornby/opentelemetry-dotnet-contrib into awsLambdaWrapper_addServiceNameOverride
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.
LGTM, per discussion in this PR.
Changes
Adding a
ServiceNameOverride
property toAwsLambdaInstrumentationOptions
for instances where desired service name is different than Lambda function name.For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes