-
Notifications
You must be signed in to change notification settings - Fork 870
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
Allow configuring MDC key names for trace_id, span_id, trace_flags #11329
Conversation
continue in this pr @pavelvodrazka |
javaagent-tooling/src/main/java/io/opentelemetry/javaagent/tooling/AgentInstaller.java
Outdated
Show resolved
Hide resolved
...tion/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/build.gradle.kts
Outdated
Show resolved
Hide resolved
instrumentation/logback/logback-mdc-1.0/library/build.gradle.kts
Outdated
Show resolved
Hide resolved
...y/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java
Outdated
Show resolved
Hide resolved
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.
could you also add tests
...y/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java
Outdated
Show resolved
Hide resolved
.../opentelemetry/instrumentation/log4j/contextdata/v2_17/OpenTelemetryContextDataProvider.java
Outdated
Show resolved
Hide resolved
...y/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java
Outdated
Show resolved
Hide resolved
...y/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java
Outdated
Show resolved
Hide resolved
...-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java
Outdated
Show resolved
Hide resolved
.../opentelemetry/instrumentation/log4j/contextdata/v2_17/OpenTelemetryContextDataProvider.java
Outdated
Show resolved
Hide resolved
...mon/testing/src/main/java/io/opentelemetry/instrumentation/log4j/contextdata/Log4j2Test.java
Show resolved
Hide resolved
instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/javaagent/README.md
Outdated
Show resolved
Hide resolved
...y/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java
Outdated
Show resolved
Hide resolved
...-extension-api/src/main/java/io/opentelemetry/javaagent/bootstrap/internal/CommonConfig.java
Outdated
Show resolved
Hide resolved
instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/javaagent/build.gradle.kts
Outdated
Show resolved
Hide resolved
...y/src/main/java/io/opentelemetry/instrumentation/logback/mdc/v1_0/OpenTelemetryAppender.java
Outdated
Show resolved
Hide resolved
sources { | ||
java { | ||
setSrcDirs(listOf("src/test/java")) | ||
} | ||
} |
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.
You shouldn't have removed this. The intent here is that this test suite uses the same test sources as the main test. If you remove it then it will use src/testDisableThreadLocals/java
as test sources, as that directory does not exist it won't run any tests.
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.
Thank you for your answer
I think this is almost done. Only https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/log4j/log4j-context-data/log4j-context-data-2.17/library-autoconfigure/README.md and https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/instrumentation/logback/logback-mdc-1.0/library/README.md (seems to be missing the |
Why |
If the `otel.instrumentation.logback-mdc.add-baggage` system property (or the | ||
`OTEL_INSTRUMENTATION_LOGBACK_MDC_ADD_BAGGAGE` environment variable) is set to `true`, | ||
key/value pairs in [baggage](https://opentelemetry.io/docs/concepts/signals/baggage/) will be added to the context too. | ||
|
||
- `baggage.<entry_name>` | ||
|
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.
in library instrumentation logback appender is configured via logback.xml not system properties or environment variables, see
Line 23 in b8c28df
<addBaggage>true</addBaggage> |
|
||
If you want to customize the names of these keys, you can set system property or environment variable: | ||
|
||
| System property | Environment variable | | ||
|-------------------------------------------------------|---------------------------------------------------| | ||
| `otel.instrumentation.common.logging.trace-id` | `OTEL_INSTRUMENTATION_COMMON_LOGGING_TRACE_ID` | | ||
| `otel.instrumentation.common.logging.span-id` | `OTEL_INSTRUMENTATION_COMMON_LOGGING_SPAN_ID` | | ||
| `otel.instrumentation.common.logging.trace-flags` | `OTEL_INSTRUMENTATION_COMMON_LOGGING_TRACE_FLAGS` | |
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.
these are also configured in logback.xml
@@ -42,6 +42,14 @@ will be added to the context when a log statement is made when a span is active: | |||
- `span_id` | |||
- `trace_flags` | |||
|
|||
If you want to customize the names of these keys, you can set system property or environment variable: |
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.
If you want to customize the names of these keys, you can set system property or environment variable: | |
These keys can be customized using the following system properties or environment variables: |
Hi, is this request planned to be merged / included in the next release? |
…pen-telemetry#11329) Co-authored-by: Lauri Tulmin <ltulmin@splunk.com>
resolve issue
continue with PR