use of io.opencensus.trace.Span in project instrumentation-java by census-instrumentation.
the class SpanOperationsBenchmark method addAnnotationWithAnnotation.
/**
* Add an annotation with an annotation.
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span addAnnotationWithAnnotation(Data data) {
Span span = data.annotationSpanAnnotation;
Annotation annotation = Annotation.fromDescriptionAndAttributes(ANNOTATION_DESCRIPTION, data.attributeMap);
span.addAnnotation(annotation);
return span;
}
use of io.opencensus.trace.Span in project instrumentation-java by census-instrumentation.
the class SpanOperationsBenchmark method addAnnotationEmpty.
/**
* Add an annotation as description only.
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span addAnnotationEmpty(Data data) {
Span span = data.annotationSpanEmpty;
span.addAnnotation(ANNOTATION_DESCRIPTION);
return span;
}
use of io.opencensus.trace.Span in project instrumentation-java by census-instrumentation.
the class SpanOperationsBenchmark method putAttributes.
/**
* Add attributes as a map.
*/
@Benchmark
@BenchmarkMode(Mode.AverageTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span putAttributes(Data data) {
Span span = data.attributeSpan;
span.putAttributes(data.attributeMap);
return span;
}
use of io.opencensus.trace.Span in project instrumentation-java by census-instrumentation.
the class StartEndSpanBenchmark method startEndNonSampledRootSpan.
/**
* This benchmark attempts to measure performance of start/end for a non-sampled root {@code
* Span}.
*/
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span startEndNonSampledRootSpan(Data data) {
Span span = data.tracer.spanBuilderWithExplicitParent(SPAN_NAME, null).setSampler(Samplers.neverSample()).startSpan();
span.end();
return span;
}
use of io.opencensus.trace.Span in project instrumentation-java by census-instrumentation.
the class StartEndSpanBenchmark method startEndRecordEventsRootSpan.
/**
* This benchmark attempts to measure performance of start/end for a root {@code Span} with record
* events option.
*/
@Benchmark
@BenchmarkMode(Mode.SampleTime)
@OutputTimeUnit(TimeUnit.NANOSECONDS)
public Span startEndRecordEventsRootSpan(Data data) {
Span span = data.tracer.spanBuilderWithExplicitParent(SPAN_NAME, null).setSampler(Samplers.neverSample()).setRecordEvents(true).startSpan();
span.end();
return span;
}
Aggregations