Diagnostic logs for loaded assemblies and remove dotnet process startup hook file noise#2774
Merged
Conversation
🤖 GitHub commentsJust comment with:
|
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request reduces startup hook logging noise by skipping agent initialization for dotnet CLI host processes, and adds debug-level diagnostics that log assemblies as they load to help troubleshoot complex dependency/versioning scenarios.
Changes:
- Early-exit from startup hook initialization when the entry assembly is
dotnetto avoid instrumentingdotnet run/build/watchhost processes. - Add an
AppDomain.AssemblyLoadsubscriber to log loaded assemblies (including version/token/location) at debug level, plus an initial scan of already-loaded assemblies. - Ensure the configured log directory exists when file logging is enabled (best-effort).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/startuphook/ElasticApmAgentStartupHook/StartupHook.cs | Skips startup hook initialization for dotnet CLI host processes to prevent extra log files/overhead. |
| src/startuphook/Elastic.Apm.StartupHook.Loader/Loader.cs | Hooks in the new assembly-load diagnostic logging during loader initialization. |
| src/startuphook/Elastic.Apm.StartupHook.Loader/AssemblyLoadLogger.cs | New utility that logs assemblies as they load (debug-only, de-duped). |
| src/Elastic.Apm/Logging/GlobalLogConfiguration.cs | Best-effort creation of the log directory when file logging is enabled. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
78e8d6d to
df6b2bf
Compare
df6b2bf to
4aca1d6
Compare
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jackshirazi
previously approved these changes
Jun 26, 2026
jackshirazi
approved these changes
Jun 26, 2026
This was referenced Jul 1, 2026
This file contains hidden or 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
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.
Skips startup hook logging for "dotnet" processes which occurs due to the startup hook mechanism and causes extra log files to be generated, adding noise and overhead.
When an application is run voa the dotnet CLI and startup hook env vars are set for the current sessions or system wide, it results in the
dotnetprocess itself being instrumented, causing two log files. At termination,dotnet stopalso runs causing two additional log files. These are noise and the instrumentation adds overhead. This change skips instrumentation of alldotnetprocesses to avoid these problems.This change also ports (and improves) an EDOT .NET logging enhancement to track loaded assemblies which may be diagnosticly helpful for complex scenarios.