Move Span.Kind to the upper level as SpanKind (#2646)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
301a29d7a3
commit
19c002471e
|
|
@ -103,7 +103,7 @@ final class DefaultTracer implements Tracer {
|
|||
}
|
||||
|
||||
@Override
|
||||
public NoopSpanBuilder setSpanKind(Span.Kind spanKind) {
|
||||
public NoopSpanBuilder setSpanKind(SpanKind spanKind) {
|
||||
return this;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,37 +75,6 @@ public interface Span extends ImplicitContextKeyed {
|
|||
return PropagatedSpan.create(spanContext);
|
||||
}
|
||||
|
||||
/**
|
||||
* Type of span. Can be used to specify additional relationships between spans in addition to a
|
||||
* parent/child relationship.
|
||||
*/
|
||||
enum Kind {
|
||||
/** Default value. Indicates that the span is used internally. */
|
||||
INTERNAL,
|
||||
|
||||
/** Indicates that the span covers server-side handling of an RPC or other remote request. */
|
||||
SERVER,
|
||||
|
||||
/**
|
||||
* Indicates that the span covers the client-side wrapper around an RPC or other remote request.
|
||||
*/
|
||||
CLIENT,
|
||||
|
||||
/**
|
||||
* Indicates that the span describes producer sending a message to a broker. Unlike client and
|
||||
* server, there is no direct critical path latency relationship between producer and consumer
|
||||
* spans.
|
||||
*/
|
||||
PRODUCER,
|
||||
|
||||
/**
|
||||
* Indicates that the span describes consumer receiving a message from a broker. Unlike client
|
||||
* and server, there is no direct critical path latency relationship between producer and
|
||||
* consumer spans.
|
||||
*/
|
||||
CONSUMER
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an attribute to the {@code Span}. If the {@code Span} previously contained a mapping for
|
||||
* the key, the old value is replaced by the specified value.
|
||||
|
|
|
|||
|
|
@ -234,13 +234,13 @@ public interface SpanBuilder {
|
|||
<T> SpanBuilder setAttribute(AttributeKey<T> key, @Nonnull T value);
|
||||
|
||||
/**
|
||||
* Sets the {@link Span.Kind} for the newly created {@code Span}. If not called, the
|
||||
* implementation will provide a default value {@link Span.Kind#INTERNAL}.
|
||||
* Sets the {@link SpanKind} for the newly created {@code Span}. If not called, the implementation
|
||||
* will provide a default value {@link SpanKind#INTERNAL}.
|
||||
*
|
||||
* @param spanKind the kind of the newly created {@code Span}.
|
||||
* @return this.
|
||||
*/
|
||||
SpanBuilder setSpanKind(Span.Kind spanKind);
|
||||
SpanBuilder setSpanKind(SpanKind spanKind);
|
||||
|
||||
/**
|
||||
* Sets an explicit start timestamp for the newly created {@code Span}.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* Copyright The OpenTelemetry Authors
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
package io.opentelemetry.api.trace;
|
||||
|
||||
/**
|
||||
* Type of {@link Span}. Can be used to specify additional relationships between spans in addition
|
||||
* to a parent/child relationship.
|
||||
*/
|
||||
public enum SpanKind {
|
||||
/** Default value. Indicates that the span is used internally. */
|
||||
INTERNAL,
|
||||
|
||||
/** Indicates that the span covers server-side handling of an RPC or other remote request. */
|
||||
SERVER,
|
||||
|
||||
/**
|
||||
* Indicates that the span covers the client-side wrapper around an RPC or other remote request.
|
||||
*/
|
||||
CLIENT,
|
||||
|
||||
/**
|
||||
* Indicates that the span describes producer sending a message to a broker. Unlike client and
|
||||
* server, there is no direct critical path latency relationship between producer and consumer
|
||||
* spans.
|
||||
*/
|
||||
PRODUCER,
|
||||
|
||||
/**
|
||||
* Indicates that the span describes consumer receiving a message from a broker. Unlike client and
|
||||
* server, there is no direct critical path latency relationship between producer and consumer
|
||||
* spans.
|
||||
*/
|
||||
CONSUMER
|
||||
}
|
||||
|
|
@ -10,7 +10,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import java.time.Instant;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -23,7 +22,7 @@ class SpanBuilderTest {
|
|||
@Test
|
||||
void doNotCrash_NoopImplementation() {
|
||||
SpanBuilder spanBuilder = tracer.spanBuilder("MySpanName");
|
||||
spanBuilder.setSpanKind(Kind.SERVER);
|
||||
spanBuilder.setSpanKind(SpanKind.SERVER);
|
||||
spanBuilder.setParent(Context.root().with(Span.wrap(null)));
|
||||
spanBuilder.setParent(Context.root());
|
||||
spanBuilder.setNoParent();
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import io.jaegertracing.thriftjava.TagType;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
|
|
@ -94,7 +95,7 @@ final class Adapter {
|
|||
}
|
||||
target.setReferences(references);
|
||||
|
||||
if (span.getKind() != io.opentelemetry.api.trace.Span.Kind.INTERNAL) {
|
||||
if (span.getKind() != SpanKind.INTERNAL) {
|
||||
tags.add(
|
||||
new Tag(KEY_SPAN_KIND, TagType.STRING)
|
||||
.setVStr(span.getKind().name().toLowerCase(Locale.ROOT)));
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import io.jaegertracing.thriftjava.SpanRef;
|
|||
import io.jaegertracing.thriftjava.SpanRefType;
|
||||
import io.jaegertracing.thriftjava.Tag;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
|
|
@ -56,7 +56,7 @@ class AdapterTest {
|
|||
long startMs = System.currentTimeMillis();
|
||||
long endMs = startMs + duration;
|
||||
|
||||
SpanData span = getSpanData(startMs, endMs, Span.Kind.SERVER);
|
||||
SpanData span = getSpanData(startMs, endMs, SpanKind.SERVER);
|
||||
List<SpanData> spans = Collections.singletonList(span);
|
||||
|
||||
List<io.jaegertracing.thriftjava.Span> jaegerSpans = Adapter.toJaeger(spans);
|
||||
|
|
@ -71,7 +71,7 @@ class AdapterTest {
|
|||
long startMs = System.currentTimeMillis();
|
||||
long endMs = startMs + duration;
|
||||
|
||||
SpanData span = getSpanData(startMs, endMs, Span.Kind.SERVER);
|
||||
SpanData span = getSpanData(startMs, endMs, SpanKind.SERVER);
|
||||
|
||||
// test
|
||||
io.jaegertracing.thriftjava.Span jaegerSpan = Adapter.toJaeger(span);
|
||||
|
|
@ -109,7 +109,7 @@ class AdapterTest {
|
|||
long startMs = System.currentTimeMillis();
|
||||
long endMs = startMs + duration;
|
||||
|
||||
SpanData span = getSpanData(startMs, endMs, Span.Kind.INTERNAL);
|
||||
SpanData span = getSpanData(startMs, endMs, SpanKind.INTERNAL);
|
||||
|
||||
// test
|
||||
io.jaegertracing.thriftjava.Span jaegerSpan = Adapter.toJaeger(span);
|
||||
|
|
@ -222,7 +222,7 @@ class AdapterTest {
|
|||
.setName("GET /api/endpoint")
|
||||
.setStartEpochNanos(MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(MILLISECONDS.toNanos(endMs))
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.error())
|
||||
.setTotalRecordedEvents(0)
|
||||
.setTotalRecordedLinks(0)
|
||||
|
|
@ -248,7 +248,7 @@ class AdapterTest {
|
|||
.setName("GET /api/endpoint")
|
||||
.setStartEpochNanos(MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(MILLISECONDS.toNanos(endMs))
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.error())
|
||||
.setAttributes(attributes)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
@ -274,7 +274,7 @@ class AdapterTest {
|
|||
return EventData.create(epochNanos, "the log message", attributes, totalAttributeCount);
|
||||
}
|
||||
|
||||
private static SpanData getSpanData(long startMs, long endMs, Span.Kind kind) {
|
||||
private static SpanData getSpanData(long startMs, long endMs, SpanKind kind) {
|
||||
Attributes attributes = Attributes.of(booleanKey("valueB"), true);
|
||||
|
||||
LinkData link = LinkData.create(createSpanContext(LINK_TRACE_ID, LINK_SPAN_ID), attributes);
|
||||
|
|
|
|||
|
|
@ -16,9 +16,9 @@ import io.jaegertracing.thriftjava.Tag;
|
|||
import io.jaegertracing.thriftjava.TagType;
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -74,7 +74,7 @@ class JaegerThriftSpanExporterTest {
|
|||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.CONSUMER)
|
||||
.setKind(SpanKind.CONSUMER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
@ -139,7 +139,7 @@ class JaegerThriftSpanExporterTest {
|
|||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.CONSUMER)
|
||||
.setKind(SpanKind.CONSUMER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
@ -162,7 +162,7 @@ class JaegerThriftSpanExporterTest {
|
|||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.CONSUMER)
|
||||
.setKind(SpanKind.CONSUMER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ import com.google.protobuf.Timestamp;
|
|||
import com.google.protobuf.util.Timestamps;
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.exporter.jaeger.proto.api_v2.Model;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
|
|
@ -88,7 +88,7 @@ final class Adapter {
|
|||
.setRefType(Model.SpanRefType.CHILD_OF));
|
||||
}
|
||||
|
||||
if (span.getKind() != Span.Kind.INTERNAL) {
|
||||
if (span.getKind() != SpanKind.INTERNAL) {
|
||||
target.addTags(
|
||||
Model.KeyValue.newBuilder()
|
||||
.setKey(KEY_SPAN_KIND)
|
||||
|
|
|
|||
|
|
@ -18,9 +18,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import com.google.protobuf.util.Durations;
|
||||
import com.google.protobuf.util.Timestamps;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -54,7 +54,7 @@ class AdapterTest {
|
|||
long startMs = System.currentTimeMillis();
|
||||
long endMs = startMs + duration;
|
||||
|
||||
SpanData span = getSpanData(startMs, endMs, Span.Kind.SERVER);
|
||||
SpanData span = getSpanData(startMs, endMs, SpanKind.SERVER);
|
||||
List<SpanData> spans = Collections.singletonList(span);
|
||||
|
||||
Collection<Model.Span> jaegerSpans = Adapter.toJaeger(spans);
|
||||
|
|
@ -69,7 +69,7 @@ class AdapterTest {
|
|||
long startMs = System.currentTimeMillis();
|
||||
long endMs = startMs + duration;
|
||||
|
||||
SpanData span = getSpanData(startMs, endMs, Span.Kind.SERVER);
|
||||
SpanData span = getSpanData(startMs, endMs, SpanKind.SERVER);
|
||||
|
||||
// test
|
||||
Model.Span jaegerSpan = Adapter.toJaeger(span);
|
||||
|
|
@ -106,7 +106,7 @@ class AdapterTest {
|
|||
long startMs = System.currentTimeMillis();
|
||||
long endMs = startMs + duration;
|
||||
|
||||
SpanData span = getSpanData(startMs, endMs, Span.Kind.INTERNAL);
|
||||
SpanData span = getSpanData(startMs, endMs, SpanKind.INTERNAL);
|
||||
|
||||
// test
|
||||
Model.Span jaegerSpan = Adapter.toJaeger(span);
|
||||
|
|
@ -232,7 +232,7 @@ class AdapterTest {
|
|||
.setName("GET /api/endpoint")
|
||||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.error())
|
||||
.setTotalRecordedEvents(0)
|
||||
.setTotalRecordedLinks(0)
|
||||
|
|
@ -258,7 +258,7 @@ class AdapterTest {
|
|||
.setName("GET /api/endpoint")
|
||||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.error())
|
||||
.setAttributes(attributes)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
@ -287,7 +287,7 @@ class AdapterTest {
|
|||
return EventData.create(epochNanos, "the log message", attributes, totalAttributeCount);
|
||||
}
|
||||
|
||||
private static SpanData getSpanData(long startMs, long endMs, Span.Kind kind) {
|
||||
private static SpanData getSpanData(long startMs, long endMs, SpanKind kind) {
|
||||
Attributes attributes = Attributes.of(booleanKey("valueB"), true);
|
||||
|
||||
LinkData link = LinkData.create(createSpanContext(LINK_TRACE_ID, LINK_SPAN_ID), attributes);
|
||||
|
|
|
|||
|
|
@ -22,9 +22,9 @@ import io.grpc.inprocess.InProcessServerBuilder;
|
|||
import io.grpc.stub.StreamObserver;
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -100,7 +100,7 @@ class JaegerGrpcSpanExporterTest {
|
|||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.CONSUMER)
|
||||
.setKind(SpanKind.CONSUMER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
@ -152,7 +152,7 @@ class JaegerGrpcSpanExporterTest {
|
|||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.CONSUMER)
|
||||
.setKind(SpanKind.CONSUMER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
@ -177,7 +177,7 @@ class JaegerGrpcSpanExporterTest {
|
|||
.setStartEpochNanos(TimeUnit.MILLISECONDS.toNanos(startMs))
|
||||
.setEndEpochNanos(TimeUnit.MILLISECONDS.toNanos(endMs))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.CONSUMER)
|
||||
.setKind(SpanKind.CONSUMER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import io.github.netmikey.logunit.api.LogCapturer;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -51,7 +51,7 @@ class OtlpJsonLoggingSpanExporterTest {
|
|||
.setEndEpochNanos(100 + 1000)
|
||||
.setStatus(StatusData.ok())
|
||||
.setName("testSpan1")
|
||||
.setKind(Span.Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setAttributes(Attributes.of(stringKey("animal"), "cat", longKey("lives"), 9L))
|
||||
.setEvents(
|
||||
Collections.singletonList(
|
||||
|
|
@ -79,7 +79,7 @@ class OtlpJsonLoggingSpanExporterTest {
|
|||
.setEndEpochNanos(500 + 1001)
|
||||
.setStatus(StatusData.error())
|
||||
.setName("testSpan2")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setResource(RESOURCE)
|
||||
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.create("instrumentation2", "2"))
|
||||
.build();
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import io.github.netmikey.logunit.api.LogCapturer;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -54,7 +54,7 @@ class LoggingSpanExporterTest {
|
|||
.setEndEpochNanos(100 + 1000)
|
||||
.setStatus(StatusData.ok())
|
||||
.setName("testSpan1")
|
||||
.setKind(Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setAttributes(Attributes.of(stringKey("animal"), "cat", longKey("lives"), 9L))
|
||||
.setEvents(
|
||||
Collections.singletonList(
|
||||
|
|
@ -80,7 +80,7 @@ class LoggingSpanExporterTest {
|
|||
.setEndEpochNanos(500 + 1001)
|
||||
.setStatus(StatusData.error())
|
||||
.setName("testSpan2")
|
||||
.setKind(Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setInstrumentationLibraryInfo(InstrumentationLibraryInfo.create("tracer2", "1.0"))
|
||||
.build();
|
||||
|
||||
|
|
@ -133,7 +133,7 @@ class LoggingSpanExporterTest {
|
|||
.setEndEpochNanos(epochNanos + 1000)
|
||||
.setStatus(StatusData.ok())
|
||||
.setName("testSpan")
|
||||
.setKind(Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setEvents(
|
||||
Collections.singletonList(
|
||||
EventData.create(
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ package io.opentelemetry.exporter.otlp.trace;
|
|||
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -79,7 +79,7 @@ public class RequestMarshalState {
|
|||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setParentSpanContext(SpanContext.getInvalid())
|
||||
.setName("GET /api/endpoint")
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStartEpochNanos(12345)
|
||||
.setEndEpochNanos(12349)
|
||||
.setAttributes(
|
||||
|
|
|
|||
|
|
@ -15,8 +15,8 @@ import static io.opentelemetry.proto.trace.v1.Status.DeprecatedStatusCode.DEPREC
|
|||
|
||||
import com.google.protobuf.CodedOutputStream;
|
||||
import com.google.protobuf.UnknownFieldSet;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
|
||||
import io.opentelemetry.proto.trace.v1.InstrumentationLibrarySpans;
|
||||
|
|
@ -544,7 +544,7 @@ final class TraceMarshaler {
|
|||
return result;
|
||||
}
|
||||
|
||||
private static Span.SpanKind toProtoSpanKind(Kind kind) {
|
||||
private static Span.SpanKind toProtoSpanKind(SpanKind kind) {
|
||||
switch (kind) {
|
||||
case INTERNAL:
|
||||
return SPAN_KIND_INTERNAL;
|
||||
|
|
|
|||
|
|
@ -17,8 +17,8 @@ import io.grpc.Status.Code;
|
|||
import io.grpc.inprocess.InProcessChannelBuilder;
|
||||
import io.grpc.inprocess.InProcessServerBuilder;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
|
||||
|
|
@ -260,7 +260,7 @@ class OtlpGrpcSpanExporterTest {
|
|||
.setStartEpochNanos(startNs)
|
||||
.setEndEpochNanos(endNs)
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setLinks(Collections.emptyList())
|
||||
.setTotalRecordedLinks(0)
|
||||
.setTotalRecordedEvents(0)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import com.google.protobuf.CodedOutputStream;
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -78,7 +78,7 @@ class TraceMarshalerTest {
|
|||
Collections.singletonList(
|
||||
TestSpanData.builder()
|
||||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setKind(Span.Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setName("")
|
||||
.setStartEpochNanos(0)
|
||||
.setEndEpochNanos(0)
|
||||
|
|
@ -93,7 +93,7 @@ class TraceMarshalerTest {
|
|||
Collections.singletonList(
|
||||
TestSpanData.builder()
|
||||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setKind(Span.Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setName("")
|
||||
.setStartEpochNanos(0)
|
||||
.setEndEpochNanos(0)
|
||||
|
|
@ -109,7 +109,7 @@ class TraceMarshalerTest {
|
|||
TestSpanData.builder()
|
||||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setParentSpanContext(PARENT_SPAN_CONTEXT)
|
||||
.setKind(Span.Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setName("")
|
||||
.setStartEpochNanos(0)
|
||||
.setEndEpochNanos(0)
|
||||
|
|
@ -135,7 +135,7 @@ class TraceMarshalerTest {
|
|||
return TestSpanData.builder()
|
||||
.setInstrumentationLibraryInfo(instrumentationLibraryInfo)
|
||||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setKind(Span.Kind.INTERNAL)
|
||||
.setKind(SpanKind.INTERNAL)
|
||||
.setName("")
|
||||
.setStartEpochNanos(0)
|
||||
.setEndEpochNanos(0)
|
||||
|
|
@ -178,7 +178,7 @@ class TraceMarshalerTest {
|
|||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setParentSpanContext(SpanContext.getInvalid())
|
||||
.setName("GET /api/endpoint")
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStartEpochNanos(12345)
|
||||
.setEndEpochNanos(12349)
|
||||
.setAttributes(
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import com.linecorp.armeria.server.grpc.GrpcService;
|
|||
import com.linecorp.armeria.testing.junit5.server.SelfSignedCertificateExtension;
|
||||
import com.linecorp.armeria.testing.junit5.server.ServerExtension;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;
|
||||
import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc;
|
||||
|
|
@ -35,7 +35,7 @@ class ExportTest {
|
|||
Collections.singletonList(
|
||||
TestSpanData.builder()
|
||||
.setName("name")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStartEpochNanos(1)
|
||||
.setEndEpochNanos(2)
|
||||
.setStatus(StatusData.ok())
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import com.linecorp.armeria.server.grpc.GrpcService;
|
|||
import com.linecorp.armeria.testing.junit5.server.SelfSignedCertificateExtension;
|
||||
import com.linecorp.armeria.testing.junit5.server.ServerExtension;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;
|
||||
import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc;
|
||||
|
|
@ -69,7 +69,7 @@ class TlsExportTest {
|
|||
Arrays.asList(
|
||||
TestSpanData.builder()
|
||||
.setName("name")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStartEpochNanos(1)
|
||||
.setEndEpochNanos(2)
|
||||
.setStatus(StatusData.ok())
|
||||
|
|
@ -92,7 +92,7 @@ class TlsExportTest {
|
|||
Arrays.asList(
|
||||
TestSpanData.builder()
|
||||
.setName("name")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStartEpochNanos(1)
|
||||
.setEndEpochNanos(2)
|
||||
.setStatus(StatusData.ok())
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import com.linecorp.armeria.server.grpc.GrpcService;
|
|||
import com.linecorp.armeria.testing.junit5.server.SelfSignedCertificateExtension;
|
||||
import com.linecorp.armeria.testing.junit5.server.ServerExtension;
|
||||
import io.grpc.stub.StreamObserver;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceRequest;
|
||||
import io.opentelemetry.proto.collector.trace.v1.ExportTraceServiceResponse;
|
||||
import io.opentelemetry.proto.collector.trace.v1.TraceServiceGrpc;
|
||||
|
|
@ -34,7 +34,7 @@ class ExportTest {
|
|||
Collections.singletonList(
|
||||
TestSpanData.builder()
|
||||
.setName("name")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStartEpochNanos(1)
|
||||
.setEndEpochNanos(2)
|
||||
.setStatus(StatusData.ok())
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import static java.util.concurrent.TimeUnit.NANOSECONDS;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.AttributeType;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.sdk.common.CompletableResultCode;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
|
|
@ -156,19 +156,19 @@ public final class ZipkinSpanExporter implements SpanExporter {
|
|||
@Nullable
|
||||
private static Span.Kind toSpanKind(SpanData spanData) {
|
||||
// This is a hack because the Span API did not have SpanKind.
|
||||
if (spanData.getKind() == Kind.SERVER) {
|
||||
if (spanData.getKind() == SpanKind.SERVER) {
|
||||
return Span.Kind.SERVER;
|
||||
}
|
||||
|
||||
// This is a hack because the Span API did not have SpanKind.
|
||||
if (spanData.getKind() == Kind.CLIENT || spanData.getName().startsWith("Sent.")) {
|
||||
if (spanData.getKind() == SpanKind.CLIENT || spanData.getName().startsWith("Sent.")) {
|
||||
return Span.Kind.CLIENT;
|
||||
}
|
||||
|
||||
if (spanData.getKind() == Kind.PRODUCER) {
|
||||
if (spanData.getKind() == SpanKind.PRODUCER) {
|
||||
return Span.Kind.PRODUCER;
|
||||
}
|
||||
if (spanData.getKind() == Kind.CONSUMER) {
|
||||
if (spanData.getKind() == SpanKind.CONSUMER) {
|
||||
return Span.Kind.CONSUMER;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ package io.opentelemetry.exporter.zipkin;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.sdk.common.CompletableResultCode;
|
||||
|
|
@ -142,7 +142,7 @@ public class ZipkinSpanExporterEndToEndHttpTest {
|
|||
SpanContext.create(
|
||||
TRACE_ID, PARENT_SPAN_ID, TraceFlags.getDefault(), TraceState.getDefault()))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setName(SPAN_NAME)
|
||||
.setStartEpochNanos(START_EPOCH_NANOS)
|
||||
.setAttributes(attributes)
|
||||
|
|
|
|||
|
|
@ -20,8 +20,8 @@ import static org.mockito.Mockito.verify;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -97,7 +97,7 @@ class ZipkinSpanExporterTest {
|
|||
|
||||
@Test
|
||||
void generateSpan_ServerKind() {
|
||||
SpanData data = buildStandardSpan().setKind(Kind.SERVER).build();
|
||||
SpanData data = buildStandardSpan().setKind(SpanKind.SERVER).build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
.isEqualTo(
|
||||
|
|
@ -108,7 +108,7 @@ class ZipkinSpanExporterTest {
|
|||
|
||||
@Test
|
||||
void generateSpan_ClientKind() {
|
||||
SpanData data = buildStandardSpan().setKind(Kind.CLIENT).build();
|
||||
SpanData data = buildStandardSpan().setKind(SpanKind.CLIENT).build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
.isEqualTo(
|
||||
|
|
@ -119,7 +119,7 @@ class ZipkinSpanExporterTest {
|
|||
|
||||
@Test
|
||||
void generateSpan_InternalKind() {
|
||||
SpanData data = buildStandardSpan().setKind(Kind.INTERNAL).build();
|
||||
SpanData data = buildStandardSpan().setKind(SpanKind.INTERNAL).build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
.isEqualTo(
|
||||
|
|
@ -130,7 +130,7 @@ class ZipkinSpanExporterTest {
|
|||
|
||||
@Test
|
||||
void generateSpan_ConsumeKind() {
|
||||
SpanData data = buildStandardSpan().setKind(Kind.CONSUMER).build();
|
||||
SpanData data = buildStandardSpan().setKind(SpanKind.CONSUMER).build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
.isEqualTo(
|
||||
|
|
@ -141,7 +141,7 @@ class ZipkinSpanExporterTest {
|
|||
|
||||
@Test
|
||||
void generateSpan_ProducerKind() {
|
||||
SpanData data = buildStandardSpan().setKind(Kind.PRODUCER).build();
|
||||
SpanData data = buildStandardSpan().setKind(SpanKind.PRODUCER).build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
.isEqualTo(
|
||||
|
|
@ -182,7 +182,7 @@ class ZipkinSpanExporterTest {
|
|||
.put(doubleArrayKey("doubleArray"), Arrays.asList(32.33d, -98.3d))
|
||||
.put(longArrayKey("longArray"), Arrays.asList(33L, 999L))
|
||||
.build();
|
||||
SpanData data = buildStandardSpan().setAttributes(attributes).setKind(Kind.CLIENT).build();
|
||||
SpanData data = buildStandardSpan().setAttributes(attributes).setKind(SpanKind.CLIENT).build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
.isEqualTo(
|
||||
|
|
@ -205,7 +205,7 @@ class ZipkinSpanExporterTest {
|
|||
buildStandardSpan()
|
||||
.setInstrumentationLibraryInfo(
|
||||
InstrumentationLibraryInfo.create("io.opentelemetry.auto", "1.0.0"))
|
||||
.setKind(Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.build();
|
||||
|
||||
assertThat(exporter.generateSpan(data))
|
||||
|
|
@ -225,7 +225,7 @@ class ZipkinSpanExporterTest {
|
|||
SpanData data =
|
||||
buildStandardSpan()
|
||||
.setAttributes(attributeMap)
|
||||
.setKind(Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStatus(StatusData.error())
|
||||
.build();
|
||||
|
||||
|
|
@ -374,7 +374,7 @@ class ZipkinSpanExporterTest {
|
|||
Resource.create(
|
||||
Attributes.builder().put(ResourceAttributes.SERVICE_NAME, "tweetiebird").build()))
|
||||
.setStatus(StatusData.ok())
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setName("Recv.helloworld.Greeter.SayHello")
|
||||
.setStartEpochNanos(1505855794_194009601L)
|
||||
.setEndEpochNanos(1505855799_465726528L)
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
package io.opentelemetry.extension.annotations;
|
||||
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
|
@ -36,6 +36,6 @@ public @interface WithSpan {
|
|||
*/
|
||||
String value() default "";
|
||||
|
||||
/** Specify the {@link Kind} of span to be created. Defaults to {@link Kind#INTERNAL}. */
|
||||
Kind kind() default Kind.INTERNAL;
|
||||
/** Specify the {@link SpanKind} of span to be created. Defaults to {@link SpanKind#INTERNAL}. */
|
||||
SpanKind kind() default SpanKind.INTERNAL;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.extension.annotations;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
|
||||
/**
|
||||
* This class is not a classical test. It's just a demonstration of possible usages of {@link
|
||||
|
|
@ -29,9 +29,9 @@ public class WithSpanUsageExamples {
|
|||
public void method2() {}
|
||||
|
||||
/**
|
||||
* A {@link Span} with the default name, and a {@link Kind} of {@link Kind#CONSUMER} will be
|
||||
* created for this method.
|
||||
* A {@link Span} with the default name, and a {@link SpanKind} of {@link SpanKind#CONSUMER} will
|
||||
* be created for this method.
|
||||
*/
|
||||
@WithSpan(kind = Kind.CONSUMER)
|
||||
@WithSpan(kind = SpanKind.CONSUMER)
|
||||
public void consume() {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ import io.opencensus.trace.Tracestate;
|
|||
import io.opencensus.trace.config.TraceConfig;
|
||||
import io.opencensus.trace.config.TraceParams;
|
||||
import io.opentelemetry.api.GlobalOpenTelemetry;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Context;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -63,7 +64,7 @@ class OpenTelemetrySpanBuilderImpl extends SpanBuilder {
|
|||
@Nullable private final Span ocParent;
|
||||
@Nullable private final SpanContext ocRemoteParentSpanContext;
|
||||
@Nullable private Sampler ocSampler;
|
||||
@Nullable private io.opentelemetry.api.trace.Span.Kind otelKind;
|
||||
@Nullable private SpanKind otelKind;
|
||||
|
||||
@Override
|
||||
public SpanBuilder setSampler(Sampler sampler) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ import io.opencensus.trace.TraceId;
|
|||
import io.opencensus.trace.TraceOptions;
|
||||
import io.opencensus.trace.Tracestate;
|
||||
import io.opentelemetry.api.common.AttributesBuilder;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.api.trace.TraceStateBuilder;
|
||||
|
|
@ -28,17 +28,17 @@ class SpanConverter {
|
|||
|
||||
private SpanConverter() {}
|
||||
|
||||
static Kind mapKind(@Nullable io.opencensus.trace.Span.Kind ocKind) {
|
||||
static SpanKind mapKind(@Nullable io.opencensus.trace.Span.Kind ocKind) {
|
||||
if (ocKind == null) {
|
||||
return Kind.INTERNAL;
|
||||
return SpanKind.INTERNAL;
|
||||
}
|
||||
switch (ocKind) {
|
||||
case CLIENT:
|
||||
return Kind.CLIENT;
|
||||
return SpanKind.CLIENT;
|
||||
case SERVER:
|
||||
return Kind.SERVER;
|
||||
return SpanKind.SERVER;
|
||||
}
|
||||
return Kind.INTERNAL;
|
||||
return SpanKind.INTERNAL;
|
||||
}
|
||||
|
||||
static Span fromOtelSpan(io.opentelemetry.api.trace.Span otSpan) {
|
||||
|
|
|
|||
|
|
@ -44,6 +44,7 @@ import io.opentelemetry.api.OpenTelemetry;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -238,7 +239,7 @@ class InteroperabilityTest {
|
|||
assertThat(spanData3.getName()).isEqualTo("OpenCensusSpan");
|
||||
assertThat(spanData3.getLinks().get(0).getSpanContext().getSpanIdAsHexString())
|
||||
.isEqualTo(parentLinkSpan.getContext().getSpanId().toLowerBase16());
|
||||
assertThat(spanData3.getKind()).isEqualTo(Span.Kind.SERVER);
|
||||
assertThat(spanData3.getKind()).isEqualTo(SpanKind.SERVER);
|
||||
assertThat(spanData3.getStatus()).isEqualTo(StatusData.ok());
|
||||
assertThat(spanData3.getAttributes().get(AttributeKey.doubleKey("testKey"))).isEqualTo(2.5);
|
||||
assertThat(spanData3.getAttributes().get(AttributeKey.booleanKey("testKey2"))).isEqualTo(false);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
|||
|
||||
import io.opentelemetry.api.baggage.Baggage;
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentracing.Span;
|
||||
|
|
@ -38,7 +38,7 @@ final class SpanBuilderShim extends BaseShimObject implements SpanBuilder {
|
|||
private final List<AttributeKey> spanBuilderAttributeKeys = new ArrayList<>();
|
||||
|
||||
private final List<Object> spanBuilderAttributeValues = new ArrayList<>();
|
||||
private Kind spanKind;
|
||||
private SpanKind spanKind;
|
||||
private boolean error;
|
||||
|
||||
public SpanBuilderShim(TelemetryInfo telemetryInfo, String spanName) {
|
||||
|
|
@ -98,19 +98,19 @@ final class SpanBuilderShim extends BaseShimObject implements SpanBuilder {
|
|||
if (Tags.SPAN_KIND.getKey().equals(key)) {
|
||||
switch (value) {
|
||||
case Tags.SPAN_KIND_CLIENT:
|
||||
spanKind = Kind.CLIENT;
|
||||
spanKind = SpanKind.CLIENT;
|
||||
break;
|
||||
case Tags.SPAN_KIND_SERVER:
|
||||
spanKind = Kind.SERVER;
|
||||
spanKind = SpanKind.SERVER;
|
||||
break;
|
||||
case Tags.SPAN_KIND_PRODUCER:
|
||||
spanKind = Kind.PRODUCER;
|
||||
spanKind = SpanKind.PRODUCER;
|
||||
break;
|
||||
case Tags.SPAN_KIND_CONSUMER:
|
||||
spanKind = Kind.CONSUMER;
|
||||
spanKind = SpanKind.CONSUMER;
|
||||
break;
|
||||
default:
|
||||
spanKind = Kind.INTERNAL;
|
||||
spanKind = SpanKind.INTERNAL;
|
||||
break;
|
||||
}
|
||||
} else if (Tags.ERROR.getKey().equals(key)) {
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.opentracingshim.testbed;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -43,7 +43,7 @@ public final class TestUtils {
|
|||
}
|
||||
|
||||
/** Returns a {@code List} with the {@code Span} matching the specified kind. */
|
||||
public static List<SpanData> getByKind(List<SpanData> spans, final Kind kind) {
|
||||
public static List<SpanData> getByKind(List<SpanData> spans, final SpanKind kind) {
|
||||
return getByCondition(spans, span -> span.getKind() == kind);
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ public final class TestUtils {
|
|||
* instance being matched, an {@code IllegalArgumentException} will be thrown.
|
||||
*/
|
||||
@Nullable
|
||||
public static SpanData getOneByKind(List<SpanData> spans, final Kind kind) {
|
||||
public static SpanData getOneByKind(List<SpanData> spans, final SpanKind kind) {
|
||||
|
||||
List<SpanData> found = getByKind(spans, kind);
|
||||
if (found.size() > 1) {
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ import static io.opentelemetry.opentracingshim.testbed.TestUtils.getByKind;
|
|||
import static io.opentelemetry.opentracingshim.testbed.TestUtils.getOneByKind;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.opentracingshim.OpenTracingShim;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
|
@ -69,14 +69,14 @@ class ActorPropagationTest {
|
|||
phaser.arriveAndAwaitAdvance(); // continue...
|
||||
phaser.arriveAndAwaitAdvance(); // child tracer finished
|
||||
assertThat(otelTesting.getSpans().size()).isEqualTo(3);
|
||||
assertThat(getByKind(otelTesting.getSpans(), Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(getByKind(otelTesting.getSpans(), SpanKind.CONSUMER)).hasSize(2);
|
||||
phaser.arriveAndDeregister(); // continue...
|
||||
|
||||
List<SpanData> finished = otelTesting.getSpans();
|
||||
assertThat(finished.size()).isEqualTo(3);
|
||||
assertThat(finished.get(0).getTraceId()).isEqualTo(finished.get(1).getTraceId());
|
||||
assertThat(getByKind(finished, Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(getOneByKind(finished, Kind.PRODUCER)).isNotNull();
|
||||
assertThat(getByKind(finished, SpanKind.CONSUMER)).hasSize(2);
|
||||
assertThat(getOneByKind(finished, SpanKind.PRODUCER)).isNotNull();
|
||||
|
||||
assertThat(tracer.scopeManager().activeSpan()).isNull();
|
||||
}
|
||||
|
|
@ -105,7 +105,7 @@ class ActorPropagationTest {
|
|||
phaser.arriveAndAwaitAdvance(); // continue...
|
||||
phaser.arriveAndAwaitAdvance(); // child tracer finished
|
||||
assertThat(otelTesting.getSpans().size()).isEqualTo(3);
|
||||
assertThat(getByKind(otelTesting.getSpans(), Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(getByKind(otelTesting.getSpans(), SpanKind.CONSUMER)).hasSize(2);
|
||||
phaser.arriveAndDeregister(); // continue...
|
||||
|
||||
List<SpanData> finished = otelTesting.getSpans();
|
||||
|
|
@ -116,8 +116,8 @@ class ActorPropagationTest {
|
|||
|
||||
assertThat(finished.size()).isEqualTo(3);
|
||||
assertThat(finished.get(0).getTraceId()).isEqualTo(finished.get(1).getTraceId());
|
||||
assertThat(getByKind(finished, Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(getOneByKind(finished, Kind.PRODUCER)).isNotNull();
|
||||
assertThat(getByKind(finished, SpanKind.CONSUMER)).hasSize(2);
|
||||
assertThat(getOneByKind(finished, SpanKind.PRODUCER)).isNotNull();
|
||||
|
||||
assertThat(tracer.scopeManager().activeSpan()).isNull();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import static org.assertj.core.api.Assertions.fail;
|
|||
import static org.awaitility.Awaitility.await;
|
||||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.opentracingshim.OpenTracingShim;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
|
@ -65,13 +65,13 @@ class TestClientServerTest {
|
|||
assertThat(finished).hasSize(2);
|
||||
|
||||
assertThat(finished.get(1).getTraceId()).isEqualTo(finished.get(0).getTraceId());
|
||||
Kind firstSpanKind = finished.get(0).getKind();
|
||||
SpanKind firstSpanKind = finished.get(0).getKind();
|
||||
switch (firstSpanKind) {
|
||||
case CLIENT:
|
||||
assertThat(finished.get(1).getKind()).isEqualTo(Kind.SERVER);
|
||||
assertThat(finished.get(1).getKind()).isEqualTo(SpanKind.SERVER);
|
||||
break;
|
||||
case SERVER:
|
||||
assertThat(finished.get(1).getKind()).isEqualTo(Kind.CLIENT);
|
||||
assertThat(finished.get(1).getKind()).isEqualTo(SpanKind.CLIENT);
|
||||
break;
|
||||
default:
|
||||
fail("Unexpected first span kind: " + firstSpanKind);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import static io.opentelemetry.opentracingshim.testbed.TestUtils.getOneByName;
|
|||
import static io.opentelemetry.opentracingshim.testbed.TestUtils.sortByStartTime;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.opentracingshim.OpenTracingShim;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
|
@ -47,7 +47,7 @@ class HandlerTest {
|
|||
assertThat(finished).hasSize(2);
|
||||
|
||||
for (SpanData spanData : finished) {
|
||||
assertThat(spanData.getKind()).isEqualTo(Kind.CLIENT);
|
||||
assertThat(spanData.getKind()).isEqualTo(SpanKind.CLIENT);
|
||||
}
|
||||
|
||||
assertThat(finished.get(1).getTraceId()).isNotEqualTo(finished.get(0).getTraceId());
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
package io.opentelemetry.opentracingshim.testbed.listenerperrequest;
|
||||
|
||||
import static io.opentelemetry.api.trace.Span.Kind.CLIENT;
|
||||
import static io.opentelemetry.api.trace.SpanKind.CLIENT;
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.opentracingshim.OpenTracingShim;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.sdk.extension.trace.jaeger.sampler;
|
|||
|
||||
import io.grpc.ManagedChannel;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.extension.trace.jaeger.proto.api_v2.Sampling.PerOperationSamplingStrategies;
|
||||
import io.opentelemetry.sdk.extension.trace.jaeger.proto.api_v2.Sampling.SamplingStrategyParameters;
|
||||
|
|
@ -54,7 +54,7 @@ public final class JaegerRemoteSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return sampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.extension.trace.jaeger.sampler;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.extension.trace.jaeger.proto.api_v2.Sampling.OperationSamplingStrategy;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -39,7 +39,7 @@ class PerOperationSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
Sampler sampler = this.perOperationSampler.get(name);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.internal.SystemClock;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -54,7 +54,7 @@ class RateLimitingSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import io.opentelemetry.api.common.Attributes;
|
|||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -23,7 +24,7 @@ import org.junit.jupiter.api.Test;
|
|||
class RateLimitingSamplerTest {
|
||||
|
||||
private static final String SPAN_NAME = "MySpanName";
|
||||
private static final Span.Kind SPAN_KIND = Span.Kind.INTERNAL;
|
||||
private static final SpanKind SPAN_KIND = SpanKind.INTERNAL;
|
||||
private final String traceId = TraceId.fromLongs(150, 150);
|
||||
private final String parentSpanId = SpanId.fromLong(250);
|
||||
private final TraceState traceState = TraceState.builder().build();
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ import static io.opentelemetry.proto.trace.v1.Status.DeprecatedStatusCode.DEPREC
|
|||
|
||||
import com.google.protobuf.ByteString;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.proto.trace.v1.InstrumentationLibrarySpans;
|
||||
import io.opentelemetry.proto.trace.v1.ResourceSpans;
|
||||
|
|
@ -114,7 +114,7 @@ public final class SpanAdapter {
|
|||
return builder.build();
|
||||
}
|
||||
|
||||
static Span.SpanKind toProtoSpanKind(Kind kind) {
|
||||
static Span.SpanKind toProtoSpanKind(SpanKind kind) {
|
||||
switch (kind) {
|
||||
case INTERNAL:
|
||||
return SPAN_KIND_INTERNAL;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import com.google.protobuf.ByteString;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
|
|
@ -59,7 +59,7 @@ class SpanAdapterTest {
|
|||
.setSpanContext(SPAN_CONTEXT)
|
||||
.setParentSpanContext(SpanContext.getInvalid())
|
||||
.setName("GET /api/endpoint")
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStartEpochNanos(12345)
|
||||
.setEndEpochNanos(12349)
|
||||
.setAttributes(Attributes.of(booleanKey("key"), true))
|
||||
|
|
@ -103,11 +103,11 @@ class SpanAdapterTest {
|
|||
|
||||
@Test
|
||||
void toProtoSpanKind() {
|
||||
assertThat(SpanAdapter.toProtoSpanKind(Kind.INTERNAL)).isEqualTo(SPAN_KIND_INTERNAL);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(Kind.CLIENT)).isEqualTo(SPAN_KIND_CLIENT);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(Kind.SERVER)).isEqualTo(SPAN_KIND_SERVER);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(Kind.PRODUCER)).isEqualTo(SPAN_KIND_PRODUCER);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(Kind.CONSUMER)).isEqualTo(SPAN_KIND_CONSUMER);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(SpanKind.INTERNAL)).isEqualTo(SPAN_KIND_INTERNAL);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(SpanKind.CLIENT)).isEqualTo(SPAN_KIND_CLIENT);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(SpanKind.SERVER)).isEqualTo(SPAN_KIND_SERVER);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(SpanKind.PRODUCER)).isEqualTo(SPAN_KIND_PRODUCER);
|
||||
assertThat(SpanAdapter.toProtoSpanKind(SpanKind.CONSUMER)).isEqualTo(SPAN_KIND_CONSUMER);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ package io.opentelemetry.sdk.extension.incubator.trace.data;
|
|||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
|
|
@ -80,7 +80,7 @@ public abstract class DelegatingSpanData implements SpanData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Kind getKind() {
|
||||
public SpanKind getKind() {
|
||||
return delegate.getKind();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ package io.opentelemetry.sdk.extension.incubator.trace.data;
|
|||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
|
|
@ -140,7 +140,7 @@ public abstract class SpanDataBuilder implements SpanData {
|
|||
|
||||
public abstract Builder setStatus(StatusData status);
|
||||
|
||||
public abstract Builder setKind(Kind kind);
|
||||
public abstract Builder setKind(SpanKind kind);
|
||||
|
||||
public abstract Builder setLinks(List<LinkData> links);
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ import com.google.common.testing.EqualsTester;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.common.AttributesBuilder;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.testing.trace.TestSpanData;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import io.opentelemetry.sdk.trace.data.StatusData;
|
||||
|
|
@ -108,7 +108,7 @@ class DelegatingSpanDataTest {
|
|||
.setName("spanName")
|
||||
.setStartEpochNanos(100)
|
||||
.setEndEpochNanos(200)
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.ok())
|
||||
.setTotalRecordedEvents(0)
|
||||
.setTotalRecordedLinks(0);
|
||||
|
|
|
|||
|
|
@ -9,8 +9,8 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import com.google.common.testing.EqualsTester;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -33,7 +33,7 @@ class SpanDataBuilderTest {
|
|||
.setName("GET /api/endpoint")
|
||||
.setStartEpochNanos(0)
|
||||
.setEndEpochNanos(100)
|
||||
.setKind(Span.Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.error())
|
||||
.setAttributes(Attributes.builder().put("cat", "meow").put("dog", "bark").build())
|
||||
.setTotalRecordedEvents(1000)
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.extension.zpages;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.trace.config.TraceConfig;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -47,7 +47,7 @@ final class TracezTraceConfigSupplier implements Supplier<TraceConfig>, Sampler
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Span.Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return sampler.shouldSample(parentContext, traceId, name, spanKind, attributes, parentLinks);
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.sdk.testing.assertj;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
|
|
@ -155,7 +155,7 @@ public class SpanDataAssert extends AbstractAssert<SpanDataAssert, SpanData> {
|
|||
}
|
||||
|
||||
/** Asserts the span has the given kind. */
|
||||
public SpanDataAssert hasKind(Span.Kind kind) {
|
||||
public SpanDataAssert hasKind(SpanKind kind) {
|
||||
isNotNull();
|
||||
if (!actual.getKind().equals(kind)) {
|
||||
failWithActualExpectedAndMessage(
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ package io.opentelemetry.sdk.testing.trace;
|
|||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
|
|
@ -166,7 +166,7 @@ public abstract class TestSpanData implements SpanData {
|
|||
* @param kind The Kind of span.
|
||||
* @return this
|
||||
*/
|
||||
public abstract Builder setKind(Kind kind);
|
||||
public abstract Builder setKind(SpanKind kind);
|
||||
|
||||
/**
|
||||
* Set the links associated with this span. Must not be null, may be empty.
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|||
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -77,7 +77,7 @@ class OpenTelemetryAssertionsTest {
|
|||
.setResource(RESOURCE)
|
||||
.setInstrumentationLibraryInfo(INSTRUMENTATION_LIBRARY_INFO)
|
||||
.setName("span")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStartEpochNanos(100)
|
||||
.setAttributes(ATTRIBUTES)
|
||||
.setEvents(EVENTS)
|
||||
|
|
@ -114,7 +114,7 @@ class OpenTelemetryAssertionsTest {
|
|||
.hasResource(RESOURCE)
|
||||
.hasInstrumentationLibraryInfo(INSTRUMENTATION_LIBRARY_INFO)
|
||||
.hasName("span")
|
||||
.hasKind(Span.Kind.CLIENT)
|
||||
.hasKind(SpanKind.CLIENT)
|
||||
.startsAt(100)
|
||||
.startsAt(100, TimeUnit.NANOSECONDS)
|
||||
.startsAt(Instant.ofEpochSecond(0, 100))
|
||||
|
|
@ -169,7 +169,7 @@ class OpenTelemetryAssertionsTest {
|
|||
.hasInstrumentationLibraryInfo(InstrumentationLibraryInfo.getEmpty()))
|
||||
.isInstanceOf(AssertionError.class);
|
||||
assertThatThrownBy(() -> assertThat(SPAN1).hasName("foo")).isInstanceOf(AssertionError.class);
|
||||
assertThatThrownBy(() -> assertThat(SPAN1).hasKind(Span.Kind.SERVER))
|
||||
assertThatThrownBy(() -> assertThat(SPAN1).hasKind(SpanKind.SERVER))
|
||||
.isInstanceOf(AssertionError.class);
|
||||
assertThatThrownBy(() -> assertThat(SPAN1).startsAt(10)).isInstanceOf(AssertionError.class);
|
||||
assertThatThrownBy(() -> assertThat(SPAN1).startsAt(10, TimeUnit.NANOSECONDS))
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.sdk.testing.exporter;
|
|||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.sdk.testing.trace.TestSpanData;
|
||||
import io.opentelemetry.sdk.trace.SdkTracerProvider;
|
||||
|
|
@ -97,7 +97,7 @@ class InMemorySpanExporterTest {
|
|||
return TestSpanData.builder()
|
||||
.setHasEnded(true)
|
||||
.setName("span")
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStartEpochNanos(100_000_000_100L)
|
||||
.setStatus(StatusData.ok())
|
||||
.setEndEpochNanos(200_000_000_200L)
|
||||
|
|
|
|||
|
|
@ -10,9 +10,9 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -109,7 +109,7 @@ class TestSpanDataTest {
|
|||
.setName("spanName")
|
||||
.setStartEpochNanos(START_EPOCH_NANOS)
|
||||
.setEndEpochNanos(END_EPOCH_NANOS)
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStatus(StatusData.ok())
|
||||
.setTotalRecordedEvents(0)
|
||||
.setTotalRecordedLinks(0);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
package io.opentelemetry.sdk.trace;
|
||||
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.sdk.trace.config.TraceConfig;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
|
@ -44,7 +44,7 @@ public class SpanAttributeTruncateBenchmark {
|
|||
(SdkSpanBuilder)
|
||||
tracer
|
||||
.spanBuilder("benchmarkSpan")
|
||||
.setSpanKind(Kind.CLIENT)
|
||||
.setSpanKind(SpanKind.CLIENT)
|
||||
.setAttribute("key", "value");
|
||||
|
||||
String seed = "0123456789";
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
package io.opentelemetry.sdk.trace.export;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -78,7 +78,7 @@ public class MultiSpanExporterBenchmark {
|
|||
TraceFlags.getSampled(),
|
||||
TraceState.getDefault()))
|
||||
.setName("noop")
|
||||
.setKind(Span.Kind.CLIENT)
|
||||
.setKind(SpanKind.CLIENT)
|
||||
.setStartEpochNanos(1)
|
||||
.setStatus(StatusData.ok())
|
||||
.setEndEpochNanos(2)
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ package io.opentelemetry.sdk.trace;
|
|||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
||||
|
|
@ -68,5 +69,5 @@ public interface ReadableSpan {
|
|||
*
|
||||
* @return the kind of the span.
|
||||
*/
|
||||
Span.Kind getKind();
|
||||
SpanKind getKind();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import io.opentelemetry.api.common.Attributes;
|
|||
import io.opentelemetry.api.common.AttributesBuilder;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.common.Clock;
|
||||
|
|
@ -55,7 +56,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
|||
// Number of links recorded.
|
||||
private final int totalRecordedLinks;
|
||||
// The kind of the span.
|
||||
private final Kind kind;
|
||||
private final SpanKind kind;
|
||||
// The clock used to get the time.
|
||||
private final Clock clock;
|
||||
// The resource associated with this span.
|
||||
|
|
@ -94,7 +95,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
|||
SpanContext context,
|
||||
String name,
|
||||
InstrumentationLibraryInfo instrumentationLibraryInfo,
|
||||
Kind kind,
|
||||
SpanKind kind,
|
||||
SpanContext parentSpanContext,
|
||||
TraceConfig traceConfig,
|
||||
SpanProcessor spanProcessor,
|
||||
|
|
@ -141,7 +142,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
|||
SpanContext context,
|
||||
String name,
|
||||
InstrumentationLibraryInfo instrumentationLibraryInfo,
|
||||
Kind kind,
|
||||
SpanKind kind,
|
||||
@Nullable SpanContext parentSpanContext,
|
||||
@Nonnull Context parentContext,
|
||||
TraceConfig traceConfig,
|
||||
|
|
@ -463,7 +464,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Kind getKind() {
|
||||
public SpanKind getKind() {
|
||||
return kind;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@ import io.opentelemetry.api.common.AttributeKey;
|
|||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.internal.Utils;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanBuilder;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -43,7 +43,7 @@ final class SdkSpanBuilder implements SpanBuilder {
|
|||
private final TraceConfig traceConfig;
|
||||
|
||||
@Nullable private Context parent;
|
||||
private Kind spanKind = Kind.INTERNAL;
|
||||
private SpanKind spanKind = SpanKind.INTERNAL;
|
||||
@Nullable private AttributesMap attributes;
|
||||
@Nullable private List<LinkData> links;
|
||||
private int totalNumberOfLinksAdded = 0;
|
||||
|
|
@ -77,7 +77,7 @@ final class SdkSpanBuilder implements SpanBuilder {
|
|||
}
|
||||
|
||||
@Override
|
||||
public SpanBuilder setSpanKind(Kind spanKind) {
|
||||
public SpanBuilder setSpanKind(SpanKind spanKind) {
|
||||
this.spanKind = Objects.requireNonNull(spanKind, "spanKind");
|
||||
return this;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ package io.opentelemetry.sdk.trace;
|
|||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
import io.opentelemetry.sdk.trace.data.EventData;
|
||||
|
|
@ -105,7 +105,7 @@ abstract class SpanWrapper implements SpanData {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Kind getKind() {
|
||||
public SpanKind getKind() {
|
||||
return delegate().getKind();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
package io.opentelemetry.sdk.trace.data;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||
import io.opentelemetry.sdk.resources.Resource;
|
||||
|
|
@ -100,7 +100,7 @@ public interface SpanData {
|
|||
*
|
||||
* @return the kind of this {@code Span}.
|
||||
*/
|
||||
Kind getKind();
|
||||
SpanKind getKind();
|
||||
|
||||
/**
|
||||
* Returns the start epoch timestamp in nanos of this {@code Span}.
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.samplers;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
import java.util.List;
|
||||
|
|
@ -22,7 +22,7 @@ enum AlwaysOffSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return ImmutableSamplingResult.EMPTY_NOT_SAMPLED_OR_RECORDED_SAMPLING_RESULT;
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.samplers;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
import java.util.List;
|
||||
|
|
@ -22,7 +22,7 @@ enum AlwaysOnSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return ImmutableSamplingResult.EMPTY_RECORDED_AND_SAMPLED_SAMPLING_RESULT;
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ package io.opentelemetry.sdk.trace.samplers;
|
|||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
import java.util.List;
|
||||
|
|
@ -53,7 +53,7 @@ final class ParentBasedSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
SpanContext parentSpanContext = Span.fromContext(parentContext).getSpanContext();
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@ package io.opentelemetry.sdk.trace.samplers;
|
|||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -87,7 +87,7 @@ public interface Sampler {
|
|||
* @param traceId the {@link TraceId} for the new {@code Span}. This will be identical to that in
|
||||
* the parentContext, unless this is a root span.
|
||||
* @param name the name of the new {@code Span}.
|
||||
* @param spanKind the {@link Kind} of the {@code Span}.
|
||||
* @param spanKind the {@link SpanKind} of the {@code Span}.
|
||||
* @param attributes {@link Attributes} associated with the span.
|
||||
* @param parentLinks the parentLinks associated with the new {@code Span}.
|
||||
* @return sampling samplingResult whether span should be sampled or not.
|
||||
|
|
@ -96,7 +96,7 @@ public interface Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks);
|
||||
|
||||
|
|
|
|||
|
|
@ -8,15 +8,15 @@ package io.opentelemetry.sdk.trace.samplers;
|
|||
import static java.util.Objects.requireNonNull;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.context.Context;
|
||||
import java.util.List;
|
||||
import javax.annotation.concurrent.Immutable;
|
||||
|
||||
/**
|
||||
* Sampling result returned by {@link Sampler#shouldSample(Context, String, String, Span.Kind,
|
||||
* Sampling result returned by {@link Sampler#shouldSample(Context, String, String, SpanKind,
|
||||
* Attributes, List)}.
|
||||
*/
|
||||
@Immutable
|
||||
|
|
@ -90,7 +90,7 @@ public interface SamplingResult {
|
|||
* @param parentTraceState The TraceState from the parent span. Might be an empty TraceState, if
|
||||
* there is no parent. This will be the same TraceState that was passed in via the {@link
|
||||
* SpanContext} parameter on the {@link Sampler#shouldSample(Context, String, String,
|
||||
* Span.Kind, Attributes, List)} call.
|
||||
* SpanKind, Attributes, List)} call.
|
||||
*/
|
||||
default TraceState getUpdatedTraceState(TraceState parentTraceState) {
|
||||
return parentTraceState;
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ package io.opentelemetry.sdk.trace.samplers;
|
|||
|
||||
import com.google.auto.value.AutoValue;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.sdk.trace.data.LinkData;
|
||||
|
|
@ -63,7 +63,7 @@ abstract class TraceIdRatioBasedSampler implements Sampler {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
// Always sample if we are within probability range. This is true even for child spans (that
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -20,7 +21,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
class ParentBasedSamplerTest {
|
||||
private static final String SPAN_NAME = "MySpanName";
|
||||
private static final Span.Kind SPAN_KIND = Span.Kind.INTERNAL;
|
||||
private static final SpanKind SPAN_KIND = SpanKind.INTERNAL;
|
||||
private final IdGenerator idsGenerator = IdGenerator.random();
|
||||
private final String traceId = idsGenerator.generateTraceId();
|
||||
private final String parentSpanId = idsGenerator.generateSpanId();
|
||||
|
|
|
|||
|
|
@ -19,9 +19,9 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.common.AttributesBuilder;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -97,7 +97,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void nothingChangedAfterEnd() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
span.end();
|
||||
// Check that adding trace events or update fields after Span#end() does not throw any thrown
|
||||
// and are ignored.
|
||||
|
|
@ -117,7 +117,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void endSpanTwice_DoNotCrash() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
assertThat(span.hasEnded()).isFalse();
|
||||
span.end();
|
||||
assertThat(span.hasEnded()).isTrue();
|
||||
|
|
@ -127,7 +127,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void toSpanData_ActiveSpan() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
try {
|
||||
assertThat(span.hasEnded()).isFalse();
|
||||
spanDoWork(span, null, null);
|
||||
|
|
@ -155,7 +155,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void toSpanData_EndedSpan() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
try {
|
||||
spanDoWork(span, StatusCode.ERROR, "CANCELLED");
|
||||
} finally {
|
||||
|
|
@ -179,7 +179,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void toSpanData_immutableLinks() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
SpanData spanData = span.toSpanData();
|
||||
|
||||
assertThatThrownBy(() -> spanData.getLinks().add(LinkData.create(SpanContext.getInvalid())))
|
||||
|
|
@ -188,7 +188,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void toSpanData_immutableEvents() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
SpanData spanData = span.toSpanData();
|
||||
|
||||
assertThatThrownBy(
|
||||
|
|
@ -254,7 +254,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void setStatus() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.CONSUMER);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.CONSUMER);
|
||||
try {
|
||||
testClock.advanceMillis(MILLIS_PER_SECOND);
|
||||
assertThat(span.toSpanData().getStatus()).isEqualTo(StatusData.unset());
|
||||
|
|
@ -270,9 +270,9 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void getSpanKind() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.SERVER);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.SERVER);
|
||||
try {
|
||||
assertThat(span.toSpanData().getKind()).isEqualTo(Kind.SERVER);
|
||||
assertThat(span.toSpanData().getKind()).isEqualTo(SpanKind.SERVER);
|
||||
} finally {
|
||||
span.end();
|
||||
}
|
||||
|
|
@ -280,7 +280,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void getInstrumentationLibraryInfo() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.CLIENT);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.CLIENT);
|
||||
try {
|
||||
assertThat(span.getInstrumentationLibraryInfo()).isEqualTo(instrumentationLibraryInfo);
|
||||
} finally {
|
||||
|
|
@ -302,7 +302,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void getLatencyNs_ActiveSpan() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
try {
|
||||
testClock.advanceMillis(MILLIS_PER_SECOND);
|
||||
long elapsedTimeNanos1 = testClock.now() - START_EPOCH_NANOS;
|
||||
|
|
@ -317,7 +317,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void getLatencyNs_EndedSpan() {
|
||||
RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
testClock.advanceMillis(MILLIS_PER_SECOND);
|
||||
span.end();
|
||||
long elapsedTimeNanos = testClock.now() - START_EPOCH_NANOS;
|
||||
|
|
@ -756,7 +756,7 @@ class RecordEventsReadableSpanTest {
|
|||
new AttributesMap(TraceConfig.getDefault().getMaxNumberOfAttributes());
|
||||
attributes.forEach(attributesMap::put);
|
||||
return createTestSpan(
|
||||
Kind.INTERNAL,
|
||||
SpanKind.INTERNAL,
|
||||
TraceConfig.getDefault(),
|
||||
null,
|
||||
attributesMap,
|
||||
|
|
@ -765,25 +765,25 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
private RecordEventsReadableSpan createTestRootSpan() {
|
||||
return createTestSpan(
|
||||
Kind.INTERNAL,
|
||||
SpanKind.INTERNAL,
|
||||
TraceConfig.getDefault(),
|
||||
SpanId.getInvalid(),
|
||||
null,
|
||||
Collections.singletonList(link));
|
||||
}
|
||||
|
||||
private RecordEventsReadableSpan createTestSpan(Kind kind) {
|
||||
private RecordEventsReadableSpan createTestSpan(SpanKind kind) {
|
||||
return createTestSpan(
|
||||
kind, TraceConfig.getDefault(), parentSpanId, null, Collections.singletonList(link));
|
||||
}
|
||||
|
||||
private RecordEventsReadableSpan createTestSpan(TraceConfig config) {
|
||||
return createTestSpan(
|
||||
Kind.INTERNAL, config, parentSpanId, null, Collections.singletonList(link));
|
||||
SpanKind.INTERNAL, config, parentSpanId, null, Collections.singletonList(link));
|
||||
}
|
||||
|
||||
private RecordEventsReadableSpan createTestSpan(
|
||||
Kind kind,
|
||||
SpanKind kind,
|
||||
TraceConfig config,
|
||||
@Nullable String parentSpanId,
|
||||
@Nullable AttributesMap attributes,
|
||||
|
|
@ -860,7 +860,7 @@ class RecordEventsReadableSpanTest {
|
|||
@Test
|
||||
void testAsSpanData() {
|
||||
String name = "GreatSpan";
|
||||
Kind kind = Kind.SERVER;
|
||||
SpanKind kind = SpanKind.SERVER;
|
||||
String traceId = this.traceId;
|
||||
String spanId = this.spanId;
|
||||
String parentSpanId = this.parentSpanId;
|
||||
|
|
@ -932,7 +932,7 @@ class RecordEventsReadableSpanTest {
|
|||
|
||||
@Test
|
||||
void testConcurrentModification() throws ExecutionException, InterruptedException {
|
||||
final RecordEventsReadableSpan span = createTestSpan(Kind.INTERNAL);
|
||||
final RecordEventsReadableSpan span = createTestSpan(SpanKind.INTERNAL);
|
||||
ExecutorService es = Executors.newSingleThreadExecutor();
|
||||
Future<?> modifierFuture =
|
||||
es.submit(
|
||||
|
|
|
|||
|
|
@ -20,10 +20,10 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanBuilder;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.StatusCode;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
|
|
@ -432,7 +432,7 @@ class SdkSpanBuilderTest {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return SamplingResult.create(
|
||||
|
|
@ -469,7 +469,7 @@ class SdkSpanBuilderTest {
|
|||
RecordEventsReadableSpan span =
|
||||
(RecordEventsReadableSpan) sdkTracer.spanBuilder(SPAN_NAME).startSpan();
|
||||
try {
|
||||
assertThat(span.toSpanData().getKind()).isEqualTo(Kind.INTERNAL);
|
||||
assertThat(span.toSpanData().getKind()).isEqualTo(SpanKind.INTERNAL);
|
||||
} finally {
|
||||
span.end();
|
||||
}
|
||||
|
|
@ -479,9 +479,9 @@ class SdkSpanBuilderTest {
|
|||
void kind() {
|
||||
RecordEventsReadableSpan span =
|
||||
(RecordEventsReadableSpan)
|
||||
sdkTracer.spanBuilder(SPAN_NAME).setSpanKind(Kind.CONSUMER).startSpan();
|
||||
sdkTracer.spanBuilder(SPAN_NAME).setSpanKind(SpanKind.CONSUMER).startSpan();
|
||||
try {
|
||||
assertThat(span.toSpanData().getKind()).isEqualTo(Kind.CONSUMER);
|
||||
assertThat(span.toSpanData().getKind()).isEqualTo(SpanKind.CONSUMER);
|
||||
} finally {
|
||||
span.end();
|
||||
}
|
||||
|
|
@ -517,7 +517,7 @@ class SdkSpanBuilderTest {
|
|||
@Nullable Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return new SamplingResult() {
|
||||
|
|
@ -567,7 +567,7 @@ class SdkSpanBuilderTest {
|
|||
Context parentContext,
|
||||
String traceId,
|
||||
String name,
|
||||
Kind spanKind,
|
||||
SpanKind spanKind,
|
||||
Attributes attributes,
|
||||
List<LinkData> parentLinks) {
|
||||
return new SamplingResult() {
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@ package io.opentelemetry.sdk.trace;
|
|||
import static io.opentelemetry.api.common.AttributeKey.stringKey;
|
||||
|
||||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.testing.trace.TestSpanData;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import io.opentelemetry.sdk.trace.data.StatusData;
|
||||
|
|
@ -41,7 +41,7 @@ public final class TestUtils {
|
|||
.setHasEnded(true)
|
||||
.setSpanContext(SpanContext.getInvalid())
|
||||
.setName("span")
|
||||
.setKind(Kind.SERVER)
|
||||
.setKind(SpanKind.SERVER)
|
||||
.setStartEpochNanos(TimeUnit.SECONDS.toNanos(100) + 100)
|
||||
.setStatus(StatusData.ok())
|
||||
.setEndEpochNanos(TimeUnit.SECONDS.toNanos(200) + 200)
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -20,7 +21,7 @@ import org.junit.jupiter.api.Test;
|
|||
class AlwaysOffSamplerTest {
|
||||
|
||||
private static final String SPAN_NAME = "MySpanName";
|
||||
private static final Span.Kind SPAN_KIND = Span.Kind.INTERNAL;
|
||||
private static final SpanKind SPAN_KIND = SpanKind.INTERNAL;
|
||||
private final IdGenerator idsGenerator = IdGenerator.random();
|
||||
private final String traceId = idsGenerator.generateTraceId();
|
||||
private final String parentSpanId = idsGenerator.generateSpanId();
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -20,7 +21,7 @@ import org.junit.jupiter.api.Test;
|
|||
class AlwaysOnSamplerTest {
|
||||
|
||||
private static final String SPAN_NAME = "MySpanName";
|
||||
private static final Span.Kind SPAN_KIND = Span.Kind.INTERNAL;
|
||||
private static final SpanKind SPAN_KIND = SpanKind.INTERNAL;
|
||||
private final IdGenerator idsGenerator = IdGenerator.random();
|
||||
private final String traceId = idsGenerator.generateTraceId();
|
||||
private final String parentSpanId = idsGenerator.generateSpanId();
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
|
|||
import io.opentelemetry.api.common.Attributes;
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanContext;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.TraceFlags;
|
||||
import io.opentelemetry.api.trace.TraceId;
|
||||
import io.opentelemetry.api.trace.TraceState;
|
||||
|
|
@ -23,7 +24,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
class TraceIdRatioBasedSamplerTest {
|
||||
private static final String SPAN_NAME = "MySpanName";
|
||||
private static final Span.Kind SPAN_KIND = Span.Kind.INTERNAL;
|
||||
private static final SpanKind SPAN_KIND = SpanKind.INTERNAL;
|
||||
private static final int NUM_SAMPLE_TRIES = 1000;
|
||||
|
||||
private static final IdGenerator idsGenerator = IdGenerator.random();
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.sdk.trace.testbed;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.common.AttributeKey;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
import java.util.ArrayList;
|
||||
|
|
@ -59,7 +59,7 @@ public final class TestUtils {
|
|||
}
|
||||
|
||||
/** Returns a {@code List} with the {@code Span} matching the specified kind. */
|
||||
public static List<SpanData> getByKind(List<SpanData> spans, final Kind kind) {
|
||||
public static List<SpanData> getByKind(List<SpanData> spans, final SpanKind kind) {
|
||||
return getByCondition(spans, span -> span.getKind() == kind);
|
||||
}
|
||||
|
||||
|
|
@ -68,7 +68,7 @@ public final class TestUtils {
|
|||
* instance being matched, an {@code IllegalArgumentException} will be thrown.
|
||||
*/
|
||||
@Nullable
|
||||
public static SpanData getOneByKind(List<SpanData> spans, final Kind kind) {
|
||||
public static SpanData getOneByKind(List<SpanData> spans, final SpanKind kind) {
|
||||
|
||||
List<SpanData> found = getByKind(spans, kind);
|
||||
if (found.size() > 1) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.testbed.actorpropagation;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.context.Scope;
|
||||
|
|
@ -42,7 +42,7 @@ final class Actor implements AutoCloseable {
|
|||
tracer
|
||||
.spanBuilder("received")
|
||||
.setParent(parent)
|
||||
.setSpanKind(Kind.CONSUMER)
|
||||
.setSpanKind(SpanKind.CONSUMER)
|
||||
.startSpan();
|
||||
try (Scope ignored = child.makeCurrent()) {
|
||||
phaser.arriveAndAwaitAdvance(); // child tracer started
|
||||
|
|
@ -66,7 +66,7 @@ final class Actor implements AutoCloseable {
|
|||
tracer
|
||||
.spanBuilder("received")
|
||||
.setParent(parent)
|
||||
.setSpanKind(Kind.CONSUMER)
|
||||
.setSpanKind(SpanKind.CONSUMER)
|
||||
.startSpan();
|
||||
try {
|
||||
phaser.arriveAndAwaitAdvance(); // child tracer started
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ package io.opentelemetry.sdk.trace.testbed.actorpropagation;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Scope;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
|
|
@ -46,7 +47,7 @@ class ActorPropagationTest {
|
|||
void testActorTell() {
|
||||
try (Actor actor = new Actor(tracer, phaser)) {
|
||||
phaser.register();
|
||||
Span parent = tracer.spanBuilder("actorTell").setSpanKind(Span.Kind.PRODUCER).startSpan();
|
||||
Span parent = tracer.spanBuilder("actorTell").setSpanKind(SpanKind.PRODUCER).startSpan();
|
||||
parent.setAttribute("component", "example-actor");
|
||||
try (Scope ignored = parent.makeCurrent()) {
|
||||
actor.tell("my message 1");
|
||||
|
|
@ -60,14 +61,14 @@ class ActorPropagationTest {
|
|||
phaser.arriveAndAwaitAdvance(); // continue...
|
||||
phaser.arriveAndAwaitAdvance(); // child tracer finished
|
||||
assertThat(otelTesting.getSpans()).hasSize(3);
|
||||
assertThat(TestUtils.getByKind(otelTesting.getSpans(), Span.Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(TestUtils.getByKind(otelTesting.getSpans(), SpanKind.CONSUMER)).hasSize(2);
|
||||
phaser.arriveAndDeregister(); // continue...
|
||||
|
||||
List<SpanData> finished = otelTesting.getSpans();
|
||||
assertThat(finished.size()).isEqualTo(3);
|
||||
assertThat(finished.get(0).getTraceId()).isEqualTo(finished.get(1).getTraceId());
|
||||
assertThat(TestUtils.getByKind(finished, Span.Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(TestUtils.getOneByKind(finished, Span.Kind.PRODUCER)).isNotNull();
|
||||
assertThat(TestUtils.getByKind(finished, SpanKind.CONSUMER)).hasSize(2);
|
||||
assertThat(TestUtils.getOneByKind(finished, SpanKind.PRODUCER)).isNotNull();
|
||||
|
||||
assertThat(Span.current()).isSameAs(Span.getInvalid());
|
||||
}
|
||||
|
|
@ -79,7 +80,7 @@ class ActorPropagationTest {
|
|||
phaser.register();
|
||||
Future<String> future1;
|
||||
Future<String> future2;
|
||||
Span span = tracer.spanBuilder("actorAsk").setSpanKind(Span.Kind.PRODUCER).startSpan();
|
||||
Span span = tracer.spanBuilder("actorAsk").setSpanKind(SpanKind.PRODUCER).startSpan();
|
||||
span.setAttribute("component", "example-actor");
|
||||
|
||||
try (Scope ignored = span.makeCurrent()) {
|
||||
|
|
@ -93,7 +94,7 @@ class ActorPropagationTest {
|
|||
phaser.arriveAndAwaitAdvance(); // continue...
|
||||
phaser.arriveAndAwaitAdvance(); // child tracer finished
|
||||
assertThat(otelTesting.getSpans().size()).isEqualTo(3);
|
||||
assertThat(TestUtils.getByKind(otelTesting.getSpans(), Span.Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(TestUtils.getByKind(otelTesting.getSpans(), SpanKind.CONSUMER)).hasSize(2);
|
||||
phaser.arriveAndDeregister(); // continue...
|
||||
|
||||
List<SpanData> finished = otelTesting.getSpans();
|
||||
|
|
@ -104,8 +105,8 @@ class ActorPropagationTest {
|
|||
|
||||
assertThat(finished.size()).isEqualTo(3);
|
||||
assertThat(finished.get(0).getTraceId()).isEqualTo(finished.get(1).getTraceId());
|
||||
assertThat(TestUtils.getByKind(finished, Span.Kind.CONSUMER)).hasSize(2);
|
||||
assertThat(TestUtils.getOneByKind(finished, Span.Kind.PRODUCER)).isNotNull();
|
||||
assertThat(TestUtils.getByKind(finished, SpanKind.CONSUMER)).hasSize(2);
|
||||
assertThat(TestUtils.getOneByKind(finished, SpanKind.PRODUCER)).isNotNull();
|
||||
|
||||
assertThat(Span.current()).isSameAs(Span.getInvalid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.testbed.clientserver;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -26,7 +26,7 @@ final class Client {
|
|||
public void send() throws InterruptedException {
|
||||
Message message = new Message();
|
||||
|
||||
Span span = tracer.spanBuilder("send").setSpanKind(Kind.CLIENT).startSpan();
|
||||
Span span = tracer.spanBuilder("send").setSpanKind(SpanKind.CLIENT).startSpan();
|
||||
span.setAttribute("component", "example-client");
|
||||
|
||||
try (Scope ignored = span.makeCurrent()) {
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.testbed.clientserver;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.api.trace.propagation.W3CTraceContextPropagator;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
|
@ -44,7 +44,7 @@ final class Server extends Thread {
|
|||
}
|
||||
});
|
||||
Span span =
|
||||
tracer.spanBuilder("receive").setSpanKind(Kind.SERVER).setParent(context).startSpan();
|
||||
tracer.spanBuilder("receive").setSpanKind(SpanKind.SERVER).setParent(context).startSpan();
|
||||
span.setAttribute("component", "example-server");
|
||||
|
||||
try (Scope ignored = span.makeCurrent()) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import static org.awaitility.Awaitility.await;
|
|||
import static org.hamcrest.core.IsEqual.equalTo;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
|
@ -59,8 +59,8 @@ class TestClientServerTest {
|
|||
|
||||
finished = TestUtils.sortByStartTime(finished);
|
||||
assertThat(finished.get(0).getTraceId()).isEqualTo(finished.get(1).getTraceId());
|
||||
assertThat(finished.get(0).getKind()).isEqualTo(Kind.CLIENT);
|
||||
assertThat(finished.get(1).getKind()).isEqualTo(Kind.SERVER);
|
||||
assertThat(finished.get(0).getKind()).isEqualTo(SpanKind.CLIENT);
|
||||
assertThat(finished.get(1).getKind()).isEqualTo(SpanKind.SERVER);
|
||||
|
||||
assertThat(Span.current()).isSameAs(Span.getInvalid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.SpanId;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Context;
|
||||
import io.opentelemetry.context.Scope;
|
||||
|
|
@ -48,7 +49,7 @@ class HandlerTest {
|
|||
assertThat(finished).hasSize(2);
|
||||
|
||||
for (SpanData spanProto : finished) {
|
||||
assertThat(spanProto.getKind()).isEqualTo(Span.Kind.CLIENT);
|
||||
assertThat(spanProto.getKind()).isEqualTo(SpanKind.CLIENT);
|
||||
}
|
||||
|
||||
assertThat(finished.get(0).getTraceId()).isNotEqualTo(finished.get(1).getTraceId());
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
package io.opentelemetry.sdk.trace.testbed.concurrentcommonrequesthandler;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanBuilder;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Context;
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ final class RequestHandler {
|
|||
// we cannot use active span because we don't know in which thread it is executed
|
||||
// and we cannot therefore activate span. thread can come from common thread pool.
|
||||
SpanBuilder spanBuilder =
|
||||
tracer.spanBuilder(OPERATION_NAME).setNoParent().setSpanKind(Kind.CLIENT);
|
||||
tracer.spanBuilder(OPERATION_NAME).setNoParent().setSpanKind(SpanKind.CLIENT);
|
||||
|
||||
if (parentContext != null) {
|
||||
spanBuilder.setParent(parentContext);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.testbed.listenerperrequest;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
|
@ -32,7 +32,7 @@ final class Client {
|
|||
}
|
||||
|
||||
public Future<Object> send(final Object message) {
|
||||
Span span = tracer.spanBuilder("send").setSpanKind(Kind.CLIENT).startSpan();
|
||||
Span span = tracer.spanBuilder("send").setSpanKind(SpanKind.CLIENT).startSpan();
|
||||
return execute(message, new ResponseListener(span));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ package io.opentelemetry.sdk.trace.testbed.listenerperrequest;
|
|||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.sdk.testing.junit5.OpenTelemetryExtension;
|
||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||
|
|
@ -32,7 +32,7 @@ class ListenerTest {
|
|||
|
||||
List<SpanData> finished = otelTesting.getSpans();
|
||||
assertThat(finished).hasSize(1);
|
||||
assertThat(finished.get(0).getKind()).isEqualTo(Kind.CLIENT);
|
||||
assertThat(finished.get(0).getKind()).isEqualTo(SpanKind.CLIENT);
|
||||
|
||||
assertThat(Span.current()).isSameAs(Span.getInvalid());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
package io.opentelemetry.sdk.trace.testbed.statelesscommonrequesthandler;
|
||||
|
||||
import io.opentelemetry.api.trace.Span;
|
||||
import io.opentelemetry.api.trace.Span.Kind;
|
||||
import io.opentelemetry.api.trace.SpanKind;
|
||||
import io.opentelemetry.api.trace.Tracer;
|
||||
import io.opentelemetry.context.Scope;
|
||||
|
||||
|
|
@ -29,7 +29,7 @@ final class RequestHandler {
|
|||
|
||||
/** beforeRequest handler....... */
|
||||
public void beforeRequest(Object request) {
|
||||
Span span = tracer.spanBuilder(OPERATION_NAME).setSpanKind(Kind.SERVER).startSpan();
|
||||
Span span = tracer.spanBuilder(OPERATION_NAME).setSpanKind(SpanKind.SERVER).startSpan();
|
||||
tlsScope.set(span.makeCurrent());
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue