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
Modifier and TypeFieldDescriptionstatic 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
ModifierConstructorDescriptionprotected
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 TypeMethodDescriptionprotected 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
-
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
- theConversionService
instancepathExclusionTest
- 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:
true
if the path should be excluded
-