Skip to content
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

feat: Use structured logging for internal logs #1903

Merged
merged 7 commits into from
Sep 14, 2023

Conversation

chynesNR
Copy link
Member

This gives us:

  • Full exception info and stack trace for all errors
  • No longer need separate "Format" versions of logging functions (e.g. DebugFormat, FinestFormat, etc) or separate exception logging functions

I also removed some redundant if [Debug]Enabled Log.[Debug] checks.

Two areas that could still use some cleanup:

  • I didn't convert any string interpolation to use a structured log line, only explicit calls to the Format methods
  • Transaction.LogFinest() could probably use a little restructuring to avoid all the checks if Finest is enabled

Resolves #1667

@chynesNR chynesNR marked this pull request as ready for review September 13, 2023 16:16
@codecov-commenter
Copy link

Codecov Report

Merging #1903 (430fc4f) into main (9399c0a) will increase coverage by 0.13%.
Report is 6 commits behind head on main.
The diff coverage is 58.97%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1903      +/-   ##
==========================================
+ Coverage   83.39%   83.52%   +0.13%     
==========================================
  Files         402      402              
  Lines       24694    24593     -101     
==========================================
- Hits        20593    20541      -52     
+ Misses       4101     4052      -49     
Files Changed Coverage Δ
src/Agent/NewRelic/Agent/Core/Agent.cs 77.36% <0.00%> (ø)
...t/NewRelic/Agent/Core/AgentInstallConfiguration.cs 77.45% <0.00%> (ø)
...ent/Core/Aggregators/MetricStatsCollectionQueue.cs 84.61% <0.00%> (ø)
...rc/Agent/NewRelic/Agent/Core/Api/AgentBridgeApi.cs 50.90% <0.00%> (ø)
...ewRelic/Agent/Core/Api/DistributedTraceApiModel.cs 83.33% <ø> (ø)
src/Agent/NewRelic/Agent/Core/Api/SpanBridgeApi.cs 0.00% <0.00%> (ø)
.../Agent/Core/Attributes/AttributeValueCollection.cs 78.59% <0.00%> (ø)
...rowserMonitoring/BrowserMonitoringPrereqChecker.cs 85.18% <0.00%> (ø)
.../NewRelic/Agent/Core/CallStack/CallStackManager.cs 53.00% <0.00%> (ø)
...gent/Core/Commands/InstrumentationUpdateCommand.cs 66.66% <0.00%> (ø)
... and 60 more

... and 1 file with indirect coverage changes

@nr-ahemsath nr-ahemsath merged commit 0031700 into main Sep 14, 2023
@nr-ahemsath nr-ahemsath deleted the feature/internal-structured-logging branch September 14, 2023 19:41
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.

Refactor string formatting in log messages
4 participants