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

fix: Set Profiler logger to initialized when configuration load fails #3015

Merged
merged 17 commits into from
Mar 6, 2025

Conversation

tippmar-nr
Copy link
Member

@tippmar-nr tippmar-nr commented Mar 3, 2025

BEGIN_COMMIT_OVERRIDE
fix: Set Profiler logger to initialized when configuration load fails. (#3015)
END_COMMIT_OVERRIDE

The profiler log file wasn't being set as "initialized" until after the configuration was successfully loaded. This prevented errors that occurred during configuration load from being written to the log file, with the symptom being a profiler log with no content.

This fix sets the logger to "initialized" just before the second attempt to load the configuration, ensuring that the exception thrown during that attempt gets logged.

Sample output:

[Error] 2025-03-03 21:50:58 The global newrelic.config file was not found at: C:\source\repos\newrelic-dotnet-agent\src\Agent\newrelichome_x64_coreclr
[Error] 2025-03-03 21:51:12 An exception was thrown while initializing the profiler. The profiler will be detached now.

Fixes #3014

@tippmar-nr tippmar-nr requested a review from a team as a code owner March 3, 2025 22:02
tippmar-nr and others added 4 commits March 3, 2025 16:02
chore: Update Profiler NuGet Package Reference to v10.37.0.12.

Co-authored-by: tippmar-nr <120425148+tippmar-nr@users.noreply.github.com>
@tippmar-nr tippmar-nr enabled auto-merge (squash) March 3, 2025 22:16
Copy link
Member

@nrcventura nrcventura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥇

nr-ahemsath
nr-ahemsath previously approved these changes Mar 3, 2025
Copy link
Member

@nr-ahemsath nr-ahemsath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

jaffinito
jaffinito previously approved these changes Mar 3, 2025
Copy link
Member

@nrcventura nrcventura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See the comment about the logger not getting initialized if console logging is enabled.

@tippmar-nr tippmar-nr dismissed stale reviews from jaffinito and nr-ahemsath via 21aff53 March 5, 2025 19:55
@tippmar-nr tippmar-nr requested a review from nrcventura March 5, 2025 19:55
dotnet-agent-team-bot and others added 2 commits March 5, 2025 14:10
chore: Update Profiler NuGet Package Reference to v10.37.0.14.

Co-authored-by: tippmar-nr <120425148+tippmar-nr@users.noreply.github.com>
@tippmar-nr tippmar-nr changed the title fix: The Profiler logger should be marked as "initialized" as soon as the file is created. fix: Set Profiler logger to initialized when configuration load fails Mar 6, 2025
chore: Update Profiler NuGet Package Reference to v10.37.0.16.

Co-authored-by: tippmar-nr <120425148+tippmar-nr@users.noreply.github.com>
nrcventura
nrcventura previously approved these changes Mar 6, 2025
chore: Update Profiler NuGet Package Reference to v10.37.0.19.

Co-authored-by: tippmar-nr <120425148+tippmar-nr@users.noreply.github.com>
nrcventura
nrcventura previously approved these changes Mar 6, 2025
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.11%. Comparing base (663ca40) to head (0ff7a9d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3015   +/-   ##
=======================================
  Coverage   82.11%   82.11%           
=======================================
  Files         476      476           
  Lines       30536    30536           
  Branches     3416     3416           
=======================================
  Hits        25075    25075           
  Misses       4661     4661           
  Partials      800      800           
Flag Coverage Δ
Agent 83.17% <ø> (ø)
Profiler 72.40% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tippmar-nr tippmar-nr merged commit 7ab30d7 into main Mar 6, 2025
96 checks passed
@tippmar-nr tippmar-nr deleted the fix/empty-profiler-log-file branch March 6, 2025 18:28
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.

Profiler creates empty log file when global newrelic.config is not found
6 participants