-
Notifications
You must be signed in to change notification settings - Fork 291
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
[Instrumentation.AWSLambda] Remove AddAWSLambdaConfigurations with default parameter #943
[Instrumentation.AWSLambda] Remove AddAWSLambdaConfigurations with default parameter #943
Conversation
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #943 +/- ##
=======================================
Coverage 70.18% 70.18%
=======================================
Files 210 210
Lines 7864 7865 +1
=======================================
+ Hits 5519 5520 +1
Misses 2345 2345
|
What is the advantage of this change? It seems to make the code longer and less clear and is also API-breaking. I also don't see the relation to the linked comment, but probably I'm missing something? |
@Oberon00, I have linked wrong comment, see https://github.com/open-telemetry/opentelemetry-dotnet/pull/3653/files#r969915942
In general it is binary-breaking change but does not require any source code changes. |
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.
Can you maybe help me with some link to an explanation of this best practice of avoiding default parameters (assuming it is one)?
@@ -4,9 +4,13 @@ | |||
|
|||
* Add HTTP server span attributes for API Gateway triggers | |||
([#626](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/626)) | |||
* Removes `AddAWSLambdaConfigurations` method with default configure parameter. |
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 confusing because from the user's perspective it is not removed but just replaced with another method. Probably we don't even need a changelog entry here, unless it's really ABI-breaking
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.
In some strange cases it can be treated as ABI-breaking. https://stackoverflow.com/a/9916197
Most cases it is not.
I do not found anything beyond https://github.com/open-telemetry/opentelemetry-dotnet/pull/3653/files#r969915942. For me, follow the rule from SDK repository is good enough argument to this change. |
This PR was marked stale due to lack of activity. It will be closed in 7 days. |
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.
OK with me then, although I'm not entirely convinced, I don't want to block it either, because I do acknowledge that I might just be ignorant of the value of this change.
So the rule boils down to: "Never combine overloads and default arguments"? I.e. if I have an overloaded method, I must never add default arguments to any overload, and if I have default arguments I must never overload the method?
@Oberon00 Not having optional arguments in public methods makes it simpler to extend the methods to accept more arguments in future without worrying about making breaking changes. This doc talks about it in detail: We agreed that it's best to not have optional parameters in the public methods. This allows for a very easy way to change the method signature if required in future. |
Propagate recommendations from https://github.com/open-telemetry/opentelemetry-dotnet/pull/3653/files#r970049254
Changes
Remove
AddAWSLambdaConfigurations
with default parameterFor significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes[ ] Design discussion issue #