public class OpenTracingUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static io.opentracing.Span |
getRequestChildSpan(jakarta.ws.rs.container.ContainerRequestContext context)
Create and start ad-hoc custom span with the default name as a child span of the request span (if available).
|
static io.opentracing.Span |
getRequestChildSpan(jakarta.ws.rs.container.ContainerRequestContext context,
String spanName)
Create and start ad-hoc custom span with a custom name as a child span of the request span (if available).
|
static Optional<io.opentracing.Span> |
getRequestSpan(jakarta.ws.rs.container.ContainerRequestContext context)
Resolve resource-level span.
|
public static Optional<io.opentracing.Span> getRequestSpan(jakarta.ws.rs.container.ContainerRequestContext context)
If open tracing is enabled and GlobalTracer is registered, resource-level span should be stored in the
OpenTracingFeature.SPAN_CONTEXT_PROPERTY. This span is resolved and returned as an Optional.
context - ContainerRequestContext instance, can be obtained via @Context injectionOptional of the resolved span, if found; empty optional if notpublic static io.opentracing.Span getRequestChildSpan(jakarta.ws.rs.container.ContainerRequestContext context)
context - ContainerRequestContext instance, can be obtained via @Context injectionContainerRequestContext, new span is created
as a child span of the found span. If no parent span found, new "root" span is created. In both cases, the returned span
is already started. In order to successfully store the tracing, Span.finish() needs to be invoked explicitly,
after the traced code finishes.public static io.opentracing.Span getRequestChildSpan(jakarta.ws.rs.container.ContainerRequestContext context,
String spanName)
context - ContainerRequestContext instance, can be obtained via @Context injectionspanName - name to be used for the created spanContainerRequestContext, new span is created
as a child span of the found span. If no parent span found, new "root" span is created. In both cases, the returned span
is already started. In order to successfully store the tracing, Span.finish() needs to be invoked explicitly,
after the traced code finishes.Copyright © 2007-2021, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.