From 5adcc2cb4d42544e45051c60c56a19052881bd6c Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Mon, 2 Aug 2021 17:38:12 -0700 Subject: [PATCH] Add grizzly instrumentation as preview (#1830) * Add grizzly instrumentation as preview * Update lockfiles --- .../agent/internal/configuration/Configuration.java | 2 ++ .../agent/internal/init/ConfigOverride.java | 5 +++++ .../agent/internal/statsbeat/Feature.java | 3 ++- .../agent/internal/statsbeat/FeatureStatsbeat.java | 7 +++++-- .../agent/internal/statsbeat/Instrumentations.java | 1 + agent/instrumentation/build.gradle.kts | 1 + agent/instrumentation/gradle.lockfile | 1 + 7 files changed, 17 insertions(+), 3 deletions(-) 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 2c10926baf4..956bc77d7a9 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 @@ -210,6 +210,8 @@ public static class InternalConfiguration { public static class PreviewInstrumentation { public DisabledByDefaultInstrumentation azureSdk = new DisabledByDefaultInstrumentation(); + public DisabledByDefaultInstrumentation grizzly = new DisabledByDefaultInstrumentation(); + // this is just here to detect if using this old setting in order to give a helpful message @Deprecated public DisabledByDefaultInstrumentation javaHttpClient = new DisabledByDefaultInstrumentation(); 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 8c676178395..c920e0beea1 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 @@ -79,6 +79,11 @@ static Config getConfig(Configuration config) { if (!config.preview.instrumentation.azureSdk.enabled) { properties.put("otel.instrumentation.azure-core.enabled", "false"); } + if (config.preview.instrumentation.grizzly.enabled) { + // grizzly instrumentation is off by default + // TODO (trask) investigate if grizzly instrumentation can be enabled upstream by default now + properties.put("otel.instrumentation.grizzly.enabled", "true"); + } if (!config.preview.instrumentation.springIntegration.enabled) { properties.put("otel.instrumentation.spring-integration.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 ed02c9f3357..6fea74b1da8 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 @@ -47,7 +47,8 @@ enum Feature { // JAXWS_DISABLED(17), no longer used RABBITMQ_DISABLED(18), SPRING_INTEGRATION_DISABLED(19), - LEGACY_PROPAGATION_DISABLED(20); + LEGACY_PROPAGATION_DISABLED(20), + GRIZZLY_DISABLED(21); // preview instrumentation 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 d4fdb9872fa..50ad621ef71 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 @@ -82,6 +82,9 @@ void trackConfigurationOptions(Configuration config) { if (!config.instrumentation.mongo.enabled) { featureList.add(Feature.MONGO_DISABLED); } + if (!config.instrumentation.rabbitmq.enabled) { + featureList.add(Feature.RABBITMQ_DISABLED); + } if (!config.instrumentation.redis.enabled) { featureList.add(Feature.REDIS_DISABLED); } @@ -93,8 +96,8 @@ void trackConfigurationOptions(Configuration config) { if (!config.preview.instrumentation.azureSdk.enabled) { featureList.add(Feature.AZURE_SDK_DISABLED); } - if (!config.instrumentation.rabbitmq.enabled) { - featureList.add(Feature.RABBITMQ_DISABLED); + if (!config.preview.instrumentation.grizzly.enabled) { + featureList.add(Feature.GRIZZLY_DISABLED); } if (!config.preview.instrumentation.springIntegration.enabled) { featureList.add(Feature.SPRING_INTEGRATION_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 fb093eed9a4..06f86871ad6 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 @@ -117,6 +117,7 @@ class Instrumentations { INSTRUMENTATION_MAP.put("io.opentelemetry.spring-rabbit-1.0", 66); INSTRUMENTATION_MAP.put("io.opentelemetry.jaxrs-client-2.0", 67); INSTRUMENTATION_MAP.put("io.opentelemetry.jaxrs-client-2.0-resteasy-3.0", 68); + INSTRUMENTATION_MAP.put("io.opentelemetry.grizzly-2.0", 69); } // encode BitSet to a long diff --git a/agent/instrumentation/build.gradle.kts b/agent/instrumentation/build.gradle.kts index b525c2938a0..b4992a235d4 100644 --- a/agent/instrumentation/build.gradle.kts +++ b/agent/instrumentation/build.gradle.kts @@ -52,6 +52,7 @@ dependencies { implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-cassandra-4.0:${otelInstrumentationAlphaVersion}") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-executors:${otelInstrumentationAlphaVersion}") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-google-http-client-1.19:${otelInstrumentationAlphaVersion}") + implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-grizzly-2.0:${otelInstrumentationAlphaVersion}") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-grpc-1.6:${otelInstrumentationAlphaVersion}") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-guava-10.0:${otelInstrumentationAlphaVersion}") implementation("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-http-url-connection:${otelInstrumentationAlphaVersion}") diff --git a/agent/instrumentation/gradle.lockfile b/agent/instrumentation/gradle.lockfile index f3310c66c0f..b055c312209 100644 --- a/agent/instrumentation/gradle.lockfile +++ b/agent/instrumentation/gradle.lockfile @@ -90,6 +90,7 @@ io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-cassandra-3.0 io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-cassandra-4.0:1.4.0+ai.patch.1-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-executors:1.4.0+ai.patch.1-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-google-http-client-1.19:1.4.0+ai.patch.1-alpha=runtimeClasspath +io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-grizzly-2.0:1.4.0+ai.patch.1-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-grpc-1.6:1.4.0+ai.patch.1-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-guava-10.0:1.4.0+ai.patch.1-alpha=runtimeClasspath io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-http-url-connection:1.4.0+ai.patch.1-alpha=runtimeClasspath