Rename EventImpl to ImmutableEvent (#1738)
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
9c6f1ff031
commit
a706fb3350
|
|
@ -24,7 +24,7 @@ import io.opentelemetry.exporters.jaeger.proto.api_v2.Model;
|
||||||
import io.opentelemetry.sdk.extensions.otproto.TraceProtoUtils;
|
import io.opentelemetry.sdk.extensions.otproto.TraceProtoUtils;
|
||||||
import io.opentelemetry.sdk.resources.Resource;
|
import io.opentelemetry.sdk.resources.Resource;
|
||||||
import io.opentelemetry.sdk.trace.TestSpanData;
|
import io.opentelemetry.sdk.trace.TestSpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
||||||
|
|
@ -123,7 +123,7 @@ class AdapterTest {
|
||||||
@Test
|
@Test
|
||||||
void testJaegerLog() {
|
void testJaegerLog() {
|
||||||
// prepare
|
// prepare
|
||||||
EventImpl event = getTimedEvent();
|
ImmutableEvent event = getTimedEvent();
|
||||||
|
|
||||||
// test
|
// test
|
||||||
Model.Log log = Adapter.toJaegerLog(event);
|
Model.Log log = Adapter.toJaegerLog(event);
|
||||||
|
|
@ -261,10 +261,10 @@ class AdapterTest {
|
||||||
assertTrue(error.getVBool());
|
assertTrue(error.getVBool());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static EventImpl getTimedEvent() {
|
private static ImmutableEvent getTimedEvent() {
|
||||||
long epochNanos = TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
|
long epochNanos = TimeUnit.MILLISECONDS.toNanos(System.currentTimeMillis());
|
||||||
Attributes attributes = Attributes.of(stringKey("foo"), "bar");
|
Attributes attributes = Attributes.of(stringKey("foo"), "bar");
|
||||||
return EventImpl.create(epochNanos, "the log message", attributes);
|
return ImmutableEvent.create(epochNanos, "the log message", attributes);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static SpanData getSpanData(long startMs, long endMs) {
|
private static SpanData getSpanData(long startMs, long endMs) {
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||||
import io.opentelemetry.common.Attributes;
|
import io.opentelemetry.common.Attributes;
|
||||||
import io.opentelemetry.sdk.common.CompletableResultCode;
|
import io.opentelemetry.sdk.common.CompletableResultCode;
|
||||||
import io.opentelemetry.sdk.trace.TestSpanData;
|
import io.opentelemetry.sdk.trace.TestSpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.trace.Span.Kind;
|
import io.opentelemetry.trace.Span.Kind;
|
||||||
import io.opentelemetry.trace.SpanId;
|
import io.opentelemetry.trace.SpanId;
|
||||||
|
|
@ -58,7 +58,7 @@ class LoggingSpanExporterTest {
|
||||||
.setKind(Kind.INTERNAL)
|
.setKind(Kind.INTERNAL)
|
||||||
.setEvents(
|
.setEvents(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
epochNanos + 500,
|
epochNanos + 500,
|
||||||
"somethingHappenedHere",
|
"somethingHappenedHere",
|
||||||
Attributes.of(booleanKey("important"), true))))
|
Attributes.of(booleanKey("important"), true))))
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import io.opentelemetry.proto.common.v1.KeyValue;
|
||||||
import io.opentelemetry.proto.trace.v1.Span;
|
import io.opentelemetry.proto.trace.v1.Span;
|
||||||
import io.opentelemetry.proto.trace.v1.Status;
|
import io.opentelemetry.proto.trace.v1.Status;
|
||||||
import io.opentelemetry.sdk.trace.TestSpanData;
|
import io.opentelemetry.sdk.trace.TestSpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
||||||
import io.opentelemetry.trace.Span.Kind;
|
import io.opentelemetry.trace.Span.Kind;
|
||||||
import io.opentelemetry.trace.SpanContext;
|
import io.opentelemetry.trace.SpanContext;
|
||||||
|
|
@ -63,7 +63,7 @@ class SpanAdapterTest {
|
||||||
.setTotalAttributeCount(2)
|
.setTotalAttributeCount(2)
|
||||||
.setEvents(
|
.setEvents(
|
||||||
Collections.singletonList(
|
Collections.singletonList(
|
||||||
EventImpl.create(12347, "my_event", Attributes.empty())))
|
ImmutableEvent.create(12347, "my_event", Attributes.empty())))
|
||||||
.setTotalRecordedEvents(3)
|
.setTotalRecordedEvents(3)
|
||||||
.setLinks(Collections.singletonList(Link.create(SPAN_CONTEXT)))
|
.setLinks(Collections.singletonList(Link.create(SPAN_CONTEXT)))
|
||||||
.setTotalRecordedLinks(2)
|
.setTotalRecordedLinks(2)
|
||||||
|
|
@ -130,7 +130,7 @@ class SpanAdapterTest {
|
||||||
void toProtoSpanEvent_WithoutAttributes() {
|
void toProtoSpanEvent_WithoutAttributes() {
|
||||||
assertThat(
|
assertThat(
|
||||||
SpanAdapter.toProtoSpanEvent(
|
SpanAdapter.toProtoSpanEvent(
|
||||||
EventImpl.create(12345, "test_without_attributes", Attributes.empty())))
|
ImmutableEvent.create(12345, "test_without_attributes", Attributes.empty())))
|
||||||
.isEqualTo(
|
.isEqualTo(
|
||||||
Span.Event.newBuilder()
|
Span.Event.newBuilder()
|
||||||
.setTimeUnixNano(12345)
|
.setTimeUnixNano(12345)
|
||||||
|
|
@ -142,7 +142,7 @@ class SpanAdapterTest {
|
||||||
void toProtoSpanEvent_WithAttributes() {
|
void toProtoSpanEvent_WithAttributes() {
|
||||||
assertThat(
|
assertThat(
|
||||||
SpanAdapter.toProtoSpanEvent(
|
SpanAdapter.toProtoSpanEvent(
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
12345,
|
12345,
|
||||||
"test_with_attributes",
|
"test_with_attributes",
|
||||||
Attributes.of(stringKey("key_string"), "string"),
|
Attributes.of(stringKey("key_string"), "string"),
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import com.google.common.collect.ImmutableList;
|
||||||
import io.opentelemetry.common.Attributes;
|
import io.opentelemetry.common.Attributes;
|
||||||
import io.opentelemetry.sdk.common.CompletableResultCode;
|
import io.opentelemetry.sdk.common.CompletableResultCode;
|
||||||
import io.opentelemetry.sdk.trace.TestSpanData;
|
import io.opentelemetry.sdk.trace.TestSpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
||||||
import io.opentelemetry.trace.Span.Kind;
|
import io.opentelemetry.trace.Span.Kind;
|
||||||
|
|
@ -45,8 +45,8 @@ public class ZipkinSpanExporterEndToEndHttpTest {
|
||||||
private static final Attributes attributes = Attributes.empty();
|
private static final Attributes attributes = Attributes.empty();
|
||||||
private static final List<Event> annotations =
|
private static final List<Event> annotations =
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
EventImpl.create(RECEIVED_TIMESTAMP_NANOS, "RECEIVED", Attributes.empty()),
|
ImmutableEvent.create(RECEIVED_TIMESTAMP_NANOS, "RECEIVED", Attributes.empty()),
|
||||||
EventImpl.create(SENT_TIMESTAMP_NANOS, "SENT", Attributes.empty()));
|
ImmutableEvent.create(SENT_TIMESTAMP_NANOS, "SENT", Attributes.empty()));
|
||||||
|
|
||||||
private static final String ENDPOINT_V1_SPANS = "/api/v1/spans";
|
private static final String ENDPOINT_V1_SPANS = "/api/v1/spans";
|
||||||
private static final String ENDPOINT_V2_SPANS = "/api/v2/spans";
|
private static final String ENDPOINT_V2_SPANS = "/api/v2/spans";
|
||||||
|
|
|
||||||
|
|
@ -27,7 +27,7 @@ import io.opentelemetry.sdk.common.export.ConfigBuilder;
|
||||||
import io.opentelemetry.sdk.resources.Resource;
|
import io.opentelemetry.sdk.resources.Resource;
|
||||||
import io.opentelemetry.sdk.resources.ResourceAttributes;
|
import io.opentelemetry.sdk.resources.ResourceAttributes;
|
||||||
import io.opentelemetry.sdk.trace.TestSpanData;
|
import io.opentelemetry.sdk.trace.TestSpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
||||||
import io.opentelemetry.trace.Span.Kind;
|
import io.opentelemetry.trace.Span.Kind;
|
||||||
|
|
@ -66,8 +66,8 @@ class ZipkinSpanExporterTest {
|
||||||
private static final Attributes attributes = Attributes.empty();
|
private static final Attributes attributes = Attributes.empty();
|
||||||
private static final List<Event> annotations =
|
private static final List<Event> annotations =
|
||||||
ImmutableList.of(
|
ImmutableList.of(
|
||||||
EventImpl.create(1505855799_433901068L, "RECEIVED", Attributes.empty()),
|
ImmutableEvent.create(1505855799_433901068L, "RECEIVED", Attributes.empty()),
|
||||||
EventImpl.create(1505855799_459486280L, "SENT", Attributes.empty()));
|
ImmutableEvent.create(1505855799_459486280L, "SENT", Attributes.empty()));
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void generateSpan_remoteParent() {
|
void generateSpan_remoteParent() {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ import io.opentelemetry.sdk.common.Clock;
|
||||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||||
import io.opentelemetry.sdk.resources.Resource;
|
import io.opentelemetry.sdk.resources.Resource;
|
||||||
import io.opentelemetry.sdk.trace.config.TraceConfig;
|
import io.opentelemetry.sdk.trace.config.TraceConfig;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
||||||
|
|
@ -84,7 +84,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
||||||
private AttributesMap attributes;
|
private AttributesMap attributes;
|
||||||
// List of recorded events.
|
// List of recorded events.
|
||||||
@GuardedBy("lock")
|
@GuardedBy("lock")
|
||||||
private final EvictingQueue<EventImpl> events;
|
private final EvictingQueue<ImmutableEvent> events;
|
||||||
// Number of events recorded.
|
// Number of events recorded.
|
||||||
@GuardedBy("lock")
|
@GuardedBy("lock")
|
||||||
private int totalRecordedEvents = 0;
|
private int totalRecordedEvents = 0;
|
||||||
|
|
@ -322,7 +322,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addTimedEvent(EventImpl.create(clock.now(), name, Attributes.empty(), 0));
|
addTimedEvent(ImmutableEvent.create(clock.now(), name, Attributes.empty(), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -330,7 +330,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
addTimedEvent(EventImpl.create(timestamp, name, Attributes.empty(), 0));
|
addTimedEvent(ImmutableEvent.create(timestamp, name, Attributes.empty(), 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -340,7 +340,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
||||||
}
|
}
|
||||||
int totalAttributeCount = attributes.size();
|
int totalAttributeCount = attributes.size();
|
||||||
addTimedEvent(
|
addTimedEvent(
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
clock.now(),
|
clock.now(),
|
||||||
name,
|
name,
|
||||||
copyAndLimitAttributes(attributes, traceConfig.getMaxNumberOfAttributesPerEvent()),
|
copyAndLimitAttributes(attributes, traceConfig.getMaxNumberOfAttributesPerEvent()),
|
||||||
|
|
@ -354,7 +354,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
||||||
}
|
}
|
||||||
int totalAttributeCount = attributes.size();
|
int totalAttributeCount = attributes.size();
|
||||||
addTimedEvent(
|
addTimedEvent(
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
timestamp,
|
timestamp,
|
||||||
name,
|
name,
|
||||||
copyAndLimitAttributes(attributes, traceConfig.getMaxNumberOfAttributesPerEvent()),
|
copyAndLimitAttributes(attributes, traceConfig.getMaxNumberOfAttributesPerEvent()),
|
||||||
|
|
@ -371,7 +371,7 @@ final class RecordEventsReadableSpan implements ReadWriteSpan {
|
||||||
return result.build();
|
return result.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTimedEvent(EventImpl timedEvent) {
|
private void addTimedEvent(ImmutableEvent timedEvent) {
|
||||||
synchronized (lock) {
|
synchronized (lock) {
|
||||||
if (hasEnded) {
|
if (hasEnded) {
|
||||||
logger.log(Level.FINE, "Calling addEvent() on an ended Span.");
|
logger.log(Level.FINE, "Calling addEvent() on an ended Span.");
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ import javax.annotation.concurrent.Immutable;
|
||||||
/** An immutable implementation of the {@link SpanData.Event}. */
|
/** An immutable implementation of the {@link SpanData.Event}. */
|
||||||
@Immutable
|
@Immutable
|
||||||
@AutoValue
|
@AutoValue
|
||||||
public abstract class EventImpl implements SpanData.Event {
|
public abstract class ImmutableEvent implements SpanData.Event {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a new immutable {@code Event}.
|
* Returns a new immutable {@code Event}.
|
||||||
|
|
@ -22,8 +22,8 @@ public abstract class EventImpl implements SpanData.Event {
|
||||||
* @param attributes the attributes of the {@code Event}.
|
* @param attributes the attributes of the {@code Event}.
|
||||||
* @return a new immutable {@code Event<T>}
|
* @return a new immutable {@code Event<T>}
|
||||||
*/
|
*/
|
||||||
public static EventImpl create(long epochNanos, String name, Attributes attributes) {
|
public static ImmutableEvent create(long epochNanos, String name, Attributes attributes) {
|
||||||
return new AutoValue_EventImpl(name, attributes, epochNanos, attributes.size());
|
return new AutoValue_ImmutableEvent(name, attributes, epochNanos, attributes.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -35,10 +35,10 @@ public abstract class EventImpl implements SpanData.Event {
|
||||||
* @param totalAttributeCount the total number of attributes for this {@code} Event.
|
* @param totalAttributeCount the total number of attributes for this {@code} Event.
|
||||||
* @return a new immutable {@code Event<T>}
|
* @return a new immutable {@code Event<T>}
|
||||||
*/
|
*/
|
||||||
public static EventImpl create(
|
public static ImmutableEvent create(
|
||||||
long epochNanos, String name, Attributes attributes, int totalAttributeCount) {
|
long epochNanos, String name, Attributes attributes, int totalAttributeCount) {
|
||||||
return new AutoValue_EventImpl(name, attributes, epochNanos, totalAttributeCount);
|
return new AutoValue_ImmutableEvent(name, attributes, epochNanos, totalAttributeCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventImpl() {}
|
ImmutableEvent() {}
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,7 @@ import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||||
import io.opentelemetry.sdk.internal.TestClock;
|
import io.opentelemetry.sdk.internal.TestClock;
|
||||||
import io.opentelemetry.sdk.resources.Resource;
|
import io.opentelemetry.sdk.resources.Resource;
|
||||||
import io.opentelemetry.sdk.trace.config.TraceConfig;
|
import io.opentelemetry.sdk.trace.config.TraceConfig;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
import io.opentelemetry.sdk.trace.data.SpanData.Event;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
||||||
|
|
@ -133,7 +133,8 @@ class RecordEventsReadableSpanTest {
|
||||||
spanDoWork(span, null);
|
spanDoWork(span, null);
|
||||||
SpanData spanData = span.toSpanData();
|
SpanData spanData = span.toSpanData();
|
||||||
Event event =
|
Event event =
|
||||||
EventImpl.create(START_EPOCH_NANOS + NANOS_PER_SECOND, "event2", Attributes.empty(), 0);
|
ImmutableEvent.create(
|
||||||
|
START_EPOCH_NANOS + NANOS_PER_SECOND, "event2", Attributes.empty(), 0);
|
||||||
verifySpanData(
|
verifySpanData(
|
||||||
spanData,
|
spanData,
|
||||||
expectedAttributes,
|
expectedAttributes,
|
||||||
|
|
@ -162,7 +163,8 @@ class RecordEventsReadableSpanTest {
|
||||||
Mockito.verify(spanProcessor, Mockito.times(1)).onEnd(span);
|
Mockito.verify(spanProcessor, Mockito.times(1)).onEnd(span);
|
||||||
SpanData spanData = span.toSpanData();
|
SpanData spanData = span.toSpanData();
|
||||||
Event event =
|
Event event =
|
||||||
EventImpl.create(START_EPOCH_NANOS + NANOS_PER_SECOND, "event2", Attributes.empty(), 0);
|
ImmutableEvent.create(
|
||||||
|
START_EPOCH_NANOS + NANOS_PER_SECOND, "event2", Attributes.empty(), 0);
|
||||||
verifySpanData(
|
verifySpanData(
|
||||||
spanData,
|
spanData,
|
||||||
expectedAttributes,
|
expectedAttributes,
|
||||||
|
|
@ -192,7 +194,7 @@ class RecordEventsReadableSpanTest {
|
||||||
|
|
||||||
assertThrows(
|
assertThrows(
|
||||||
UnsupportedOperationException.class,
|
UnsupportedOperationException.class,
|
||||||
() -> spanData.getEvents().add(EventImpl.create(1000, "test", Attributes.empty())));
|
() -> spanData.getEvents().add(ImmutableEvent.create(1000, "test", Attributes.empty())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -563,7 +565,7 @@ class RecordEventsReadableSpanTest {
|
||||||
assertThat(spanData.getEvents().size()).isEqualTo(maxNumberOfEvents);
|
assertThat(spanData.getEvents().size()).isEqualTo(maxNumberOfEvents);
|
||||||
for (int i = 0; i < maxNumberOfEvents; i++) {
|
for (int i = 0; i < maxNumberOfEvents; i++) {
|
||||||
Event expectedEvent =
|
Event expectedEvent =
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
START_EPOCH_NANOS + (maxNumberOfEvents + i) * NANOS_PER_SECOND,
|
START_EPOCH_NANOS + (maxNumberOfEvents + i) * NANOS_PER_SECOND,
|
||||||
"event2",
|
"event2",
|
||||||
Attributes.empty(),
|
Attributes.empty(),
|
||||||
|
|
@ -578,7 +580,7 @@ class RecordEventsReadableSpanTest {
|
||||||
assertThat(spanData.getEvents().size()).isEqualTo(maxNumberOfEvents);
|
assertThat(spanData.getEvents().size()).isEqualTo(maxNumberOfEvents);
|
||||||
for (int i = 0; i < maxNumberOfEvents; i++) {
|
for (int i = 0; i < maxNumberOfEvents; i++) {
|
||||||
Event expectedEvent =
|
Event expectedEvent =
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
START_EPOCH_NANOS + (maxNumberOfEvents + i) * NANOS_PER_SECOND,
|
START_EPOCH_NANOS + (maxNumberOfEvents + i) * NANOS_PER_SECOND,
|
||||||
"event2",
|
"event2",
|
||||||
Attributes.empty(),
|
Attributes.empty(),
|
||||||
|
|
@ -859,9 +861,9 @@ class RecordEventsReadableSpanTest {
|
||||||
|
|
||||||
List<Event> events =
|
List<Event> events =
|
||||||
Arrays.asList(
|
Arrays.asList(
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
firstEventEpochNanos, "event1", event1Attributes, event1Attributes.size()),
|
firstEventEpochNanos, "event1", event1Attributes, event1Attributes.size()),
|
||||||
EventImpl.create(
|
ImmutableEvent.create(
|
||||||
secondEventTimeNanos, "event2", event2Attributes, event2Attributes.size()));
|
secondEventTimeNanos, "event2", event2Attributes, event2Attributes.size()));
|
||||||
|
|
||||||
SpanData result = readableSpan.toSpanData();
|
SpanData result = readableSpan.toSpanData();
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import static org.junit.jupiter.api.Assertions.assertThrows;
|
||||||
|
|
||||||
import io.opentelemetry.common.Attributes;
|
import io.opentelemetry.common.Attributes;
|
||||||
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
import io.opentelemetry.sdk.common.InstrumentationLibraryInfo;
|
||||||
import io.opentelemetry.sdk.trace.data.EventImpl;
|
import io.opentelemetry.sdk.trace.data.ImmutableEvent;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData;
|
import io.opentelemetry.sdk.trace.data.SpanData;
|
||||||
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
import io.opentelemetry.sdk.trace.data.SpanData.Link;
|
||||||
import io.opentelemetry.trace.Span.Kind;
|
import io.opentelemetry.trace.Span.Kind;
|
||||||
|
|
@ -54,7 +54,7 @@ class TestSpanDataTest {
|
||||||
|
|
||||||
assertThrows(
|
assertThrows(
|
||||||
UnsupportedOperationException.class,
|
UnsupportedOperationException.class,
|
||||||
() -> spanData.getEvents().add(EventImpl.create(1234, "foo", Attributes.empty())));
|
() -> spanData.getEvents().add(ImmutableEvent.create(1234, "foo", Attributes.empty())));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
@ -83,13 +83,13 @@ class TestSpanDataTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void timedEvent_defaultTotalAttributeCountIsZero() {
|
void timedEvent_defaultTotalAttributeCountIsZero() {
|
||||||
EventImpl event = EventImpl.create(START_EPOCH_NANOS, "foo", Attributes.empty());
|
ImmutableEvent event = ImmutableEvent.create(START_EPOCH_NANOS, "foo", Attributes.empty());
|
||||||
assertThat(event.getTotalAttributeCount()).isEqualTo(0);
|
assertThat(event.getTotalAttributeCount()).isEqualTo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void timedEvent_canSetTotalAttributeCount() {
|
void timedEvent_canSetTotalAttributeCount() {
|
||||||
EventImpl event = EventImpl.create(START_EPOCH_NANOS, "foo", Attributes.empty(), 123);
|
ImmutableEvent event = ImmutableEvent.create(START_EPOCH_NANOS, "foo", Attributes.empty(), 123);
|
||||||
assertThat(event.getTotalAttributeCount()).isEqualTo(123);
|
assertThat(event.getTotalAttributeCount()).isEqualTo(123);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue