Class OpenTracingHelper


  • public class OpenTracingHelper
    extends Object
    A helper class for OpenTracing instrumentation in JAX-RS resources.
    • 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 name
      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.
      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.
    • Constructor Detail

      • OpenTracingHelper

        public OpenTracingHelper​(jakarta.ws.rs.container.ResourceInfo resourceInfo)
    • 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 request
        tracedAnnotation - 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