THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
The Apache CXF uses native OpenTelemetry capabilities so the existing instrumentations for different HTTP clients work as expected. The usage of only JAX-RS client is not required. For example, the following snippet demonstrates the usage of traceble OkHttp client to call JAX-RS resources, backed by Apache CXF and OpenTelemetry OkHttp3 instrumentation.
Code Block | ||||
---|---|---|---|---|
| ||||
final SdkTracerProvider sdkTracerProvider = SdkTracerProvider .builder() ... .build(); final OpenTelemetry openTelemetry = OpenTelemetrySdk .builder() .setTracerProvider(sdkTracerProvider) ... .buildAndRegisterGlobal(); final OkHttpClient client = OkHttpClient.Builder().build(); final Call.Factory factory = OkHttpTelemetry.builder(openTelemetry).build().newCallFactory(client)); final Request request = new Request.Builder() .url("http://localhost:9000/catalog") .header("Accept", "application/json") .build(); try (final Response response = factory.newCall(request).execute()) { // Do something with response.body() } |
...