From 773c98ee8fe810a3f4c238ca6fc828b50532edc7 Mon Sep 17 00:00:00 2001 From: Gregor Zeitlinger Date: Thu, 26 Sep 2024 16:47:04 +0200 Subject: [PATCH] http server builder --- .../ktor/v2_0/client/KtorClientTracingBuilder.kt | 4 +++- .../instrumentation/ktor/v2_0/server/KtorServerTracing.kt | 3 ++- .../ratpack/v1_7/RatpackTelemetryBuilder.java | 7 +++---- .../instrumentation/undertow/UndertowSingletons.java | 3 +-- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/client/KtorClientTracingBuilder.kt b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/client/KtorClientTracingBuilder.kt index 14de724b6834..edf09d59d164 100644 --- a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/client/KtorClientTracingBuilder.kt +++ b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/client/KtorClientTracingBuilder.kt @@ -23,9 +23,11 @@ class KtorClientTracingBuilder { } } + private lateinit var openTelemetry: OpenTelemetry private lateinit var clientBuilder: DefaultHttpClientInstrumenterBuilder fun setOpenTelemetry(openTelemetry: OpenTelemetry) { + this.openTelemetry = openTelemetry this.clientBuilder = DefaultHttpClientInstrumenterBuilder( INSTRUMENTATION_NAME, openTelemetry, @@ -165,6 +167,6 @@ class KtorClientTracingBuilder { internal fun build(): KtorClientTracing = KtorClientTracing( instrumenter = clientBuilder.build(), - propagators = clientBuilder.openTelemetry.propagators, + propagators = openTelemetry.propagators, ) } diff --git a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorServerTracing.kt b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorServerTracing.kt index e6bd2e2fc2cf..b6990763e34f 100644 --- a/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorServerTracing.kt +++ b/instrumentation/ktor/ktor-2.0/library/src/main/kotlin/io/opentelemetry/instrumentation/ktor/v2_0/server/KtorServerTracing.kt @@ -51,7 +51,8 @@ class KtorServerTracing private constructor( DefaultHttpServerInstrumenterBuilder( INSTRUMENTATION_NAME, openTelemetry, - KtorHttpServerAttributesGetter.INSTANCE + KtorHttpServerAttributesGetter.INSTANCE, + null ) } diff --git a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java index 5986f1bd4615..4139aa1dccca 100644 --- a/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java +++ b/instrumentation/ratpack/ratpack-1.7/library/src/main/java/io/opentelemetry/instrumentation/ratpack/v1_7/RatpackTelemetryBuilder.java @@ -36,8 +36,7 @@ public final class RatpackTelemetryBuilder { .setHeaderSetter(RequestHeaderSetter.INSTANCE); serverBuilder = new DefaultHttpServerInstrumenterBuilder<>( - INSTRUMENTATION_NAME, openTelemetry, RatpackHttpAttributesGetter.INSTANCE) - .setHeaderGetter(RatpackGetter.INSTANCE); + INSTRUMENTATION_NAME, openTelemetry, RatpackHttpAttributesGetter.INSTANCE, RatpackGetter.INSTANCE); } /** @@ -152,7 +151,7 @@ public RatpackTelemetryBuilder setEmitExperimentalHttpServerMetrics( /** Sets custom client {@link SpanNameExtractor} via transform function. */ @CanIgnoreReturnValue public RatpackTelemetryBuilder setClientSpanNameExtractor( - Function, ? extends SpanNameExtractor> + Function, ? extends SpanNameExtractor> clientSpanNameExtractor) { clientBuilder.setSpanNameExtractor(clientSpanNameExtractor); return this; @@ -161,7 +160,7 @@ public RatpackTelemetryBuilder setClientSpanNameExtractor( /** Sets custom server {@link SpanNameExtractor} via transform function. */ @CanIgnoreReturnValue public RatpackTelemetryBuilder setServerSpanNameExtractor( - Function, ? extends SpanNameExtractor> + Function, ? extends SpanNameExtractor> serverSpanNameExtractor) { serverBuilder.setSpanNameExtractor(serverSpanNameExtractor); return this; diff --git a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java index 14c21b0aab58..fa8e7055c549 100644 --- a/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java +++ b/instrumentation/undertow-1.4/javaagent/src/main/java/io/opentelemetry/javaagent/instrumentation/undertow/UndertowSingletons.java @@ -26,8 +26,7 @@ public final class UndertowSingletons { builder.addContextCustomizer( (context, request, attributes) -> { // span is ended when counter reaches 0, we start from 2 which accounts for - // the - // handler that started the span and exchange completion listener + // the handler that started the span and exchange completion listener context = UndertowActiveHandlers.init(context, 2); return new AppServerBridge.Builder()