-
Notifications
You must be signed in to change notification settings - Fork 772
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
Remove options, stick with builder #1875
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1875 +/- ##
==========================================
- Coverage 83.77% 83.22% -0.56%
==========================================
Files 187 188 +1
Lines 5967 6129 +162
==========================================
+ Hits 4999 5101 +102
- Misses 968 1028 +60
|
I really don't get the motivation for this. This is a pretty standard pattern. Options is the root thing that can just be new'd up and you can configure the options yourself. But a builder wrapper around that to provide a fluent API for setting up your configuration. It's the exact same pattern that appears about 1000 times all over the .NET generic host and ASP.NET and many many other systems. |
OpenTelemetry docs says that SDK should not have any breaking changes. At least for one year. I think, this PR changes the way to configure of OpenTelemetry, and break the compatibility. |
There is no breaking change. This PR is reverting an option which was introduced last week (and never released, as indicated by changes to .publicapi.unshipped.txt). |
/// <param name="tracerProviderBuilder">TracerProviderBuilder instance.</param> | ||
/// <param name="enabled">Enabled or not. Default value is <c>true</c>.</param> | ||
/// <returns>Returns <see cref="TracerProviderBuilder"/> for chaining.</returns> | ||
public static TracerProviderBuilder SetErrorStatusOnException(this TracerProviderBuilder tracerProviderBuilder, bool enabled = 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.
@reyang Just curious, what's the use case you were thinking of for adding with enabled = false
?
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.
The spec SIG is working on "Convenience" API. I imagine at certain point we might have customers extending the API and provide something like:
Sdk.CreateTracerProviderBuilder()
.EnableFamilyPack() // which includes SetErrorStatusOnException(true)
.SetErrorStatusOnException(false)
Related to #1858 and #1833.
Changes
I would propose that we only use builder as the configuration, instead of having both builder and options pattern.
This could also help us to have a consistent model when we convert raw metrics to logs, activities to sampled metrics, activity events to logs, and logs to activity events - as discussed here.
Couple benefits:
For significant contributions please make sure you have completed the following items:
CHANGELOG.md
updated for non-trivial changes