From dc9369fa6c5f9fd60a33c4ab76b62c53ed2e27c4 Mon Sep 17 00:00:00 2001 From: Mateusz Rzeszutek Date: Thu, 14 Sep 2023 18:34:06 +0200 Subject: [PATCH] Use new semconv artifact (#1423) * Use new semconv artifact * generateLicenseReport --- agent/build.gradle.kts | 2 +- ...unk.instrumentation-conventions.gradle.kts | 1 + custom/build.gradle.kts | 3 ++- .../RuleBasedSamplerProvider.java | 13 ++++++++++-- ...TruncateCommandLineWhenMetricsEnabled.java | 2 +- .../micrometer/GlobalTagsBuilder.java | 12 +++++------ .../micrometer/SplunkMetricsConfig.java | 2 +- .../servicename/ServiceNameChecker.java | 2 +- ...cateCommandLineWhenMetricsEnabledTest.java | 4 ++-- .../micrometer/GlobalTagsBuilderTest.java | 2 +- .../micrometer/SplunkMetricsConfigTest.java | 2 +- dependencyManagement/build.gradle.kts | 21 ++----------------- .../KHttpHttpClientHttpAttributesGetter.java | 2 +- licenses/licenses.md | 6 +++++- profiler/build.gradle.kts | 4 ++-- testing/agent-for-testing/build.gradle.kts | 2 +- 16 files changed, 39 insertions(+), 41 deletions(-) diff --git a/agent/build.gradle.kts b/agent/build.gradle.kts index 9abc2cbee..cb5dcada8 100644 --- a/agent/build.gradle.kts +++ b/agent/build.gradle.kts @@ -89,7 +89,7 @@ tasks { exclude(dependency("io.opentelemetry:opentelemetry-api-events")) exclude(dependency("io.opentelemetry:opentelemetry-api-logs")) exclude(dependency("io.opentelemetry:opentelemetry-context")) - exclude(dependency("io.opentelemetry:opentelemetry-semconv")) + exclude(dependency("io.opentelemetry.semconv:opentelemetry-semconv")) // metrics advice API exclude(dependency("io.opentelemetry:opentelemetry-extension-incubator")) } diff --git a/buildSrc/src/main/kotlin/splunk.instrumentation-conventions.gradle.kts b/buildSrc/src/main/kotlin/splunk.instrumentation-conventions.gradle.kts index 33c734a16..1fbcb96a0 100644 --- a/buildSrc/src/main/kotlin/splunk.instrumentation-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/splunk.instrumentation-conventions.gradle.kts @@ -15,6 +15,7 @@ dependencies { compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv") compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") + compileOnly("io.opentelemetry.semconv:opentelemetry-semconv") annotationProcessor("com.google.auto.service:auto-service") compileOnly("com.google.auto.service:auto-service") compileOnly(project(":bootstrap")) diff --git a/custom/build.gradle.kts b/custom/build.gradle.kts index 8644f1cf3..de4ab8678 100644 --- a/custom/build.gradle.kts +++ b/custom/build.gradle.kts @@ -3,7 +3,7 @@ dependencies { compileOnly("io.opentelemetry:opentelemetry-sdk") compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") - compileOnly("io.opentelemetry:opentelemetry-semconv") + compileOnly("io.opentelemetry.semconv:opentelemetry-semconv") compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") @@ -32,6 +32,7 @@ dependencies { testImplementation("io.opentelemetry:opentelemetry-sdk-testing") testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") + testImplementation("io.opentelemetry.semconv:opentelemetry-semconv") testImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") testImplementation("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling") diff --git a/custom/src/main/java/com/splunk/opentelemetry/RuleBasedSamplerProvider.java b/custom/src/main/java/com/splunk/opentelemetry/RuleBasedSamplerProvider.java index b11a3461d..f45c69e60 100644 --- a/custom/src/main/java/com/splunk/opentelemetry/RuleBasedSamplerProvider.java +++ b/custom/src/main/java/com/splunk/opentelemetry/RuleBasedSamplerProvider.java @@ -20,13 +20,15 @@ import static java.util.logging.Level.WARNING; import com.google.auto.service.AutoService; +import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.trace.SpanKind; import io.opentelemetry.contrib.sampler.RuleBasedRoutingSampler; import io.opentelemetry.contrib.sampler.RuleBasedRoutingSamplerBuilder; +import io.opentelemetry.instrumentation.api.internal.SemconvStability; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.autoconfigure.spi.traces.ConfigurableSamplerProvider; import io.opentelemetry.sdk.trace.samplers.Sampler; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; import java.util.ArrayList; import java.util.List; import java.util.logging.Logger; @@ -45,11 +47,18 @@ public Sampler createSampler(ConfigProperties config) { RuleBasedRoutingSamplerBuilder builder = RuleBasedRoutingSampler.builder(SpanKind.SERVER, samplerConfiguration.fallback); - samplerConfiguration.drop.forEach(d -> builder.drop(SemanticAttributes.HTTP_TARGET, d)); + samplerConfiguration.drop.forEach(d -> builder.drop(getHttpPathAttribute(), d)); return builder.build(); } + @SuppressWarnings("deprecation") // old semconv still used + private AttributeKey getHttpPathAttribute() { + return SemconvStability.emitOldHttpSemconv() + ? SemanticAttributes.HTTP_TARGET + : SemanticAttributes.URL_PATH; + } + @Override public String getName() { return "rules"; diff --git a/custom/src/main/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabled.java b/custom/src/main/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabled.java index 18d8e729c..07ef114ce 100644 --- a/custom/src/main/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabled.java +++ b/custom/src/main/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabled.java @@ -26,7 +26,7 @@ import io.opentelemetry.sdk.autoconfigure.spi.AutoConfigurationCustomizerProvider; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; import java.util.ArrayList; import java.util.Iterator; import java.util.List; diff --git a/custom/src/main/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilder.java b/custom/src/main/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilder.java index 606e4576f..451bfa986 100644 --- a/custom/src/main/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilder.java +++ b/custom/src/main/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilder.java @@ -16,12 +16,12 @@ package com.splunk.opentelemetry.micrometer; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.CONTAINER_ID; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.DEPLOYMENT_ENVIRONMENT; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.HOST_NAME; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_PID; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_RUNTIME_NAME; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.SERVICE_NAME; +import static io.opentelemetry.semconv.ResourceAttributes.CONTAINER_ID; +import static io.opentelemetry.semconv.ResourceAttributes.DEPLOYMENT_ENVIRONMENT; +import static io.opentelemetry.semconv.ResourceAttributes.HOST_NAME; +import static io.opentelemetry.semconv.ResourceAttributes.PROCESS_PID; +import static io.opentelemetry.semconv.ResourceAttributes.PROCESS_RUNTIME_NAME; +import static io.opentelemetry.semconv.ResourceAttributes.SERVICE_NAME; import io.micrometer.core.instrument.Tag; import io.micrometer.core.instrument.Tags; diff --git a/custom/src/main/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfig.java b/custom/src/main/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfig.java index b899da9cf..4e91af905 100644 --- a/custom/src/main/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfig.java +++ b/custom/src/main/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfig.java @@ -31,7 +31,7 @@ import io.micrometer.signalfx.SignalFxConfig; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; import java.time.Duration; class SplunkMetricsConfig implements SignalFxConfig { diff --git a/custom/src/main/java/com/splunk/opentelemetry/servicename/ServiceNameChecker.java b/custom/src/main/java/com/splunk/opentelemetry/servicename/ServiceNameChecker.java index c89db5629..8777f616d 100644 --- a/custom/src/main/java/com/splunk/opentelemetry/servicename/ServiceNameChecker.java +++ b/custom/src/main/java/com/splunk/opentelemetry/servicename/ServiceNameChecker.java @@ -24,7 +24,7 @@ import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import io.opentelemetry.sdk.autoconfigure.spi.ConfigProperties; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; import java.util.Map; import java.util.function.Consumer; import java.util.logging.Logger; diff --git a/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java b/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java index c9dd548a7..62f5673e0 100644 --- a/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java +++ b/custom/src/test/java/com/splunk/opentelemetry/TruncateCommandLineWhenMetricsEnabledTest.java @@ -19,8 +19,8 @@ import static com.splunk.opentelemetry.SplunkConfiguration.METRICS_ENABLED_PROPERTY; import static com.splunk.opentelemetry.SplunkConfiguration.METRICS_FULL_COMMAND_LINE; import static io.opentelemetry.api.common.AttributeKey.stringKey; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_COMMAND_ARGS; -import static io.opentelemetry.semconv.resource.attributes.ResourceAttributes.PROCESS_COMMAND_LINE; +import static io.opentelemetry.semconv.ResourceAttributes.PROCESS_COMMAND_ARGS; +import static io.opentelemetry.semconv.ResourceAttributes.PROCESS_COMMAND_LINE; import static org.assertj.core.api.Assertions.assertThat; import static org.junit.jupiter.api.Assertions.assertSame; import static org.mockito.Mockito.mock; diff --git a/custom/src/test/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilderTest.java b/custom/src/test/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilderTest.java index f62234739..bc51db608 100644 --- a/custom/src/test/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilderTest.java +++ b/custom/src/test/java/com/splunk/opentelemetry/micrometer/GlobalTagsBuilderTest.java @@ -22,7 +22,7 @@ import io.opentelemetry.api.common.AttributeKey; import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; import org.junit.jupiter.api.Test; class GlobalTagsBuilderTest { diff --git a/custom/src/test/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfigTest.java b/custom/src/test/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfigTest.java index de444c274..a18b8d810 100644 --- a/custom/src/test/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfigTest.java +++ b/custom/src/test/java/com/splunk/opentelemetry/micrometer/SplunkMetricsConfigTest.java @@ -34,7 +34,7 @@ import io.opentelemetry.api.common.Attributes; import io.opentelemetry.sdk.autoconfigure.AutoConfiguredOpenTelemetrySdk; import io.opentelemetry.sdk.resources.Resource; -import io.opentelemetry.semconv.resource.attributes.ResourceAttributes; +import io.opentelemetry.semconv.ResourceAttributes; import java.time.Duration; import java.util.Map; import org.junit.jupiter.api.Test; diff --git a/dependencyManagement/build.gradle.kts b/dependencyManagement/build.gradle.kts index 7ec26ec21..8a00897a6 100644 --- a/dependencyManagement/build.gradle.kts +++ b/dependencyManagement/build.gradle.kts @@ -35,7 +35,7 @@ dependencies { api(enforcedPlatform("io.grpc:grpc-bom:1.58.0")) api(platform("io.micrometer:micrometer-bom:$micrometerVersion")) api(enforcedPlatform("io.opentelemetry:opentelemetry-bom-alpha:$otelAlphaVersion")) - api(enforcedPlatform("io.opentelemetry:opentelemetry-bom:$otelVersion")) + api(enforcedPlatform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelInstrumentationAlphaVersion")) api(enforcedPlatform("org.junit:junit-bom:5.10.0")) api(enforcedPlatform("org.testcontainers:testcontainers-bom:1.19.0")) @@ -56,27 +56,10 @@ dependencies { api("com.google.auto.value:auto-value:$autoValueVersion") api("com.google.auto.value:auto-value-annotations:$autoValueVersion") - // otel-java-instrumentation - api("io.opentelemetry.javaagent:opentelemetry-javaagent:$otelInstrumentationVersion") - api("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api:$otelInstrumentationVersion") - api("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api-semconv:$otelInstrumentationAlphaVersion") - - api("io.opentelemetry.javaagent:opentelemetry-agent-for-testing:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-javaagent-instrumentation-api:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-javaagent-internal-logging-simple:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-javaagent-tooling:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-muzzle:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent:opentelemetry-testing-common:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-2.2:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-3.0:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.javaagent.instrumentation:opentelemetry-javaagent-servlet-common:$otelInstrumentationAlphaVersion") - api("io.opentelemetry.contrib:opentelemetry-samplers:$otelContribAlphaVersion") api("io.opentelemetry.contrib:opentelemetry-resource-providers:$otelContribAlphaVersion") - api("io.opentelemetry.proto:opentelemetry-proto:1.0.0-alpha") + api("io.opentelemetry.semconv:opentelemetry-semconv:1.21.0-alpha") } } diff --git a/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java b/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java index 1d71f66bb..023b123ec 100644 --- a/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java +++ b/instrumentation/khttp-0.1/src/main/java/com/splunk/opentelemetry/instrumentation/khttp/KHttpHttpClientHttpAttributesGetter.java @@ -20,7 +20,7 @@ import static java.util.Collections.singletonList; import io.opentelemetry.instrumentation.api.instrumenter.http.HttpClientAttributesGetter; -import io.opentelemetry.semconv.trace.attributes.SemanticAttributes; +import io.opentelemetry.semconv.SemanticAttributes; import java.net.InetSocketAddress; import java.util.List; import java.util.Map; diff --git a/licenses/licenses.md b/licenses/licenses.md index d2cd03b8f..ee826b166 100644 --- a/licenses/licenses.md +++ b/licenses/licenses.md @@ -1,7 +1,7 @@ # splunk-otel-javaagent ## Dependency License Report -_2023-09-12 20:46:57 EEST_ +_2023-09-14 16:53:56 CEST_ ## Apache License, Version 2.0 **1** **Group:** `com.fasterxml.jackson.core` **Name:** `jackson-core` **Version:** `2.15.2` @@ -274,4 +274,8 @@ _2023-09-12 20:46:57 EEST_ > - **POM License**: Universal Permissive License Version 1.0 or The 3-Clause BSD License - [https://github.com/openjdk/jmc/blob/master/core/license/LICENSE.txt](https://github.com/openjdk/jmc/blob/master/core/license/LICENSE.txt) > - **Embedded license files**: [flightrecorder-8.3.1.jar/LICENSE.txt](flightrecorder-8.3.1.jar/LICENSE.txt) +## Unknown + +**54** **Group:** `io.opentelemetry.instrumentation` **Name:** `opentelemetry-instrumentation-bom-alpha` **Version:** `1.30.0-alpha-SNAPSHOT` + diff --git a/profiler/build.gradle.kts b/profiler/build.gradle.kts index 5f33379bf..8db13e10e 100644 --- a/profiler/build.gradle.kts +++ b/profiler/build.gradle.kts @@ -26,7 +26,7 @@ dependencies { compileOnly("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-extension-api") compileOnly("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") - compileOnly("io.opentelemetry:opentelemetry-semconv") + compileOnly("io.opentelemetry.semconv:opentelemetry-semconv") // required to access InstrumentationHolder compileOnly("io.opentelemetry.javaagent:opentelemetry-javaagent-bootstrap") implementation("io.opentelemetry:opentelemetry-sdk-logs") @@ -42,7 +42,7 @@ dependencies { testImplementation("io.opentelemetry.instrumentation:opentelemetry-instrumentation-api") testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") testImplementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure-spi") - testImplementation("io.opentelemetry:opentelemetry-semconv") + testImplementation("io.opentelemetry.semconv:opentelemetry-semconv") testImplementation("io.opentelemetry:opentelemetry-context") testImplementation("io.opentelemetry:opentelemetry-api") testImplementation("io.opentelemetry:opentelemetry-sdk") diff --git a/testing/agent-for-testing/build.gradle.kts b/testing/agent-for-testing/build.gradle.kts index ba164f559..d09e31de9 100644 --- a/testing/agent-for-testing/build.gradle.kts +++ b/testing/agent-for-testing/build.gradle.kts @@ -55,7 +55,7 @@ tasks { exclude(dependency("io.opentelemetry:opentelemetry-api-events")) exclude(dependency("io.opentelemetry:opentelemetry-api-logs")) exclude(dependency("io.opentelemetry:opentelemetry-context")) - exclude(dependency("io.opentelemetry:opentelemetry-semconv")) + exclude(dependency("io.opentelemetry.semconv:opentelemetry-semconv")) // metrics advice API exclude(dependency("io.opentelemetry:opentelemetry-extension-incubator")) }