All Downloads are FREE. Search and download functionalities are using the official Maven repository.

brave.RealSpanCustomizer Maven / Gradle / Ivy

There is a newer version: 6.0.3
Show newest version
package brave;

import brave.internal.recorder.Recorder;
import brave.propagation.TraceContext;
import com.google.auto.value.AutoValue;

/** This wraps the public api and guards access to a mutable span. */
@AutoValue
abstract class RealSpanCustomizer implements SpanCustomizer {

  abstract TraceContext context();
  abstract Recorder recorder();

  static RealSpanCustomizer create(TraceContext context, Recorder recorder) {
    return new AutoValue_RealSpanCustomizer(context, recorder);
  }

  @Override public SpanCustomizer name(String name) {
    recorder().name(context(), name);
    return this;
  }

  @Override public SpanCustomizer annotate(String value) {
    recorder().annotate(context(), value);
    return this;
  }

  @Override public SpanCustomizer tag(String key, String value) {
    recorder().tag(context(), key, value);
    return this;
  }

  @Override
  public String toString() {
    return "RealSpanCustomizer(" + context() + ")";
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy