-
Notifications
You must be signed in to change notification settings - Fork 74
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
Breaking: Replace Callbacks interface by Callbacks struct (server) #326
Breaking: Replace Callbacks interface by Callbacks struct (server) #326
Conversation
This continues work start in open-telemetry#324 for Client. The interface has the following downsides: - Impossible to define non-trivial default behavior. Here is an example where it was needed: open-telemetry#269 (comment) - Adding new callbacks requires expanding the interface, which is a breaking change for existing client users. Getting rid of the interface and keeping just a struct for callbacks solves both problems: - Arbitrarily complex default behavior can be now defined on the struct if the user does not provide the particular callback func. - Adding new callback funcs is not a braking change, existing users won't be affected.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #326 +/- ##
==========================================
+ Coverage 77.29% 77.81% +0.52%
==========================================
Files 25 25
Lines 2281 2321 +40
==========================================
+ Hits 1763 1806 +43
+ Misses 410 408 -2
+ Partials 108 107 -1 ☔ View full report in Codecov by Sentry. |
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.
Looks good to me. The change is removing a level of nesting from a lot of places in the codebase too. 👍
I do see a minor possible improvement, defaults could be defined as free standing functions and set by name in SetDefaults
, which would avoid the possibility of closing over function vars by accident. But, that's really a tiny nit.
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.
minor doc comments 👍
Agreed. Done. |
This continues work start in #324 for Client.
The interface has the following downsides:
Getting rid of the interface and keeping just a struct for callbacks solves both problems: