Skip to content

Logs: Scopes, State, & FormattedMessage follow-up#1883

Merged
CodeBlanch merged 5 commits intoopen-telemetry:mainfrom
CodeBlanch:log-expansion-part2
Mar 13, 2021
Merged

Logs: Scopes, State, & FormattedMessage follow-up#1883
CodeBlanch merged 5 commits intoopen-telemetry:mainfrom
CodeBlanch:log-expansion-part2

Conversation

@CodeBlanch
Copy link
Copy Markdown
Member

@CodeBlanch CodeBlanch commented Mar 9, 2021

Changes

Code review, unit tests, and performance tweaks from #1869.

I did some benchmarking and it turns out the dynamic method was actually slower & using more memory than the boxing we had before, so I removed it.

With parsing:

Method NumberOfMessages Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
Parsing 100 40.38 us 0.753 us 0.629 us 4.0894 - - 33.52 KB

With boxing:

Method NumberOfMessages Mean Error StdDev Gen 0 Gen 1 Gen 2 Allocated
Boxing 100 34.84 us 0.403 us 0.336 us 3.1128 - - 25.7 KB

Looking at the struct used for the log extensions (LogInformation, LogWarning, etc.), the results make sense. The box only has to move the three pointers. The KVP data is already in the object[] on the heap. The parser had to allocate a new list, and then loop over the KVPs to add them one-by-one. The mean time gets worse for each item added to the state. Oh well, they all can't be zingers.

TODOs:

  • CHANGELOG.md updated for non-trivial changes

@CodeBlanch CodeBlanch requested a review from a team March 9, 2021 06:11
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 9, 2021

Codecov Report

Merging #1883 (40e2e4e) into main (41a3371) will increase coverage by 0.85%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1883      +/-   ##
==========================================
+ Coverage   83.34%   84.19%   +0.85%     
==========================================
  Files         188      188              
  Lines        6141     6092      -49     
==========================================
+ Hits         5118     5129      +11     
+ Misses       1023      963      -60     
Impacted Files Coverage Δ
src/OpenTelemetry/Logs/LogRecord.cs 92.50% <100.00%> (+10.00%) ⬆️
src/OpenTelemetry/Logs/OpenTelemetryLogger.cs 93.93% <100.00%> (+67.11%) ⬆️
...c/OpenTelemetry/Logs/OpenTelemetryLoggerOptions.cs 87.50% <100.00%> (ø)
...emetry.Api/Internal/OpenTelemetryApiEventSource.cs 76.47% <0.00%> (-5.89%) ⬇️

@reyang
Copy link
Copy Markdown
Member

reyang commented Mar 9, 2021

Ping back from #1325 and #1328.

@CodeBlanch CodeBlanch merged commit b021b63 into open-telemetry:main Mar 13, 2021
@CodeBlanch CodeBlanch deleted the log-expansion-part2 branch March 13, 2021 19:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants