brave.propagation.TraceContext.Extractor Java Examples
The following examples show how to use
brave.propagation.TraceContext.Extractor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpringRabbitTracing.java From brave with Apache License 2.0 | 5 votes |
<R> TraceContextOrSamplingFlags extractAndClearTraceIdHeaders( Extractor<R> extractor, R request, Message message ) { TraceContextOrSamplingFlags extracted = extractor.extract(request); // Clear any propagation keys present in the headers if (extracted.samplingFlags() == null) { // then trace IDs were extracted MessageProperties properties = message.getMessageProperties(); if (properties != null) clearTraceIdHeaders(properties.getHeaders()); } return extracted; }
Example #2
Source File: BraveTracer.java From brave-opentracing with Apache License 2.0 | 5 votes |
/** * Extracts the underlying context using B3 encoding by default. Null is returned when there is no * encoded context in the carrier, or upon error extracting it. */ @Nullable @Override public <C> BraveSpanContext extract(Format<C> format, C carrier) { TraceContextOrSamplingFlags extractionResult; if (carrier instanceof BinaryExtract) { extractionResult = BinaryCodec.INSTANCE.extract((BinaryExtract) carrier); } else { Extractor<C> extractor = (Extractor<C>) formatToExtractor.get(format); if (extractor == null) { throw new UnsupportedOperationException(format + " not in " + formatToExtractor.keySet()); } extractionResult = extractor.extract(carrier); } if (emptyExtractions.contains(extractionResult)) return null; return BraveSpanContext.create(extractionResult); }
Example #3
Source File: KafkaTracing.java From brave with Apache License 2.0 | 5 votes |
<R> TraceContextOrSamplingFlags extractAndClearTraceIdHeaders( Extractor<R> extractor, R request, Headers headers ) { TraceContextOrSamplingFlags extracted = extractor.extract(request); // Clear any propagation keys present in the headers if (extracted.samplingFlags() == null) { // then trace IDs were extracted clearTraceIdHeaders(headers); } return extracted; }
Example #4
Source File: JmsTracing.java From brave with Apache License 2.0 | 5 votes |
<R> TraceContextOrSamplingFlags extractAndClearTraceIdProperties( Extractor<R> extractor, R request, Message message ) { TraceContextOrSamplingFlags extracted = extractor.extract(request); // Clear propagation regardless of extraction as JMS requires clearing as a means to make the // message writable PropertyFilter.filterProperties(message, traceIdProperties); return extracted; }
Example #5
Source File: TracingProducer.java From brave with Apache License 2.0 | 5 votes |
TracingProducer(Extractor<R> extractor, Injector<R> injector, JmsTracing jmsTracing) { this.jmsTracing = jmsTracing; this.tracer = jmsTracing.tracing.tracer(); this.current = jmsTracing.tracing.currentTraceContext(); this.extractor = extractor; this.injector = injector; this.sampler = jmsTracing.producerSampler; this.remoteServiceName = jmsTracing.remoteServiceName; }
Example #6
Source File: HttpServerHandler.java From brave with Apache License 2.0 | 5 votes |
/** * @since 4.3 * @deprecated Since 5.7, use {@link #handleReceive(HttpServerRequest)} */ @Deprecated public <C> Span handleReceive(Extractor<C> extractor, C carrier, Req request) { if (carrier == null) throw new NullPointerException("request == null"); HttpServerRequest serverRequest; if (request instanceof HttpServerRequest) { serverRequest = (HttpServerRequest) request; } else { serverRequest = new HttpServerAdapters.FromRequestAdapter<>(adapter, request); } Span span = nextSpan(extractor.extract(carrier), serverRequest); return handleStart(serverRequest, span); }
Example #7
Source File: StringPropagationAdapter.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, K> getter) { // No check if Setter is a RemoteGetter because this instance cannot have String keys while // RemoteGetter must have String keys return delegate.extractor(new GetterAdapter<>(getter, map)); }
Example #8
Source File: GrpcPropagation.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, String> getter) { return new GrpcExtractor<>(this, getter); }
Example #9
Source File: CustomTraceIdPropagation.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Propagation.Getter<R, String> getter) { return delegate.extractor(new Getter<>(getter, customTraceIdName)); }
Example #10
Source File: AWSPropagation.java From zipkin-aws with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, String> getter) { if (getter == null) throw new NullPointerException("getter == null"); return new AWSExtractor<>(this, getter); }
Example #11
Source File: BaggagePropagation.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, K> getter) { return delegate.extractor(getter); }
Example #12
Source File: BaggagePropagation.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, String> getter) { return new BaggageExtractor<>(this, getter); }
Example #13
Source File: B3Propagation.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, String> getter) { if (getter == null) throw new NullPointerException("getter == null"); return new B3Extractor<>(this, getter); }
Example #14
Source File: ExtraFieldPropagation.java From brave with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, K> getter) { return delegate.extractor(getter); }
Example #15
Source File: StackdriverTracePropagation.java From zipkin-gcp with Apache License 2.0 | 4 votes |
@Override public <R> Extractor<R> extractor(Getter<R, String> getter) { if (getter == null) throw new NullPointerException("getter == null"); return new XCloudTraceContextExtractor<>(primary, getter); }
Example #16
Source File: StackdriverTracePropagation.java From zipkin-gcp with Apache License 2.0 | 4 votes |
@Override public <C> Extractor<C> extractor(Getter<C, K> getter) { return delegate.extractor(getter); }
Example #17
Source File: HttpServerHandler.java From brave with Apache License 2.0 | 2 votes |
/** * @since 4.3 * @deprecated Since 5.7, use {@link #handleReceive(HttpServerRequest)} */ @Deprecated public Span handleReceive(Extractor<Req> extractor, Req request) { return handleReceive(extractor, request, request); }