Skip to content

Commit

Permalink
http server builder
Browse files Browse the repository at this point in the history
  • Loading branch information
zeitlinger committed Sep 27, 2024
1 parent 41efcc5 commit 773c98e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ class KtorClientTracingBuilder {
}
}

private lateinit var openTelemetry: OpenTelemetry
private lateinit var clientBuilder: DefaultHttpClientInstrumenterBuilder<HttpRequestData, HttpResponse>

fun setOpenTelemetry(openTelemetry: OpenTelemetry) {
this.openTelemetry = openTelemetry
this.clientBuilder = DefaultHttpClientInstrumenterBuilder(
INSTRUMENTATION_NAME,
openTelemetry,
Expand Down Expand Up @@ -165,6 +167,6 @@ class KtorClientTracingBuilder {

internal fun build(): KtorClientTracing = KtorClientTracing(
instrumenter = clientBuilder.build(),
propagators = clientBuilder.openTelemetry.propagators,
propagators = openTelemetry.propagators,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ class KtorServerTracing private constructor(
DefaultHttpServerInstrumenterBuilder(
INSTRUMENTATION_NAME,
openTelemetry,
KtorHttpServerAttributesGetter.INSTANCE
KtorHttpServerAttributesGetter.INSTANCE,
null
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down Expand Up @@ -152,7 +151,7 @@ public RatpackTelemetryBuilder setEmitExperimentalHttpServerMetrics(
/** Sets custom client {@link SpanNameExtractor} via transform function. */
@CanIgnoreReturnValue
public RatpackTelemetryBuilder setClientSpanNameExtractor(
Function<SpanNameExtractor<RequestSpec>, ? extends SpanNameExtractor<? super RequestSpec>>
Function<SpanNameExtractor<? super RequestSpec>, ? extends SpanNameExtractor<? super RequestSpec>>
clientSpanNameExtractor) {
clientBuilder.setSpanNameExtractor(clientSpanNameExtractor);
return this;
Expand All @@ -161,7 +160,7 @@ public RatpackTelemetryBuilder setClientSpanNameExtractor(
/** Sets custom server {@link SpanNameExtractor} via transform function. */
@CanIgnoreReturnValue
public RatpackTelemetryBuilder setServerSpanNameExtractor(
Function<SpanNameExtractor<Request>, ? extends SpanNameExtractor<? super Request>>
Function<SpanNameExtractor<? super Request>, ? extends SpanNameExtractor<? super Request>>
serverSpanNameExtractor) {
serverBuilder.setSpanNameExtractor(serverSpanNameExtractor);
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 773c98e

Please sign in to comment.