org.springframework.cloud.sleuth.Sampler Java Examples

The following examples show how to use org.springframework.cloud.sleuth.Sampler. 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: OpenCensusSleuthTracer.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
@Override
@javax.annotation.Nullable
public Span createSpan(String name, /*@Nullable*/ Sampler sampler) {
  String shortenedName = SpanNameUtil.shorten(name);
  Span span;
  if (isTracing()) {
    span = createChild(getCurrentSpan(), shortenedName);
  } else {
    long id = createId();
    span =
        Span.builder()
            .name(shortenedName)
            .traceIdHigh(this.traceId128 ? createTraceIdHigh() : 0L)
            .traceId(id)
            .spanId(id)
            .build();
    if (sampler == null) {
      sampler = this.defaultSampler;
    }
    span = sampledSpan(span, sampler);
    this.spanLogger.logStartedSpan(null, span);
  }
  return continueSpan(span);
}
 
Example #2
Source File: OpenCensusSleuthTracer.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
/** Basic constructor holding components for implementing Sleuth's {@link Tracer} interface. */
public OpenCensusSleuthTracer(
    Sampler defaultSampler,
    Random random,
    SpanNamer spanNamer,
    SpanLogger spanLogger,
    SpanReporter spanReporter,
    TraceKeys traceKeys,
    boolean traceId128) {
  this.defaultSampler = defaultSampler;
  this.random = random;
  this.spanNamer = spanNamer;
  this.spanLogger = spanLogger;
  this.spanReporter = spanReporter;
  this.traceId128 = traceId128;
  this.traceKeys = traceKeys != null ? traceKeys : new TraceKeys();
}
 
Example #3
Source File: OpenCensusSleuthTracer.java    From opencensus-java with Apache License 2.0 6 votes vote down vote up
/** Basic constructor holding components for implementing Sleuth's {@link Tracer} interface. */
public OpenCensusSleuthTracer(
    Sampler defaultSampler,
    Random random,
    SpanNamer spanNamer,
    SpanLogger spanLogger,
    SpanReporter spanReporter,
    TraceKeys traceKeys) {
  this(
      defaultSampler,
      random,
      spanNamer,
      spanLogger,
      spanReporter,
      traceKeys,
      /* traceId128= */ false);
}
 
Example #4
Source File: OpenCensusSleuthTracer.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
private static Span sampledSpan(Span span, Sampler sampler) {
  if (!sampler.isSampled(span)) {
    // Copy everything, except set exportable to false
    return Span.builder()
        .begin(span.getBegin())
        .traceIdHigh(span.getTraceIdHigh())
        .traceId(span.getTraceId())
        .spanId(span.getSpanId())
        .name(span.getName())
        .exportable(false)
        .build();
  }
  return span;
}
 
Example #5
Source File: OpenCensusSleuthAutoConfiguration.java    From opencensus-java with Apache License 2.0 5 votes vote down vote up
@Bean
@Primary
Tracer openCensusSleuthTracer(
    Sampler sampler,
    Random random,
    SpanNamer spanNamer,
    SpanLogger spanLogger,
    SpanReporter spanReporter,
    TraceKeys traceKeys) {
  return new OpenCensusSleuthTracer(
      sampler, random, spanNamer, spanLogger, spanReporter, traceKeys, /* traceId128= */ true);
}
 
Example #6
Source File: OrderApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #7
Source File: ProductApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #8
Source File: AccountApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #9
Source File: AccountApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #10
Source File: AccountApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #11
Source File: AccountApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #12
Source File: AddressServiceApplication.java    From resilient-transport-service with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler sampler() {
    return new AlwaysSampler();
}
 
Example #13
Source File: CustomerServiceApplication.java    From resilient-transport-service with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler sampler(){
    return new AlwaysSampler();
}
 
Example #14
Source File: ConnoteServiceApplication.java    From resilient-transport-service with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler sampler(){
    return new AlwaysSampler();
}
 
Example #15
Source File: BookingServiceApplication.java    From resilient-transport-service with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler sampler() {
    return new AlwaysSampler();
}
 
Example #16
Source File: TransportApiGatewayApplication.java    From resilient-transport-service with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler sampler() {
    return new AlwaysSampler();
}
 
Example #17
Source File: AbstractSleuthConfiguration.java    From abixen-platform with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Bean
Sampler sampler() {
    return span -> true;
}
 
Example #18
Source File: PortfolioApplication.java    From cf-SpringBootTrader with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler<?> defaultSampler() {
	return new AlwaysSampler();
}
 
Example #19
Source File: QuotesApplication.java    From cf-SpringBootTrader with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler<?> defaultSampler() {
	return new AlwaysSampler();
}
 
Example #20
Source File: AccountsApplication.java    From cf-SpringBootTrader with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler<?> defaultSampler() {
	return new AlwaysSampler();
}
 
Example #21
Source File: WebApplication.java    From cf-SpringBootTrader with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler<?> defaultSampler() {
	return new AlwaysSampler();
}
 
Example #22
Source File: CustomerApplication.java    From Mastering-Spring-Cloud with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return new AlwaysSampler();
}
 
Example #23
Source File: SleuthConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}
 
Example #24
Source File: EdgeServerApplication.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}
 
Example #25
Source File: SleuthConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}
 
Example #26
Source File: SleuthConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}
 
Example #27
Source File: EdgeServerApplication.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}
 
Example #28
Source File: SleuthConfiguration.java    From Learning-Path-Spring-5-End-to-End-Programming with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}
 
Example #29
Source File: CustomPollerConfiguration.java    From paascloud-master with Apache License 2.0 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
	return  new AlwaysSampler();
}
 
Example #30
Source File: SleuthConfiguration.java    From Spring-5.0-By-Example with MIT License 4 votes vote down vote up
@Bean
public Sampler defaultSampler() {
  return new AlwaysSampler();
}