From 8da12e59fb0fa7480f34ba79ab8b90c5342f5590 Mon Sep 17 00:00:00 2001 From: Brian Estrada Date: Sat, 23 Nov 2024 13:17:43 -0500 Subject: [PATCH] chore: bumped otel version to 2.10.0 --- build.gradle.kts | 6 ++---- gradle.properties | 1 - .../kotlin/com/monta/otel/extension/Customizer.java | 13 +++++++------ 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 281bb84..1f39ccc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,3 @@ -val kotlinVersion: String by project - plugins { kotlin("jvm") version "2.0.21" id("com.github.johnrengelman.shadow") version "8.1.1" @@ -15,11 +13,11 @@ repositories { } dependencies { - val otelVersion = "2.6.0" + val otelVersion = "2.10.0" implementation(platform("io.opentelemetry.instrumentation:opentelemetry-instrumentation-bom-alpha:$otelVersion-alpha")) implementation("io.opentelemetry:opentelemetry-sdk-extension-autoconfigure") implementation("io.opentelemetry.semconv:opentelemetry-semconv") - implementation("io.opentelemetry.contrib:opentelemetry-samplers:1.37.0-alpha") + implementation("io.opentelemetry.contrib:opentelemetry-samplers:1.41.0-alpha") } sourceSets { diff --git a/gradle.properties b/gradle.properties index 2ec4eb5..d0f2e23 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,2 @@ -kotlinVersion=1.8.22 org.gradle.jvmargs=-Xmx4096m org.gradle.warning.mode=all diff --git a/src/main/kotlin/com/monta/otel/extension/Customizer.java b/src/main/kotlin/com/monta/otel/extension/Customizer.java index 0e5b611..27453d3 100644 --- a/src/main/kotlin/com/monta/otel/extension/Customizer.java +++ b/src/main/kotlin/com/monta/otel/extension/Customizer.java @@ -7,7 +7,8 @@ import io.opentelemetry.sdk.resources.Resource; import io.opentelemetry.sdk.trace.samplers.Sampler; import io.opentelemetry.semconv.ResourceAttributes; -import io.opentelemetry.semconv.SemanticAttributes; +import io.opentelemetry.semconv.ServiceAttributes; +import io.opentelemetry.semconv.UrlAttributes; import java.util.UUID; @@ -25,9 +26,9 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) { resource.merge( Resource.builder() .put(ResourceAttributes.SERVICE_INSTANCE_ID, UUID.randomUUID().toString()) - .put(ResourceAttributes.SERVICE_NAME, System.getenv("SERVICE_NAME")) + .put(ServiceAttributes.SERVICE_NAME, System.getenv("SERVICE_NAME")) .put(ResourceAttributes.DEPLOYMENT_ENVIRONMENT, System.getenv("STAGE")) - .put(ResourceAttributes.SERVICE_VERSION, System.getenv("BUILD_NUMBER")) + .put(ServiceAttributes.SERVICE_VERSION, System.getenv("BUILD_NUMBER")) .build() ) ); @@ -38,9 +39,9 @@ public void customize(AutoConfigurationCustomizer autoConfiguration) { sdkTracerProviderBuilder.setSampler( Sampler.parentBased( RuleBasedRoutingSampler.builder(SpanKind.SERVER, getSampler()) - .drop(SemanticAttributes.URL_PATH, "/health*") - .drop(SemanticAttributes.URL_PATH, "/prometheus*") - .drop(SemanticAttributes.URL_PATH, "/metrics*") + .drop(UrlAttributes.URL_PATH, "/health*") + .drop(UrlAttributes.URL_PATH, "/prometheus*") + .drop(UrlAttributes.URL_PATH, "/metrics*") .build() ) )