Class OpenTracingHelper
- java.lang.Object
-
- fish.payara.microprofile.telemetry.tracing.OpenTracingHelper
-
public class OpenTracingHelper extends Object
A helper class for OpenTracing instrumentation in JAX-RS resources.
-
-
Field Summary
Fields Modifier and Type Field Description static String
SPAN_CONVENTION_MP_KEY
-
Constructor Summary
Constructors Constructor Description OpenTracingHelper(jakarta.ws.rs.container.ResourceInfo resourceInfo)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
augmentSpan(io.opentelemetry.api.trace.SpanBuilder spanBuilder)
boolean
canTrace(org.glassfish.jersey.server.ContainerRequest request, org.eclipse.microprofile.opentracing.Traced tracedAnnotation)
Helper method that checks if any specified skip patterns match this method nameString
determineOperationName(jakarta.ws.rs.container.ContainerRequestContext request, org.eclipse.microprofile.opentracing.Traced tracedAnnotation)
Determines the operation name of the span based on the given ContainerRequestContext and Traced annotation.static org.eclipse.microprofile.config.Config
getConfig()
Gets the Config object for current application.org.eclipse.microprofile.opentracing.Traced
getTracedAnnotation()
Checks if CDI has been initialized by trying to get the BeanManager.
-
-
-
Field Detail
-
SPAN_CONVENTION_MP_KEY
public static final String SPAN_CONVENTION_MP_KEY
- See Also:
- Constant Field Values
-
-
Method Detail
-
determineOperationName
public String determineOperationName(jakarta.ws.rs.container.ContainerRequestContext request, org.eclipse.microprofile.opentracing.Traced tracedAnnotation)
Determines the operation name of the span based on the given ContainerRequestContext and Traced annotation.- Parameters:
request
- the ContainerRequestContext object for this requesttracedAnnotation
- the Traced annotation object for this request- Returns:
- the name to use as the span's operation name
-
augmentSpan
public void augmentSpan(io.opentelemetry.api.trace.SpanBuilder spanBuilder)
-
getTracedAnnotation
public org.eclipse.microprofile.opentracing.Traced getTracedAnnotation()
Checks if CDI has been initialized by trying to get the BeanManager. If CDI is initialized, gets the Traced annotation from the target method.- Returns:
- the Traced annotation object for this request, or null if CDI has not been initialized
-
canTrace
public boolean canTrace(org.glassfish.jersey.server.ContainerRequest request, org.eclipse.microprofile.opentracing.Traced tracedAnnotation)
Helper method that checks if any specified skip patterns match this method name- Parameters:
request
- the request to check if we should skip- Returns:
-
getConfig
public static org.eclipse.microprofile.config.Config getConfig()
Gets the Config object for current application.- Returns:
- the Config object for this request, or null if no config could be found
-
-