Skip to content

Conversation

@zeitlinger
Copy link
Member

@zeitlinger zeitlinger commented Nov 17, 2025

to bridge system properties / env vars to declarative config

Fixes #14192

Alternative implementation for #14767

Breaking Changes

Rename otel.experimental.javascript-snippet to
otel.instrumentation.servlet.experimental.javascript-snippet to follow naming conventions

Overview

declarative config bridge system properties bridge
API input "otel.instrumentation.jdbc.experimental.capture-query-parameters" "jdbc", "capture_query_parameters/development"
system properties access direct "otel.instrumentation.jdbc.experimental.capture-query-parameters" (NO customizers possible)
declarative config access "jdbc", "experimental" "capture_query_parameters" (NO "/development" - but added in #15606) direct
translation in DeclarativeConfigPropertiesBridge ConfigPropertiesUtil (this PR)
user facing API InstrumentationConfig ConfigPropertiesUtil (this PR)
example from agent AgentInstrumentationConfig.get().getString(TRACE_METHODS_CONFIG) ConfigPropertiesUtil.getString(GlobalOpenTelemetry.get(), "servlet", "javascript-snippet/development")
example from library config.getBoolean("otel.instrumentation.common.default-enabled", true) 1 ConfigPropertiesUtil.getBoolean(openTelemetry, "jdbc", "capture_query_parameters/development")

Footnotes

  1. InstrumentationConfig is implemented for agent and spring starter, but there is public API
    that takes InstrumentationConfig as input in library code,
    e.g. DefaultHttpServerInstrumenterBuilder (
    incubating, internal).

@zeitlinger zeitlinger self-assigned this Nov 17, 2025
@zeitlinger zeitlinger requested a review from a team as a code owner November 17, 2025 17:09
@github-actions github-actions bot added the test native This label can be applied to PRs to trigger them to run native tests label Nov 17, 2025
@zeitlinger
Copy link
Member Author

@trask I really like this new bridge based on your idea 😄

@zeitlinger zeitlinger moved this to Awaiting Review in Declarative Configuration: Java Nov 17, 2025
@zeitlinger zeitlinger changed the title Add system properties bridge Add system properties bridge, part 1 Nov 17, 2025
@zeitlinger zeitlinger force-pushed the system-properties-bridge branch from 3a9e285 to 9ae95f1 Compare November 18, 2025 09:54
@zeitlinger zeitlinger changed the title Add system properties bridge, part 1 Add system properties bridge Nov 18, 2025
Comment on lines 142 to 126
/** Returns true if the given OpenTelemetry instance supports Declarative Config. */
public static boolean isDeclarativeConfig(OpenTelemetry openTelemetry) {
return isIncubator && openTelemetry instanceof ExtendedOpenTelemetry;
}

Copy link
Member

Choose a reason for hiding this comment

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

is isIncubator needed, since instrumentation-api (unfortunately) already depends on the api-incubator?

Copy link
Member Author

Choose a reason for hiding this comment

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

only for the test (see last comment)

@zeitlinger zeitlinger force-pushed the system-properties-bridge branch from 0138d4f to 16e62ea Compare November 25, 2025 08:15
@zeitlinger
Copy link
Member Author

I have no idea what could have caused this failure:

11:31:59.660 [Test worker] INFO  t.g.i.19421579350 - Pulling docker image: ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:20251117.19421579350. Please be patient; this may take some time but only needs to be done once.
11:32:00.526 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Starting to pull image
11:32:00.527 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Pulling image layers:  0 pending,  0 downloaded,  0 extracted, (0 bytes/0 bytes)
11:32:00.983 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Pulling image layers:  1 pending,  1 downloaded,  0 extracted, (13 MB/? MB)
11:32:01.834 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Pulling image layers:  1 pending,  1 downloaded,  1 extracted, (129 MB/? MB)
11:32:01.972 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Pulling image layers:  0 pending,  2 downloaded,  1 extracted, (143 MB/148 MB)
11:32:03.747 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Pulling image layers:  0 pending,  2 downloaded,  2 extracted, (148 MB/148 MB)
11:32:03.751 [Test worker] INFO  t.g.i.19421579350 - Image ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:20251117.19421579350 pull took PT4.090551S
11:32:03.751 [docker-java-stream--1576344563] INFO  t.g.i.19421579350 - Pull complete. 2 layers, pulled in 3s (downloaded 148 MB at 49 MB/s)
11:32:03.753 [Test worker] INFO  t.g.i.19421579350 - Creating container for image: ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:20251117.19421579350
11:32:04.376 [Test worker] INFO  t.g.i.19421579350 - Container ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:20251117.19421579350 is starting: d09147ceccc4abd46f5c923ad2025cb51e2f7d27659e9b20370bf9c4d5e45420
11:32:04.459 [docker-java-stream-822006274] INFO  i.o.smoketest.CrashEarlyJdk8Test - STDOUT: started
11:32:04.467 [Test worker] INFO  t.g.i.19421579350 - Container ghcr.io/open-telemetry/opentelemetry-java-instrumentation/smoke-test-zulu-openjdk-8u31:20251117.19421579350 started in PT0.713852S
Container.ExecResult(exitCode=134, stdout=compiling
finish compiling
executing
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x000000076e60fe08, pid=31, tid=140468591523520
#
# JRE version: OpenJDK Runtime Environment (8.0_31-b13) (build 1.8.0_31-b13)
# Java VM: OpenJDK 64-Bit Server VM (25.31-b07 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  0x000000076e60fe08
#
# Core dump written. Default location: //core or core.31
#
# An error report file with more information is saved as:
# //hs_err_pid31.log
Compiled method (c1)     807 1777       3       java.util.stream.AbstractPipeline::wrapSink (37 bytes)
 total in heap  [0x00007fc150965350,0x00007fc150965a78] = 1832
 relocation     [0x00007fc150965478,0x00007fc1509654e0] = 104
 main code      [0x00007fc1509654e0,0x00007fc150965840] = 864
 stub code      [0x00007fc150965840,0x00007fc1509658f8] = 184
 metadata       [0x00007fc1509658f8,0x00007fc150965908] = 16
 scopes data    [0x00007fc150965908,0x00007fc1509659a8] = 160
 scopes pcs     [0x00007fc1509659a8,0x00007fc150965a58] = 176
 dependencies   [0x00007fc150965a58,0x00007fc150965a60] = 8
 nul chk table  [0x00007fc150965a60,0x00007fc150965a78] = 24
Compiled method (c1)     807 1782       3       java.util.stream.StreamSpliterators$WrappingSpliterator$$Lambda$254/1777443462::get$Lambda (9 bytes)
 total in heap  [0x00007fc15096f350,0x00007fc15096f7e8] = 1176
 relocation     [0x00007fc15096f478,0x00007fc15096f4b8] = 64
 main code      [0x00007fc15096f4c0,0x00007fc15096f680] = 448
 stub code      [0x00007fc15096f680,0x00007fc15096f710] = 144
 oops           [0x00007fc15096f710,0x00007fc15096f718] = 8
 metadata       [0x00007fc15096f718,0x00007fc15096f730] = 24
 scopes data    [0x00007fc15096f730,0x00007fc15096f780] = 80
 scopes pcs     [0x00007fc15096f780,0x00007fc15096f7e0] = 96
 dependencies   [0x00007fc15096f7e0,0x00007fc15096f7e8] = 8
#
# If you would like to submit a bug report, please visit:
#   http://www.azulsystems.com/support/
#
, stderr=[otel.javaagent 2025-11-25 11:32:05:162 +0000] [main] INFO io.opentelemetry.javaagent.tooling.VersionLogger - opentelemetry-javaagent - version: 2.23.0-SNAPSHOT
/test.sh: line 7:    31 Aborted                 (core dumped) java -javaagent:opentelemetry-javaagent.jar CrashEarlyJdk8
)

@laurit
Copy link
Contributor

laurit commented Nov 25, 2025

I have no idea what could have caused this failure:

CrashEarlyJdk8 fails when you use lambdas too early in the agent initalization.

@zeitlinger
Copy link
Member Author

I have no idea what could have caused this failure:

CrashEarlyJdk8 fails when you use lambdas too early in the agent initalization.

thank you!

@zeitlinger
Copy link
Member Author

@trask please check again

@zeitlinger
Copy link
Member Author

@trask I've split the PR - please have another look

@zeitlinger zeitlinger force-pushed the system-properties-bridge branch 2 times, most recently from 2df0753 to 6c889a7 Compare December 4, 2025 16:54
@zeitlinger
Copy link
Member Author

@trask please check again

@zeitlinger zeitlinger added this to the v2.23.0 milestone Dec 5, 2025
Copy link
Member

@trask trask left a comment

Choose a reason for hiding this comment

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

nice

@github-actions
Copy link
Contributor

github-actions bot commented Dec 8, 2025

⚠️ Breaking Change Documentation Required

This PR has been labeled as a breaking change. Please ensure you provide the following information:

Migration Notes Required

Please add detailed migration notes to help users understand:

  • What is changing and why
  • How to update their code/configuration
  • Any alternative approaches if applicable
  • Code examples showing before/after usage

Checklist

  • Migration notes added to the PR description
  • Breaking change is documented in the "Unreleased" section of the Changelog, preferably as part of this PR.
  • Consider if this change requires a major version bump

Your migration notes will be included in the release notes to help users upgrade smoothly. The more detailed and helpful they are, the better the user experience will be.


This comment was automatically generated because the breaking change label was applied to this PR.

@zeitlinger
Copy link
Member Author

closed in favor of #15656

@zeitlinger zeitlinger closed this Dec 16, 2025
@github-project-automation github-project-automation bot moved this from Awaiting Review to Done in Declarative Configuration: Java Dec 16, 2025
@zeitlinger zeitlinger deleted the system-properties-bridge branch December 16, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change test native This label can be applied to PRs to trigger them to run native tests

Projects

Development

Successfully merging this pull request may close these issues.

use InstrumentationConfig where possible

3 participants