From 2eefb49e1d9b91b266ac5066c3bed5ed462dc983 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 02:05:02 +0000 Subject: [PATCH 1/7] Initial plan From bc7a646b2aaa3a46e954c812b343700d711cec2a Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 02:11:54 +0000 Subject: [PATCH 2/7] Initial plan Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com> --- gradlew.bat | 186 ++++++++++++++++++++--------------------- perf-tests/gradlew.bat | 186 ++++++++++++++++++++--------------------- 2 files changed, 186 insertions(+), 186 deletions(-) diff --git a/gradlew.bat b/gradlew.bat index e509b2dd8f..c4bdd3ab8e 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -1,93 +1,93 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/perf-tests/gradlew.bat b/perf-tests/gradlew.bat index e509b2dd8f..c4bdd3ab8e 100755 --- a/perf-tests/gradlew.bat +++ b/perf-tests/gradlew.bat @@ -1,93 +1,93 @@ -@rem -@rem Copyright 2015 the original author or authors. -@rem -@rem Licensed under the Apache License, Version 2.0 (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://www.apache.org/licenses/LICENSE-2.0 -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. -@rem -@rem SPDX-License-Identifier: Apache-2.0 -@rem - -@if "%DEBUG%"=="" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%"=="" set DIRNAME=. -@rem This is normally unused -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Resolve any "." and ".." in APP_HOME to make it shorter. -for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version >NUL 2>&1 -if %ERRORLEVEL% equ 0 goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto execute - -echo. 1>&2 -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 -echo. 1>&2 -echo Please set the JAVA_HOME variable in your environment to match the 1>&2 -echo location of your Java installation. 1>&2 - -goto fail - -:execute -@rem Setup the command line - - - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* - -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem +@rem SPDX-License-Identifier: Apache-2.0 +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega From 543a1d12d19bfede6a3cb6d46263b353e2216b1b Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 02:24:55 +0000 Subject: [PATCH 3/7] Upgrade OTel versions and fix build failures Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com> --- .../agent/internal/init/AiConfigCustomizer.java | 8 ++++++++ .../agent/internal/init/FirstEntryPoint.java | 3 +-- agent/agent/build.gradle.kts | 1 + .../InvocationRequestExtractAdapter.java | 3 ++- .../methods/ai/MethodInstrumentationModule.java | 3 +-- .../micrometer/ai/AzureMonitorRegistryConfig.java | 13 ++++++------- dependencyManagement/build.gradle.kts | 8 ++++---- 7 files changed, 23 insertions(+), 16 deletions(-) diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java index 5d17bb98b6..e8e3c01664 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java @@ -25,6 +25,10 @@ public Map apply(ConfigProperties otelConfig) { properties.put( "applicationinsights.internal.micrometer.step.millis", Long.toString(SECONDS.toMillis(configuration.metricIntervalSeconds))); + // also set as system property so that instrumentation modules can read it + System.setProperty( + "applicationinsights.internal.micrometer.step.millis", + Long.toString(SECONDS.toMillis(configuration.metricIntervalSeconds))); properties.put( "otel.metric.export.interval", @@ -102,6 +106,8 @@ public Map apply(ConfigProperties otelConfig) { sb.append(']'); } properties.put("applicationinsights.internal.methods.include", sb.toString()); + // also set as system property so that instrumentation modules can read it + System.setProperty("applicationinsights.internal.methods.include", sb.toString()); } properties.put("otel.propagators", DelegatingPropagatorProvider.NAME); @@ -223,6 +229,8 @@ private static void enableInstrumentations( String namespace = config.instrumentation.micrometer.namespace; if (namespace != null) { properties.put("applicationinsights.internal.micrometer.namespace", namespace); + // also set as system property so that instrumentation modules can read it + System.setProperty("applicationinsights.internal.micrometer.namespace", namespace); } if (config.instrumentation.azureSdk.enabled) { properties.put("otel.instrumentation.azure-core.enabled", "true"); diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/FirstEntryPoint.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/FirstEntryPoint.java index 39cbfa39bd..8e0b4b12a2 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/FirstEntryPoint.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/FirstEntryPoint.java @@ -23,7 +23,6 @@ import io.opentelemetry.javaagent.bootstrap.InternalLogger; import io.opentelemetry.javaagent.bootstrap.JavaagentFileHolder; import io.opentelemetry.javaagent.tooling.LoggingCustomizer; -import io.opentelemetry.javaagent.tooling.config.EarlyInitAgentConfig; import java.io.File; import java.io.FileOutputStream; import java.io.OutputStreamWriter; @@ -77,7 +76,7 @@ public String name() { } @Override - public void init(EarlyInitAgentConfig earlyConfig) { + public void init() { try { if (DEBUG_SIGNED_JAR_ACCESS) { JarVerifierClassFileTransformer transformer = new JarVerifierClassFileTransformer(); diff --git a/agent/agent/build.gradle.kts b/agent/agent/build.gradle.kts index a8f6051973..752f970b21 100644 --- a/agent/agent/build.gradle.kts +++ b/agent/agent/build.gradle.kts @@ -84,6 +84,7 @@ tasks { exclude(dependency("io.opentelemetry:opentelemetry-api")) exclude(dependency("io.opentelemetry:opentelemetry-context")) exclude(dependency("io.opentelemetry:opentelemetry-api-incubator")) + exclude(dependency("io.opentelemetry:opentelemetry-common")) } } diff --git a/agent/instrumentation/azure-functions/src/main/java/io/opentelemetry/javaagent/instrumentation/azurefunctions/InvocationRequestExtractAdapter.java b/agent/instrumentation/azure-functions/src/main/java/io/opentelemetry/javaagent/instrumentation/azurefunctions/InvocationRequestExtractAdapter.java index 73c77fe48c..93860a40f3 100644 --- a/agent/instrumentation/azure-functions/src/main/java/io/opentelemetry/javaagent/instrumentation/azurefunctions/InvocationRequestExtractAdapter.java +++ b/agent/instrumentation/azure-functions/src/main/java/io/opentelemetry/javaagent/instrumentation/azurefunctions/InvocationRequestExtractAdapter.java @@ -5,6 +5,7 @@ import com.microsoft.azure.functions.rpc.messages.RpcTraceContext; import io.opentelemetry.context.propagation.TextMapGetter; +import java.util.Arrays; import javax.annotation.Nullable; public class InvocationRequestExtractAdapter implements TextMapGetter { @@ -14,7 +15,7 @@ public class InvocationRequestExtractAdapter implements TextMapGetter keys(RpcTraceContext carrier) { - return null; + return Arrays.asList("traceparent", "tracestate"); } @Override diff --git a/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java b/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java index 036a1f33b0..7399ca6f74 100644 --- a/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java +++ b/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java @@ -13,7 +13,6 @@ import static java.util.Collections.emptyList; import com.google.auto.service.AutoService; -import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser; @@ -34,7 +33,7 @@ public MethodInstrumentationModule() { Map> classMethodsToTrace = MethodsConfigurationParser.parse( - AgentInstrumentationConfig.get().getString(TRACE_METHODS_CONFIG)); + System.getProperty(TRACE_METHODS_CONFIG)); typeInstrumentations = classMethodsToTrace.entrySet().stream() diff --git a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java index b3865ecd99..aa79ac4ae6 100644 --- a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java +++ b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java @@ -4,7 +4,6 @@ package io.opentelemetry.javaagent.instrumentation.micrometer.ai; import io.micrometer.core.instrument.step.StepRegistryConfig; -import io.opentelemetry.javaagent.bootstrap.internal.AgentInstrumentationConfig; import java.time.Duration; import javax.annotation.Nullable; @@ -16,13 +15,13 @@ public class AzureMonitorRegistryConfig implements StepRegistryConfig { public static final AzureMonitorRegistryConfig INSTANCE = new AzureMonitorRegistryConfig(); private AzureMonitorRegistryConfig() { + String stepMillisStr = + System.getProperty("applicationinsights.internal.micrometer.step.millis"); step = - AgentInstrumentationConfig.get() - .getDuration( - "applicationinsights.internal.micrometer.step.millis", Duration.ofSeconds(60)); - namespace = - AgentInstrumentationConfig.get() - .getString("applicationinsights.internal.micrometer.namespace"); + stepMillisStr != null + ? Duration.ofMillis(Long.parseLong(stepMillisStr)) + : Duration.ofSeconds(60); + namespace = System.getProperty("applicationinsights.internal.micrometer.namespace"); } @Override diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index 0f45fd69fc..fbf17c44ee 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -7,10 +7,10 @@ data class DependencySet(val group: String, val version: String, val modules: Li val dependencyVersions = hashMapOf() rootProject.extra["versions"] = dependencyVersions -val otelSdkVersion = "1.55.0" -val otelInstrumentationAlphaVersion = "2.21.0-alpha" -val otelInstrumentationVersion = "2.21.0" -val otelContribVersion = "1.48.0" +val otelSdkVersion = "1.58.0" +val otelInstrumentationAlphaVersion = "2.24.0-alpha" +val otelInstrumentationVersion = "2.24.0" +val otelContribVersion = "1.52.0" rootProject.extra["otelInstrumentationVersion"] = otelInstrumentationVersion rootProject.extra["otelInstrumentationAlphaVersion"] = otelInstrumentationAlphaVersion From f464f89cf39e6c6d75239768ec6dd77834dc5708 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 02:29:28 +0000 Subject: [PATCH 4/7] Address code review feedback: improve error handling and reduce duplication Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com> --- .../agent/internal/init/AiConfigCustomizer.java | 9 +++------ .../micrometer/ai/AzureMonitorRegistryConfig.java | 13 +++++++++---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java index e8e3c01664..e0b44d7aa4 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/AiConfigCustomizer.java @@ -22,13 +22,10 @@ public Map apply(ConfigProperties otelConfig) { Map properties = new HashMap<>(); - properties.put( - "applicationinsights.internal.micrometer.step.millis", - Long.toString(SECONDS.toMillis(configuration.metricIntervalSeconds))); + String stepMillisValue = Long.toString(SECONDS.toMillis(configuration.metricIntervalSeconds)); + properties.put("applicationinsights.internal.micrometer.step.millis", stepMillisValue); // also set as system property so that instrumentation modules can read it - System.setProperty( - "applicationinsights.internal.micrometer.step.millis", - Long.toString(SECONDS.toMillis(configuration.metricIntervalSeconds))); + System.setProperty("applicationinsights.internal.micrometer.step.millis", stepMillisValue); properties.put( "otel.metric.export.interval", diff --git a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java index aa79ac4ae6..b87ae702d9 100644 --- a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java +++ b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java @@ -17,10 +17,15 @@ public class AzureMonitorRegistryConfig implements StepRegistryConfig { private AzureMonitorRegistryConfig() { String stepMillisStr = System.getProperty("applicationinsights.internal.micrometer.step.millis"); - step = - stepMillisStr != null - ? Duration.ofMillis(Long.parseLong(stepMillisStr)) - : Duration.ofSeconds(60); + Duration parsedStep = null; + if (stepMillisStr != null) { + try { + parsedStep = Duration.ofMillis(Long.parseLong(stepMillisStr)); + } catch (NumberFormatException ignored) { + // fall through to default + } + } + step = parsedStep != null ? parsedStep : Duration.ofSeconds(60); namespace = System.getProperty("applicationinsights.internal.micrometer.namespace"); } From cc75939fef170a6a9bdedabb92a3b09d44edd316 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:07:15 +0000 Subject: [PATCH 5/7] Plan: use ConfigPropertiesUtil as upstream replacement for AgentInstrumentationConfig Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com> --- .../methods/ai/MethodInstrumentationModule.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java b/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java index 7399ca6f74..3dfe918f16 100644 --- a/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java +++ b/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java @@ -32,8 +32,7 @@ public MethodInstrumentationModule() { super("ai-methods"); Map> classMethodsToTrace = - MethodsConfigurationParser.parse( - System.getProperty(TRACE_METHODS_CONFIG)); + MethodsConfigurationParser.parse(System.getProperty(TRACE_METHODS_CONFIG)); typeInstrumentations = classMethodsToTrace.entrySet().stream() From c5aa97b96c351522b47dc44f8471b645d4cee539 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 10:13:23 +0000 Subject: [PATCH 6/7] Use ConfigPropertiesUtil as upstream replacement for AgentInstrumentationConfig Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com> --- .../methods/ai/MethodInstrumentationModule.java | 3 ++- .../micrometer/ai/AzureMonitorRegistryConfig.java | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java b/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java index 3dfe918f16..a2ea6ef693 100644 --- a/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java +++ b/agent/instrumentation/methods/src/main/java/io/opentelemetry/javaagent/instrumentation/methods/ai/MethodInstrumentationModule.java @@ -13,6 +13,7 @@ import static java.util.Collections.emptyList; import com.google.auto.service.AutoService; +import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil; import io.opentelemetry.javaagent.extension.instrumentation.InstrumentationModule; import io.opentelemetry.javaagent.extension.instrumentation.TypeInstrumentation; import io.opentelemetry.javaagent.tooling.config.MethodsConfigurationParser; @@ -32,7 +33,7 @@ public MethodInstrumentationModule() { super("ai-methods"); Map> classMethodsToTrace = - MethodsConfigurationParser.parse(System.getProperty(TRACE_METHODS_CONFIG)); + MethodsConfigurationParser.parse(ConfigPropertiesUtil.getString(TRACE_METHODS_CONFIG)); typeInstrumentations = classMethodsToTrace.entrySet().stream() diff --git a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java index b87ae702d9..e3cf2587ee 100644 --- a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java +++ b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java @@ -4,6 +4,7 @@ package io.opentelemetry.javaagent.instrumentation.micrometer.ai; import io.micrometer.core.instrument.step.StepRegistryConfig; +import io.opentelemetry.instrumentation.api.internal.ConfigPropertiesUtil; import java.time.Duration; import javax.annotation.Nullable; @@ -16,7 +17,7 @@ public class AzureMonitorRegistryConfig implements StepRegistryConfig { private AzureMonitorRegistryConfig() { String stepMillisStr = - System.getProperty("applicationinsights.internal.micrometer.step.millis"); + ConfigPropertiesUtil.getString("applicationinsights.internal.micrometer.step.millis"); Duration parsedStep = null; if (stepMillisStr != null) { try { @@ -26,7 +27,8 @@ private AzureMonitorRegistryConfig() { } } step = parsedStep != null ? parsedStep : Duration.ofSeconds(60); - namespace = System.getProperty("applicationinsights.internal.micrometer.namespace"); + namespace = + ConfigPropertiesUtil.getString("applicationinsights.internal.micrometer.namespace"); } @Override From 87d1bfba643dc1fc15aa51d3dbf10546fa71e5b1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 23:04:51 +0000 Subject: [PATCH 7/7] Upgrade OTel contrib to 1.52.0 and replace AgentInstrumentationConfig with ConfigPropertiesUtil Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com> --- .../micrometer/ai/AzureMonitorRegistryConfig.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java index e3cf2587ee..7851780add 100644 --- a/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java +++ b/agent/instrumentation/micrometer-1.0/src/main/java/io/opentelemetry/javaagent/instrumentation/micrometer/ai/AzureMonitorRegistryConfig.java @@ -27,8 +27,7 @@ private AzureMonitorRegistryConfig() { } } step = parsedStep != null ? parsedStep : Duration.ofSeconds(60); - namespace = - ConfigPropertiesUtil.getString("applicationinsights.internal.micrometer.namespace"); + namespace = ConfigPropertiesUtil.getString("applicationinsights.internal.micrometer.namespace"); } @Override