public class TracingHttpServiceFilter extends java.lang.Object implements StreamingHttpServiceFilterFactory
StreamingHttpService
that supports open tracing.Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
componentName |
protected InMemoryTraceStateFormat<HttpHeaders> |
formatter |
protected io.opentracing.Tracer |
tracer |
Constructor and Description |
---|
TracingHttpServiceFilter(io.opentracing.Tracer tracer,
java.lang.String componentName)
Create a new instance.
|
TracingHttpServiceFilter(io.opentracing.Tracer tracer,
java.lang.String componentName,
boolean validateTraceKeyFormat)
Create a new instance.
|
Modifier and Type | Method and Description |
---|---|
StreamingHttpServiceFilter |
create(StreamingHttpService service)
Create a
StreamingHttpServiceFilter using the provided StreamingHttpService . |
protected java.lang.String |
getOperationName(java.lang.String componentName,
HttpRequestMetaData metaData)
Get the operation name to build the span with.
|
protected boolean |
injectSpanContextIntoResponse(io.opentracing.SpanContext parentSpanContext)
Determine if the current span context should be injected into the response.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append
protected final io.opentracing.Tracer tracer
protected final java.lang.String componentName
protected final InMemoryTraceStateFormat<HttpHeaders> formatter
public TracingHttpServiceFilter(io.opentracing.Tracer tracer, java.lang.String componentName)
tracer
- The Tracer
.componentName
- The component name used during building new spans.public TracingHttpServiceFilter(io.opentracing.Tracer tracer, java.lang.String componentName, boolean validateTraceKeyFormat)
tracer
- The Tracer
.componentName
- The component name used during building new spans.validateTraceKeyFormat
- true
to validate the contents of the trace ids.public final StreamingHttpServiceFilter create(StreamingHttpService service)
StreamingHttpServiceFilterFactory
StreamingHttpServiceFilter
using the provided StreamingHttpService
.create
in interface StreamingHttpServiceFilterFactory
service
- StreamingHttpService
to filterStreamingHttpServiceFilter
using the provided StreamingHttpService
.protected java.lang.String getOperationName(java.lang.String componentName, HttpRequestMetaData metaData)
componentName
- The component name.metaData
- The HttpRequestMetaData
.protected boolean injectSpanContextIntoResponse(@Nullable io.opentracing.SpanContext parentSpanContext)
parentSpanContext
- The parent span extracted from the request.true
if the current span context should be injected into the response.