Skip to content

Upgrade OpenTelemetry to 1.58.0 / 2.24.0#4606

Draft
Copilot wants to merge 15 commits intomainfrom
copilot/update-opentelemetry-versions
Draft

Upgrade OpenTelemetry to 1.58.0 / 2.24.0#4606
Copilot wants to merge 15 commits intomainfrom
copilot/update-opentelemetry-versions

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Upgrades OpenTelemetry SDK from 1.55.0 → 1.58.0 and Instrumentation from 2.21.0 → 2.24.0. The upgrade introduced breaking internal APIs and a new io.opentelemetry.common package causing classloader conflicts.

Classloader conflict

io.opentelemetry.common.ComponentLoader appears in both upstream javaagent (pre-shaded) and our transitive dependencies, creating loader constraint violations across bootstrap and agent classloaders.

Fix: Exclude from our javaagent libs + prevent double-relocation of upstream's already-shaded classes:

// agent/agent/build.gradle.kts
dependencies {
  exclude(dependency("io.opentelemetry:opentelemetry-common"))
}

// buildSrc/.../ai.shadow-conventions.gradle.kts  
relocate("io.opentelemetry.api", "io.opentelemetry.javaagent.shaded.io.opentelemetry.api") {
  exclude("io.opentelemetry.javaagent.shaded.io.opentelemetry.api.*")
}

API migrations

  • AgentInstrumentationConfig removed - Instrumentation modules now load before SDK autoconfiguration. Migrated to system property access with AiConfigCustomizer setting via System.setProperty() for early access.

  • LoggingCustomizer.init(EarlyInitAgentConfig)init()

  • GlobalOpenTelemetry.getPropagators() - Unreliable in 2.24.0 instrumentation contexts. Azure Functions now uses W3CTraceContextPropagator.getInstance() directly.

Initialization timing

Browser SDK snippet initialization triggered GlobalOpenTelemetry.get() during autoconfiguration, before set() was called. Moved from SecondEntryPoint.customize() to AfterAgentListener.afterAgent().

SDK internal metrics

2.24.0 exports new SDK telemetry (otel.sdk.span.live, otel.sdk.span.started, otel.sdk.log.created). Added views to drop these internal metrics:

private static final String[] SDK_INTERNAL_METRICS_TO_DROP = {
  "otel.sdk.span.live",
  "otel.sdk.span.started", 
  "otel.sdk.log.created"
};

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • checkstyle.org
    • Triggering command: /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/tools/linux64/java/bin/java -jar /opt/hostedtoolcache/CodeQL/2.24.0/x64/codeql/xml/tools/xml-extractor.jar --fileList=/home/REDACTED/work/ApplicationInsights-Java/.codeql-scratch/dbs/java/working/files-to-index1302151850725525431.list --sourceArchiveDir=/home/REDACTED/work/ApplicationInsights-Java/.codeql-scratch/dbs/java/src --outputDir=/home/REDACTED/work/ApplicationInsights-Java/.codeql-scratch/dbs/java/trap/java -j MASQUERADE cf7b13a00fb2cb59/usr/sbin/iptables (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

val otelSdkVersion = "1.58.0"
val otelInstrumentationAlphaVersion = "2.24.0-alpha"
val otelInstrumentationVersion = "2.24.0"


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 28, 2026 19:58
…rors)

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title [WIP] Update OpenTelemetry SDK and instrumentation versions Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Jan 28, 2026
Copilot AI requested a review from xiang17 January 28, 2026 20:19
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Add system property fallback to DeclarativeConfigUtil config access Jan 28, 2026
Copilot AI and others added 2 commits February 4, 2026 23:27
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
After OpenTelemetry upgrade to 2.24.0, GlobalOpenTelemetry.getPropagators()
doesn't work correctly in test environments. Changed to use
W3CTraceContextPropagator.getInstance() directly for context extraction.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Add system property fallback to DeclarativeConfigUtil config access Fix Azure Functions context propagation after OpenTelemetry 2.24.0 upgrade Feb 4, 2026
Copilot AI and others added 2 commits February 5, 2026 00:31
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
The upstream OpenTelemetry javaagent already includes io.opentelemetry.common
classes (properly shaded). Our build was including the same classes, causing
classloader conflicts. Added exclusion to prevent double inclusion.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Fix Azure Functions context propagation after OpenTelemetry 2.24.0 upgrade Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Feb 5, 2026
AiConfigCustomizer properties need to be accessible by instrumentation modules
that load early. Setting them as system properties ensures they're available
through the System.getProperty() fallback mechanism.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI and others added 2 commits February 5, 2026 23:23
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI and others added 2 commits February 6, 2026 23:42
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants