-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[ISSUE-5161] Fix panics if a nil
context is provided to the .Start()
method
#5162
base: main
Are you sure you want to change the base?
Conversation
Could you add tests? |
This seems like standard Go behavior. The I do not think we should be adding boilerplate to all of our functions to prevent invalid user behavior in the eyes of Go. |
This was previously discussed and agreed upon here Here's a link to the spec, that says:
|
I may be doing lawyer talk, but I'm not sure the specification works for this case.
I read this specification as saying that the SDK's API methods should not throw unhandled exceptions when the SDK's API methods are used incorrectly by end-users.
This comment is not an agreement. It's a single approver's opinion (which is not to be dismissed either of course). |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5162 +/- ##
=====================================
Coverage 83.8% 83.8%
=====================================
Files 254 254
Lines 16532 16538 +6
=====================================
+ Hits 13864 13870 +6
Misses 2375 2375
Partials 293 293
|
I would agree with this if the second part of the spec was not included |
My reading of the spec is that we are required not to panic on nil context for API methods. It is also an improper use of go's Context, but i'm not sure that changes anything.
Thats correct. I'm happy to be overruled by other approvers here. But I don't think this needs to be a lot of boilerplate, since we don't actually need to add a nil check everywhere. IMO we should just update opentelemetry-go/trace/context.go Lines 13 to 15 in 014c6fc
I've checked all of our metric and trace APIs that accept a opentelemetry-go/trace/context.go Lines 37 to 40 in 014c6fc
If we did decide to go that route, it would be good, IMO to add the |
What about all API methods that accepts interfaces like E.g. do we want to add nil-checks in the code below? opentelemetry-go/metric/asyncint64.go Lines 108 to 114 in 6628407
|
Fix for #5161
As agreed by this discussion, the implementation should not throw unhandled exceptions at run time.