-
Notifications
You must be signed in to change notification settings - Fork 4
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
Move closer to OpenTelemetry logging configuration #129
Merged
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
This replaces `ELASTIC_OTEL_LOG_DIRECTORY` and `ELASTIC_OTEL_LOG_LEVEL` with `OTEL_DOTNET_AUTO_LOG_DIRECTORY` and `OTEL_LOG_LEVEL`. - `OTEL_DOTNET_AUTO_LOG_DIRECTORY` enables global file logging both in auto instrumentation and manual instrumentation. - `LogLevel.Trace` does not exist in OTEL, we fallback to `Debug` OTEL fallsback to `Information`. - We treat `LogLevel.Debug` as a switch to enable global logging. - If we are running in a container and global logging is enabled we now default to standardout and not file unless configured explicitly
stevejgordon
previously approved these changes
Jul 16, 2024
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.
Changes LGTM. A couple of tests to address.
…t its mere presence
stevejgordon
approved these changes
Jul 16, 2024
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
Mpdreamz
added a commit
to elastic/apm-agent-dotnet
that referenced
this pull request
Jul 23, 2024
This ensures we can specify file logging globally and uniformly. Greatly simplifying the debug-ability of the agent. The preferred way is to set any or all of the following: * `ELASTIC_OTEL_LOG_TARGETS` (to anything but `none`) * if only set to `stdout` no file will be created but global logging will kicking ) * `OTEL_DOTNET_AUTO_LOG_DIRECTORY` * `OTEL_LOG_LEVEL` * `trace` `debug` will enable global file logging if the other two variables are not set explicitly. This ensure we have one way to debug both our proprietary agent as well as the [Elastic OpenTelemetry Distribution](https://github.com/elastic/elastic-otel-dotnet). See: elastic/elastic-otel-dotnet#129 For backwards compatible reasons the profiler variables are also supported: * `ELASTIC_APM_PROFILER_LOG` * `ELASTIC_APM_PROFILER_LOG_DIR` * `ELASTIC_APM_PROFILER_LOG_TARGETS` Globally setting * `ELASTIC_APM_LOG_LEVEL` and `ELASTIC_APM_LOG_DIRECTORY` is also supported but not preferred. Setting these in any of our supported deploy scenarios: * Manual instrumentation (nuget) * ASP.NET (classic) * ASP.NET core * NOTE: we now log to both the configured ILogger and our global logging. * Auto Instrumentation * Profiler * Startup hooks To keep support existing deploys this now always globally logs to file if only `ELASTIC_APM_STARTUP_HOOKS_LOGGING` is set as well. This further updates our docs for the profiler and troubleshooting to prefer `ELASTIC_OTEL_*` variables. The profiler is updated to read the same environment variables as managed code.
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.
This replaces
ELASTIC_OTEL_LOG_DIRECTORY
andELASTIC_OTEL_LOG_LEVEL
withOTEL_DOTNET_AUTO_LOG_DIRECTORY
andOTEL_LOG_LEVEL
.OTEL_DOTNET_AUTO_LOG_DIRECTORY
enables global file logging both in auto instrumentation and manual instrumentation.LogLevel.Trace
does not exist in OTEL, we fallback toDebug
OTEL fallsback toInformation
.LogLevel.Debug
as a switch to enable global logging.