Skip to content

how to map declarative config properties #14144

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 98 additions & 0 deletions docs/misc/declarative-configuration/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# This file serves as a specification how to map properties from the existing config properties
# to the declarative configuration format.
# This list does not contain all properties, but those that
# are different from what the config bridge already does.

# Also see
# - https://github.com/open-telemetry/opentelemetry-configuration/blob/main/examples/sdk-migration-config.yaml
# - https://github.com/open-telemetry/opentelemetry-configuration/blob/main/examples/sdk-config.yaml

instrumentation/development:
# nothing changes here - just for reference
general:
peer:
service_mapping: # was "otel.instrumentation.common.peer-service-mapping"
- peer: 1.2.3.4
service: FooService
- peer: 2.3.4.5
service: BarService
http:
# should be added to https://github.com/open-telemetry/opentelemetry-configuration/blob/c205770a956713e512eddb056570a99737e3383a/examples/kitchen-sink.yaml#L872
known_methods: # was "otel.instrumentation.http.known-methods"
- GET
- POST
- PUT
- DELETE
- PATCH
- HEAD
- OPTIONS
client:
request_captured_headers: # was otel.instrumentation.http.client.capture-request-headers
- Content-Type
- Accept
response_captured_headers: # was otel.instrumentation.http.client.capture-response-headers
- Content-Type
- Content-Encoding
server:
request_captured_headers: # was otel.instrumentation.http.server.capture-request-headers
- Content-Type
- Accept
response_captured_headers: # was otel.instrumentation.http.server.capture-response-headers
- Content-Type
- Content-Encoding
java:
agent:
# Also map all other properties with the "otel.javaagent." prefix the same way,
# unless specified otherwise.
# See https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/14132
exclude_class_loaders: # was "otel.javaagent.exclude-class-loaders"
- a
- b
common:
default:
enabled: true # was "otel.instrumentation.common.default-enabled"
db_statement_sanitizer:
enabled: true # already exists - just for reference
thread_details:
# disabled by default
Copy link
Contributor

Choose a reason for hiding this comment

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

currently it is enabled by default, it is disabled when running tests

Copy link
Member Author

@zeitlinger zeitlinger Jul 10, 2025

Choose a reason for hiding this comment

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

@trask suggested that is should be off by default: #14144 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought that this is supposed to represent what the agent currently does, feel free to ignore if it has a different purpose.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's supposed to be the spec for declarative configuration.
Mostly what the agent does today - but it's an opportunity to clean things up - that we could otherwise only do with a major version.

# enabled applies to both spans and logs (but not metrics due to high cardinality)
Copy link
Contributor

Choose a reason for hiding this comment

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

this setting does not apply to logs, they use a different flag for the thread attributes

Copy link
Member Author

Choose a reason for hiding this comment

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

then we should probably add this here as thread_details/logging/enabled

Copy link
Member Author

Choose a reason for hiding this comment

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

the current attributes to add thread details to logs are

  • otel.instrumentation.log4j-appender.experimental-log-attributes
  • otel.instrumentation.logback-appender.experimental-log-attributes

I similar argument could be made where we have different settings for adding baggage to log context:

  • otel.instrumentation.logback-mdc.add-baggage
  • otel.instrumentation.log4j-context-data.add-baggage

enabled: true # was "otel.javaagent.add-thread-details" = "true"
Copy link
Member Author

Choose a reason for hiding this comment

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

alternatively: spans: enabled: true

Copy link
Member

Choose a reason for hiding this comment

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

it's a good question

honestly I wonder how useful this instrumentation is, and whether we should disable it by default in 3.0 @laurit?

I guess my preference would be

  • disabled by default
  • enabled applies to both spans and logs (but not metrics due to high cardinality)

Copy link
Member Author

Choose a reason for hiding this comment

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

I guess we could apply this new semantic also to the spring starter where this feature is added without declarative config in #14117

Copy link
Contributor

Choose a reason for hiding this comment

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

The semantic conventions recommend setting these attributes. Comments in open-telemetry/opentelemetry-specification#788 list some potential usages. It is difficult to predict when which attributes could be valuable.

Copy link
Member Author

Choose a reason for hiding this comment

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

@trask agreed to check with sem conv


# These cannot be used in the Java Agent, because they are read in early stages,
# but the Spring starter may use them (need to be discussed).
disabled: false # was: "otel.sdk.enabled"
log_level: info # is not used is Spring starter yet

# Note: The following properties still have to be specified with system properties or
# environment variables, because they are read in early stages of the application startup:
# User facing:
# - otel.javaagent.enabled
# - otel.javaagent.debug
# - otel.javaagent.extensions
# - otel.javaagent.logging
# - otel.javaagent.logging.application.logs-buffer-max-records
# - otel.javaagent.configuration-file (although you shouldn't need this with declarative configuration)
# - otel.javaagent.experimental.field-injection.enabled
# - otel.javaagent.experimental.security-manager-support.enabled
# Internal:
# - otel.javaagent.experimental.thread-propagation-debugger.enabled
# - otel.javaagent.testing.fail-on-context-leak

# These properties could be read from declarative configuration in the future, but are not yet.
# Issue: https://github.com/open-telemetry/opentelemetry-java-instrumentation/issues/14192
# - otel.experimental.javascript-snippet
# - otel.instrumentation.aws-sdk.experimental-record-individual-http-error
# - otel.instrumentation.aws-sdk.experimental-span-attributes
# - otel.instrumentation.aws-sdk.experimental-use-propagator-for-messaging
# - otel.instrumentation.common.db-statement-sanitizer.enabled
# - otel.instrumentation.common.logging.span-id
# - otel.instrumentation.common.logging.trace-flags
# - otel.instrumentation.common.logging.trace-id
# - otel.instrumentation.experimental.span-suppression-strategy
# - otel.instrumentation.genai.capture-message-content
# - otel.instrumentation.jdbc.experimental.capture-query-parameters
# - otel.instrumentation.jdbc.experimental.transaction.enabled
# - otel.instrumentation.log4j-context-data.add-baggage
# - otel.instrumentation.messaging.experimental.capture-headers
# - otel.instrumentation.messaging.experimental.receive-telemetry.enabled
# - otel.semconv-stability.opt-in
Loading