Class AbstractOpenTracingFilter

java.lang.Object
io.micronaut.tracing.opentracing.instrument.http.AbstractOpenTracingFilter
All Implemented Interfaces:
io.micronaut.core.order.Ordered, io.micronaut.http.filter.HttpFilter
Direct Known Subclasses:
OpenTracingClientFilter, OpenTracingServerFilter

@Internal public abstract sealed class AbstractOpenTracingFilter extends Object implements io.micronaut.http.filter.HttpFilter permits OpenTracingClientFilter, OpenTracingServerFilter
Abstract filter used for Open Tracing based HTTP tracing.
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
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    static final String
     
    protected final io.opentracing.Tracer
     

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

    HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    AbstractOpenTracingFilter(io.opentracing.Tracer tracer, io.micronaut.core.convert.ConversionService conversionService, @Nullable Predicate<String> pathExclusionTest)
    Configure tracer in the filter for span creation and propagation across arbitrary transports.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected io.opentracing.Tracer.SpanBuilder
    newSpan(io.micronaut.http.HttpRequest<?> request, io.opentracing.SpanContext spanContext)
    Creates a new span for the given request and span context.
    protected String
    resolveSpanName(io.micronaut.http.HttpRequest<?> request)
    Resolve the span name to use for the request.
    protected void
    setErrorTags(io.opentracing.Span span, Throwable error)
    Sets the error tags to use on the span.
    protected void
    setResponseTags(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.HttpResponse<?> response, io.opentracing.Span span)
    Sets the response tags.
    protected boolean
    shouldExclude(@Nullable String path)
    Tests if the defined path should be excluded from tracing.

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface io.micronaut.http.filter.HttpFilter

    doFilter

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

    getOrder
  • Field Details

  • Constructor Details

    • AbstractOpenTracingFilter

      protected AbstractOpenTracingFilter(io.opentracing.Tracer tracer, io.micronaut.core.convert.ConversionService conversionService, @Nullable @Nullable Predicate<String> pathExclusionTest)
      Configure tracer in the filter for span creation and propagation across arbitrary transports.
      Parameters:
      tracer - the tracer
      conversionService - the ConversionService instance
      pathExclusionTest - the predicate for excluding URI paths from tracing
  • Method Details

    • setResponseTags

      protected void setResponseTags(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.HttpResponse<?> response, io.opentracing.Span span)
      Sets the response tags.
      Parameters:
      request - the request
      response - the response
      span - the span
    • setErrorTags

      protected void setErrorTags(io.opentracing.Span span, Throwable error)
      Sets the error tags to use on the span.
      Parameters:
      span - the span
      error - the error
    • resolveSpanName

      protected String resolveSpanName(io.micronaut.http.HttpRequest<?> request)
      Resolve the span name to use for the request.
      Parameters:
      request - the request
      Returns:
      the span name
    • newSpan

      protected io.opentracing.Tracer.SpanBuilder newSpan(io.micronaut.http.HttpRequest<?> request, io.opentracing.SpanContext spanContext)
      Creates a new span for the given request and span context.
      Parameters:
      request - the request
      spanContext - the span context
      Returns:
      the span builder
    • shouldExclude

      protected boolean shouldExclude(@Nullable @Nullable String path)
      Tests if the defined path should be excluded from tracing.
      Parameters:
      path - the path to test
      Returns:
      true if the path should be excluded