Class AbstractTraceInterceptor

java.lang.Object
io.micronaut.tracing.opentracing.interceptor.AbstractTraceInterceptor
All Implemented Interfaces:
io.micronaut.aop.Interceptor<Object,Object>, io.micronaut.aop.MethodInterceptor<Object,Object>, io.micronaut.core.order.Ordered
Direct Known Subclasses:
ContinueSpanInterceptor, NewSpanTraceInterceptor

@Internal @Requires(beans=io.opentracing.Tracer.class) public abstract sealed class AbstractTraceInterceptor extends Object implements io.micronaut.aop.MethodInterceptor<Object,Object> permits ContinueSpanInterceptor, NewSpanTraceInterceptor
Implements tracing logic for ContinueSpan and NewSpan using the Open Tracing API.
Since:
1.0
Author:
graemerocher
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    protected final io.micronaut.core.convert.ConversionService
     
    static final String
     
    protected final io.opentracing.Tracer
     

    Fields inherited from interface io.micronaut.aop.Interceptor

    ARGUMENT, CACHEABLE_LAZY_TARGET, HOTSWAP, LAZY, PROXY_TARGET

    Fields inherited from interface io.micronaut.core.order.Ordered

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractTraceInterceptor(io.opentracing.Tracer tracer, io.micronaut.core.convert.ConversionService conversionService)
    Initialize the interceptor with tracer and conversion service.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    static void
    logError(io.opentracing.Span span, Throwable e)
    Logs an error to the span.
    protected final void
    populateTags(io.micronaut.aop.MethodInvocationContext<Object,Object> context, io.opentracing.Span span)
     
    protected final void
    tagArguments(io.opentracing.Span span, io.micronaut.aop.MethodInvocationContext<Object,Object> context)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.micronaut.aop.MethodInterceptor

    intercept, intercept
  • Field Details

    • CLASS_TAG

      public static final String CLASS_TAG
      See Also:
    • METHOD_TAG

      public static final String METHOD_TAG
      See Also:
    • tracer

      protected final io.opentracing.Tracer tracer
    • conversionService

      protected final io.micronaut.core.convert.ConversionService conversionService
  • Constructor Details

    • AbstractTraceInterceptor

      protected AbstractTraceInterceptor(io.opentracing.Tracer tracer, io.micronaut.core.convert.ConversionService conversionService)
      Initialize the interceptor with tracer and conversion service.
      Parameters:
      tracer - for span creation and propagation across arbitrary transports
      conversionService - the ConversionService instance
  • Method Details

    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface io.micronaut.core.order.Ordered
    • populateTags

      protected final void populateTags(io.micronaut.aop.MethodInvocationContext<Object,Object> context, io.opentracing.Span span)
    • logError

      public static void logError(io.opentracing.Span span, Throwable e)
      Logs an error to the span.
      Parameters:
      span - the span
      e - the error
    • tagArguments

      protected final void tagArguments(io.opentracing.Span span, io.micronaut.aop.MethodInvocationContext<Object,Object> context)