|
8 | 8 | import io.netty.channel.Channel;
|
9 | 9 | import io.opentelemetry.api.GlobalOpenTelemetry;
|
10 | 10 | import io.opentelemetry.context.Context;
|
11 |
| -import io.opentelemetry.instrumentation.api.instrumenter.Instrumenter; |
12 | 11 | import io.opentelemetry.instrumentation.netty.v4_1.internal.AttributeKeys;
|
13 |
| -import io.opentelemetry.instrumentation.ratpack.v1_7.RatpackTelemetry; |
14 | 12 | import io.opentelemetry.instrumentation.ratpack.v1_7.internal.ContextHolder;
|
| 13 | +import io.opentelemetry.instrumentation.ratpack.v1_7.internal.OpenTelemetryHttpClient; |
| 14 | +import io.opentelemetry.instrumentation.ratpack.v1_7.internal.OpenTelemetryServerHandler; |
| 15 | +import io.opentelemetry.instrumentation.ratpack.v1_7.internal.RatpackClientInstrumenterBuilderFactory; |
| 16 | +import io.opentelemetry.instrumentation.ratpack.v1_7.internal.RatpackServerInstrumenterBuilderFactory; |
15 | 17 | import io.opentelemetry.javaagent.bootstrap.internal.AgentCommonConfig;
|
16 |
| -import io.opentelemetry.javaagent.bootstrap.internal.ExperimentalConfig; |
17 | 18 | import ratpack.exec.Execution;
|
18 | 19 |
|
19 | 20 | public final class RatpackSingletons {
|
20 | 21 |
|
21 | 22 | static {
|
22 |
| - TELEMETRY = |
23 |
| - RatpackTelemetry.builder(GlobalOpenTelemetry.get()) |
24 |
| - .configure(AgentCommonConfig.get()) |
25 |
| - .build(); |
| 23 | + HTTP_CLIENT = |
| 24 | + new OpenTelemetryHttpClient( |
| 25 | + RatpackClientInstrumenterBuilderFactory.create( |
| 26 | + "io.opentelemetry.ratpack-1.7", GlobalOpenTelemetry.get()) |
| 27 | + .configure(AgentCommonConfig.get()) |
| 28 | + .build()); |
| 29 | + SERVER_HANDLER = |
| 30 | + new OpenTelemetryServerHandler( |
| 31 | + RatpackServerInstrumenterBuilderFactory.create( |
| 32 | + "io.opentelemetry.ratpack-1.7", GlobalOpenTelemetry.get()) |
| 33 | + .configure(AgentCommonConfig.get()) |
| 34 | + .build()); |
26 | 35 | }
|
27 | 36 |
|
28 |
| - private static final Instrumenter<String, Void> INSTRUMENTER = |
29 |
| - Instrumenter.<String, Void>builder( |
30 |
| - GlobalOpenTelemetry.get(), "io.opentelemetry.ratpack-1.7", s -> s) |
31 |
| - .setEnabled(ExperimentalConfig.get().controllerTelemetryEnabled()) |
32 |
| - .buildInstrumenter(); |
| 37 | + private static final OpenTelemetryHttpClient HTTP_CLIENT; |
| 38 | + private static final OpenTelemetryServerHandler SERVER_HANDLER; |
33 | 39 |
|
34 |
| - public static Instrumenter<String, Void> instrumenter() { |
35 |
| - return INSTRUMENTER; |
| 40 | + public static OpenTelemetryHttpClient httpClient() { |
| 41 | + return HTTP_CLIENT; |
36 | 42 | }
|
37 | 43 |
|
38 |
| - private static final RatpackTelemetry TELEMETRY; |
39 |
| - |
40 |
| - public static RatpackTelemetry telemetry() { |
41 |
| - return TELEMETRY; |
| 44 | + public static OpenTelemetryServerHandler serverHandler() { |
| 45 | + return SERVER_HANDLER; |
42 | 46 | }
|
43 | 47 |
|
44 | 48 | public static void propagateContextToChannel(Execution execution, Channel channel) {
|
|
0 commit comments