-
Notifications
You must be signed in to change notification settings - Fork 293
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
GenevaExporter - LogSerialization Fixes #295
Merged
cijothomas
merged 5 commits into
open-telemetry:main
from
cijothomas:cijothomas/geneva_logfix
Apr 14, 2022
Merged
GenevaExporter - LogSerialization Fixes #295
cijothomas
merged 5 commits into
open-telemetry:main
from
cijothomas:cijothomas/geneva_logfix
Apr 14, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
github-actions
bot
assigned cijothomas, CodeBlanch, mic-max, reyang, utpilla and Yun-Ting
Apr 14, 2022
github-actions
bot
requested review from
CodeBlanch,
mic-max,
reyang,
utpilla and
Yun-Ting
April 14, 2022 00:54
reyang
reviewed
Apr 14, 2022
reyang
reviewed
Apr 14, 2022
reyang
reviewed
Apr 14, 2022
reyang
reviewed
Apr 14, 2022
reyang
approved these changes
Apr 14, 2022
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.
Codecov Report
@@ Coverage Diff @@
## main #295 +/- ##
==========================================
- Coverage 24.46% 24.32% -0.15%
==========================================
Files 120 120
Lines 3687 3680 -7
==========================================
- Hits 902 895 -7
Misses 2785 2785
|
I think the CHANGELOG needs to be updated. |
utpilla
approved these changes
Apr 14, 2022
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes an issue which dropped the LogRecord.State, when it is a KVP of size1
Refactored LogExporter code a bit:
LogExporter obtains the IReadOnlyList<KeyValuePair<string, object>> by either casting the State, or from the StateValues.
Serializes each KVP to form Part C fields.
Body is only populated if IncludeFormatMessage is true OR special casing {OriginalFormat} from Log extension methods.
As a result:
The below log statement, will result in empty body, as there is no formatter provided by the user, and Exporter will not attempt "ToString() on the state" to populate body.
logger.Log(LogLevel.Information, default, state: "somestringasdata", exception: null, formatter: null);
The below log statement will also result in empty body, if
IncludeFormattedMessage = false
, else uses the formatted message from user. Again, Exporter does not attempt any "ToString()" of the state.logger.Log(LogLevel.Information, default, state: "somestringasdata", exception: null, formatter: (state, ex) => "Example formatted message.");
In short, Exporter no longer attempts to do "ToString() on state to populate body.".
4. Expecting slight perf boost (less if...else ladder), will run benchmarks and update numbers, before merging.// * Summary *
BenchmarkDotNet=v0.13.1, OS=Windows 10.0.19044.1586 (21H2)
Intel Core i7-4790 CPU 3.60GHz (Haswell), 1 CPU, 8 logical and 4 physical cores
.NET SDK=6.0.201
[Host] : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
DefaultJob : .NET 6.0.3 (6.0.322.12309), X64 RyuJIT
Main branch
with this PR