-
Notifications
You must be signed in to change notification settings - Fork 787
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
[AOT] Removed support for ParseStateValues if the state neither implements IReadOnlyList nor IEnumberable when ParseStateValues
is true.
#4560
Conversation
c1caf1f
to
d59c258
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## main #4560 +/- ##
==========================================
+ Coverage 84.88% 84.92% +0.03%
==========================================
Files 313 313
Lines 12604 12594 -10
==========================================
- Hits 10699 10695 -4
+ Misses 1905 1899 -6
|
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
test/OpenTelemetry.Exporter.OpenTelemetryProtocol.Tests/OtlpLogExporterTests.cs
Outdated
Show resolved
Hide resolved
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.
Assuming @utpilla and @CodeBlanch are fine with this change, LGTM.
ParseStateValues
is true.
4fb135a
to
136cec1
Compare
src/OpenTelemetry/CHANGELOG.md
Outdated
@@ -2,6 +2,12 @@ | |||
|
|||
## Unreleased | |||
|
|||
* **Breaking Change** Removed support for ParseStateValues if the state | |||
implements neither IReadOnlyList nor IEnumberable when `ParseStateValues` is |
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.
implements neither IReadOnlyList nor IEnumberable when `ParseStateValues` is | |
implements neither `IReadOnlyList<KeyValuePair<string, object>>` nor `IEnumerable<KeyValuePair<string, object>>` when `ParseStateValues` is |
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.
Same for:
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.
@CodeBlanch Should we be using this instead?
IReadOnlyList<out T>
nor IEnumerable<out T>
where T
is KeyValuePair<string, object>
.
|
||
return Array.Empty<KeyValuePair<string, object?>>(); | ||
} | ||
OpenTelemetrySdkEventSource.Log.LoggerProcessStateSkipped<TState>(typeof(TState).FullName!, "This can be fixed by updating the state to be a type that implements either IReadOnlyList<KeyValuePair<string, object>> or IEnumerable<KeyValuePair<string, object>>."); |
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.
Update the documentation of ParseStateValues
option to reflect this change.
opentelemetry-dotnet/src/OpenTelemetry/Logs/ILogger/OpenTelemetryLoggerOptions.cs
Lines 53 to 70 in bd0d8d6
/// <summary> | |
/// Gets or sets a value indicating whether or not log state should be | |
/// parsed into <see cref="LogRecord.Attributes"/> on generated <see | |
/// cref="LogRecord"/>s. Default value: <see langword="false"/>. | |
/// </summary> | |
/// <remarks> | |
/// Notes: | |
/// <list type="bullet"> | |
/// <item>Parsing is only executed when the state logged does NOT | |
/// implement <see cref="IReadOnlyList{T}"/> or <see | |
/// cref="IEnumerable{T}"/> where <c>T</c> is <c>KeyValuePair<string, | |
/// object></c>.</item> | |
/// <item>When <see cref="ParseStateValues"/> is set to <see | |
/// langword="true"/> <see cref="LogRecord.State"/> will always be <see | |
/// langword="null"/>.</item> | |
/// </list> | |
/// </remarks> | |
public bool ParseStateValues { get; set; } |
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.
Just FYI removing this code ParseStateValues
essentially does nothing. Should we obsolete it?
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.
That would break build for users who have used this option in their Logs SDK setup, right?
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.
#4334 redefines ParseStateValues
.
With the redefined ParseStateValues
, value of public bool ParseStateValues { get; set; }
is default to false and only should be set to true if state does not implement either IReadOnlyList or IEnumerable if users want to get the properties with Reflection.
Shall we obsolete this API in this PR or use a follow-up PR for that?
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.
Shall we obsolete this API in this PR or use a follow-up PR for that?
It should be its own PR (if at all we decide to do that).
This change was merged in #4619 |
Towards #3429
Changes
Most TStates implements IReadOnlyList and IEnumerable.
Added a event to log a warning for states, which requires fetching properties at runtime, will be skipped if
RuntimeFeature.IsDynamicCodeSupported
evaluates to false.Merge requirement checklist
CHANGELOG.md
files updated for non-trivial changes