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
FieldsModifier and TypeFieldDescriptionstatic final Stringprotected final io.micronaut.core.convert.ConversionServicestatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected final io.opentracing.TracerFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractOpenTracingFilter(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 TypeMethodDescriptionprotected io.opentracing.Tracer.SpanBuildernewSpan(io.micronaut.http.HttpRequest<?> request, io.opentracing.SpanContext spanContext) Creates a new span for the given request and span context.protected StringresolveSpanName(io.micronaut.http.HttpRequest<?> request) Resolve the span name to use for the request.protected voidsetErrorTags(io.opentracing.Span span, Throwable error) Sets the error tags to use on the span.protected voidsetResponseTags(io.micronaut.http.HttpRequest<?> request, io.micronaut.http.HttpResponse<?> response, io.opentracing.Span span) Sets the response tags.protected booleanshouldExclude(@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, waitMethods inherited from interface io.micronaut.http.filter.HttpFilter
doFilterMethods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Field Details
-
CLIENT_PATH
- See Also:
-
SERVER_PATH
- See Also:
-
TAG_METHOD
- See Also:
-
TAG_PATH
- See Also:
-
TAG_ERROR
- See Also:
-
TAG_HTTP_STATUS_CODE
- See Also:
-
TAG_HTTP_CLIENT
- See Also:
-
TAG_HTTP_SERVER
- See Also:
-
tracer
protected final io.opentracing.Tracer tracer -
conversionService
protected final io.micronaut.core.convert.ConversionService conversionService
-
-
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 tracerconversionService- theConversionServiceinstancepathExclusionTest- 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 requestresponse- the responsespan- the span
-
setErrorTags
Sets the error tags to use on the span.- Parameters:
span- the spanerror- the error
-
resolveSpanName
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 requestspanContext- the span context- Returns:
- the span builder
-
shouldExclude
Tests if the defined path should be excluded from tracing.- Parameters:
path- the path to test- Returns:
trueif the path should be excluded
-