Java Code Examples for brave.propagation.TraceContextOrSamplingFlags#sampled()

The following examples show how to use brave.propagation.TraceContextOrSamplingFlags#sampled() . 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: DubboServerHandler.java    From brave-instrumentation-dubbo with Apache License 2.0 5 votes vote down vote up
Span nextSpan(TraceContextOrSamplingFlags extracted) {
  if (extracted.sampled() == null) {
    extracted = extracted.sampled(false);
  }
  return extracted.context() != null
      ? tracer.joinSpan(extracted.context())
      : tracer.nextSpan(extracted);
}
 
Example 2
Source File: RpcServerHandler.java    From brave with Apache License 2.0 5 votes vote down vote up
/** Creates a potentially noop span representing this request */
Span nextSpan(TraceContextOrSamplingFlags extracted, RpcServerRequest request) {
  Boolean sampled = extracted.sampled();
  // only recreate the context if the RPC sampler made a decision
  if (sampled == null && (sampled = sampler.trySample(request)) != null) {
    extracted = extracted.sampled(sampled.booleanValue());
  }
  return extracted.context() != null
      ? tracer.joinSpan(extracted.context())
      : tracer.nextSpan(extracted);
}
 
Example 3
Source File: HttpServerHandler.java    From brave with Apache License 2.0 5 votes vote down vote up
/** Creates a potentially noop span representing this request */
Span nextSpan(TraceContextOrSamplingFlags extracted, HttpServerRequest request) {
  Boolean sampled = extracted.sampled();
  // only recreate the context if the http sampler made a decision
  if (sampled == null && (sampled = sampler.trySample(request)) != null) {
    extracted = extracted.sampled(sampled.booleanValue());
  }
  return extracted.context() != null
    ? tracer.joinSpan(extracted.context())
    : tracer.nextSpan(extracted);
}
 
Example 4
Source File: JmsTracing.java    From brave with Apache License 2.0 5 votes vote down vote up
/** Creates a potentially noop remote span representing this request */
Span nextMessagingSpan(
  SamplerFunction<MessagingRequest> sampler,
  MessagingRequest request,
  TraceContextOrSamplingFlags extracted
) {
  Boolean sampled = extracted.sampled();
  // only recreate the context if the messaging sampler made a decision
  if (sampled == null && (sampled = sampler.trySample(request)) != null) {
    extracted = extracted.sampled(sampled.booleanValue());
  }
  return tracer.nextSpan(extracted);
}
 
Example 5
Source File: KafkaTracing.java    From brave with Apache License 2.0 5 votes vote down vote up
/** Creates a potentially noop remote span representing this request */
Span nextMessagingSpan(
  SamplerFunction<MessagingRequest> sampler,
  MessagingRequest request,
  TraceContextOrSamplingFlags extracted
) {
  Boolean sampled = extracted.sampled();
  // only recreate the context if the messaging sampler made a decision
  if (sampled == null && (sampled = sampler.trySample(request)) != null) {
    extracted = extracted.sampled(sampled.booleanValue());
  }
  return tracer.nextSpan(extracted);
}
 
Example 6
Source File: SpringRabbitTracing.java    From brave with Apache License 2.0 5 votes vote down vote up
/** Creates a potentially noop remote span representing this request */
Span nextMessagingSpan(
  SamplerFunction<MessagingRequest> sampler,
  MessagingRequest request,
  TraceContextOrSamplingFlags extracted
) {
  Boolean sampled = extracted.sampled();
  // only recreate the context if the messaging sampler made a decision
  if (sampled == null && (sampled = sampler.trySample(request)) != null) {
    extracted = extracted.sampled(sampled.booleanValue());
  }
  return tracer.nextSpan(extracted);
}