From e87d92051057549d068c79d7dadef6bbaea1714c Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 11 Oct 2021 15:18:11 -0700 Subject: [PATCH] Add akka preview instrumentation (#1911) * Add akka preview instrumentation * Fix comment * Update lock files --- .../agent/internal/configuration/Configuration.java | 2 ++ .../agent/internal/init/ConfigOverride.java | 5 +++++ .../agent/internal/statsbeat/Feature.java | 3 ++- .../agent/internal/statsbeat/FeatureStatsbeat.java | 3 +++ .../agent/internal/statsbeat/Instrumentations.java | 1 + agent/instrumentation/build.gradle.kts | 3 +++ agent/instrumentation/gradle.lockfile | 3 +++ 7 files changed, 19 insertions(+), 1 deletion(-) diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/Configuration.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/Configuration.java index 5977db39b45..a1146fee1ea 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/Configuration.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/configuration/Configuration.java @@ -267,6 +267,8 @@ public static class InternalConfiguration { public static class PreviewInstrumentation { + public DisabledByDefaultInstrumentation akka = new DisabledByDefaultInstrumentation(); + public DisabledByDefaultInstrumentation apacheCamel = new DisabledByDefaultInstrumentation(); // this is just here to detect if using this old setting in order to give a helpful message diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/ConfigOverride.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/ConfigOverride.java index b9a0ae1a920..2ffe6a08eef 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/ConfigOverride.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/init/ConfigOverride.java @@ -72,6 +72,11 @@ static Config getConfig(Configuration config) { if (!config.instrumentation.springScheduling.enabled) { properties.put("otel.instrumentation.spring-scheduling.enabled", "false"); } + if (!config.preview.instrumentation.akka.enabled) { + // akka instrumentation is ON by default in OTEL + properties.put("otel.instrumentation.akka-actor.enabled", "false"); + properties.put("otel.instrumentation.akka-http.enabled", "false"); + } if (!config.preview.instrumentation.apacheCamel.enabled) { // apache-camel instrumentation is ON by default in OTEL properties.put("otel.instrumentation.apache-camel.enabled", "false"); diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Feature.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Feature.java index 6f8265c09a9..ccf3f66165a 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Feature.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Feature.java @@ -52,7 +52,8 @@ enum Feature { GRIZZLY_ENABLED(21), // preview instrumentation, grizzly is OFF by default in OTEL STATSBEAT_DISABLED(22), // disable non-essential statsbeat QUARTZ_DISABLED(23), // preview instrumentation, quartz is ON by default in OTEL - APACHE_CAMEL_DISABLED(24); // preview instrumentation, apache camel is ON by default in OTEL + APACHE_CAMEL_DISABLED(24), // preview instrumentation, apache camel is ON by default in OTEL + AKKA_DISABLED(25); // preview instrumentation, akka is ON by default in OTEL private static final Map javaVendorFeatureMap; diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/FeatureStatsbeat.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/FeatureStatsbeat.java index 092acdbbad5..58d2ec244ae 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/FeatureStatsbeat.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/FeatureStatsbeat.java @@ -129,6 +129,9 @@ void trackConfigurationOptions(Configuration config) { } // preview instrumentation + if (!config.preview.instrumentation.akka.enabled) { + featureList.add(Feature.AKKA_DISABLED); + } if (!config.preview.instrumentation.apacheCamel.enabled) { featureList.add(Feature.APACHE_CAMEL_DISABLED); } diff --git a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Instrumentations.java b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Instrumentations.java index 3f761785b33..bd057528314 100644 --- a/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Instrumentations.java +++ b/agent/agent-tooling/src/main/java/com/microsoft/applicationinsights/agent/internal/statsbeat/Instrumentations.java @@ -120,6 +120,7 @@ class Instrumentations { INSTRUMENTATION_MAP.put("io.opentelemetry.grizzly-2.0", 69); INSTRUMENTATION_MAP.put("io.opentelemetry.quartz-2.0", 70); INSTRUMENTATION_MAP.put("io.opentelemetry.apache-camel-2.20", 71); + INSTRUMENTATION_MAP.put("io.opentelemetry.akka-http-10.0", 72); } // encode BitSet to a long diff --git a/agent/instrumentation/build.gradle.kts b/agent/instrumentation/build.gradle.kts index c5889573afe..d40103fb991 100644 --- a/agent/instrumentation/build.gradle.kts +++ b/agent/instrumentation/build.gradle.kts @@ -39,6 +39,9 @@ dependencies { exclude("ch.qos.logback", "logback-core") } + implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-akka-actor-2.5:$otelInstrumentationAlphaVersion") + implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-akka-actor-fork-join-2.5:$otelInstrumentationAlphaVersion") + implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-akka-http-10.0:$otelInstrumentationAlphaVersion") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-camel-2.20:$otelInstrumentationAlphaVersion") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-httpasyncclient-4.1:$otelInstrumentationAlphaVersion") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-httpclient-2.0:$otelInstrumentationAlphaVersion") diff --git a/agent/instrumentation/gradle.lockfile b/agent/instrumentation/gradle.lockfile index 658bb3e9d04..4fb5d5f2874 100644 --- a/agent/instrumentation/gradle.lockfile +++ b/agent/instrumentation/gradle.lockfile @@ -75,6 +75,9 @@ io.opentelemetry.instrumentation:opentelemetry-servlet-common:1.6.0+ai.patches-a io.opentelemetry.instrumentation:opentelemetry-servlet-javax-common:1.6.0+ai.patches-alpha=runtimeClasspath io.opentelemetry.instrumentation:opentelemetry-spring-integration-4.1:1.6.0+ai.patches-alpha=runtimeClasspath io.opentelemetry.instrumentation:opentelemetry-spring-webflux-5.0:1.6.0+ai.patches-alpha=runtimeClasspath +io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-akka-actor-2.5:1.6.0+ai.patches-alpha=runtimeClasspath +io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-akka-actor-fork-join-2.5:1.6.0+ai.patches-alpha=runtimeClasspath +io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-akka-http-10.0:1.6.0+ai.patches-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-camel-2.20:1.6.0+ai.patches-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-httpasyncclient-4.1:1.6.0+ai.patches-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-apache-httpclient-2.0:1.6.0+ai.patches-alpha=runtimeClasspath