-
Notifications
You must be signed in to change notification settings - Fork 773
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
OTLP LogExporter to enable ParseStateValues by default #3186
OTLP LogExporter to enable ParseStateValues by default #3186
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3186 +/- ##
==========================================
+ Coverage 85.17% 85.75% +0.57%
==========================================
Files 259 260 +1
Lines 9345 9358 +13
==========================================
+ Hits 7960 8025 +65
+ Misses 1385 1333 -52
|
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.
@alanwest @CodeBlanch Please share your thoughts/comments. I think this is a reasonable way to proceed. (will do similar change for ConsoleExporter as well), by letting individual Exporters to make it easy for their users to configure ParseStateValues. If an Exporter wants to still do its own parsing of "State", its totally legal, as |
@@ -42,7 +42,7 @@ private static OpenTelemetryLoggerOptions AddOtlpExporter(OpenTelemetryLoggerOpt | |||
{ | |||
configure?.Invoke(exporterOptions); | |||
var otlpExporter = new OtlpLogExporter(exporterOptions); | |||
|
|||
loggerOptions.ParseStateValues = 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.
Might be useful to have a comment here explaining why it is being done?
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.
Feels a bit clunky but I don't have a better solution 😄
Should we add more to the comments here calling out that exporters may automatically enable ParseStateValues
if they support the feature?
/// <summary> | |
/// Gets or sets a value indicating whether or not log state should be | |
/// parsed into <see cref="LogRecord.StateValues"/> on generated <see | |
/// cref="LogRecord"/>s. Default value: False. | |
/// </summary> | |
/// <remarks> | |
/// Note: When <see cref="ParseStateValues"/> is set to <see | |
/// langword="true"/> <see cref="LogRecord.State"/> will always be <see | |
/// langword="null"/>. | |
/// </remarks> |
I agree feels a bit clunky for AddOltpExporter to have the side effect of changing an option - though I also agree that Why not the proposal from this comment? Are we considering it inefficient because prevents state from being garbage collected? Or some other reason? #3183 (comment).
Another alternative may be to make the setting opentelemetry-dotnet/src/OpenTelemetry/Metrics/PeriodicExportingMetricReaderOptions.cs Lines 19 to 26 in a709cfd
I guess this would be a breaking change for anyone who's written an extension that uses the LoggingOptions class... maybe ok? |
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.
Approving, but curious of folks thoughts on questions I posed.
I liked this too initially. But then looking at some code, for example: If we switched the behavior so we always set state, anyone who has their ordering as "check state, then check StateValues" we might be breaking those exporters if we do that.
I like that. Might still be breaking. We could |
Yea, you're right it would definitely be a breaking change. It kinda seems like someone would need to be doing something kinda funky to be affected by the change, but obviously that's not a good enough reason for a breaking change 😄. I'm not opposed to this idea of adding |
Merging to continue fixing the rest of OTLP LogExporter issues. |
See #3183 (comment)