diff --git a/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java b/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java index 10b2c319751..3287d10542f 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpan.java @@ -59,8 +59,6 @@ final class RecordEventsReadableSpan implements ReadableSpan, Span { // The displayed name of the span. // List of recorded links to parent and child spans. private final List links; - // Number of links recorded. - private final int totalRecordedLinks; // Lock used to internally guard the mutable state of this instance private final Object lock = new Object(); @@ -115,7 +113,6 @@ final class RecordEventsReadableSpan implements ReadableSpan, Span { * @param resource the resource associated with this span. * @param attributes the attributes set during span creation. * @param links the links set during span creation, may be truncated. - * @param totalRecordedLinks the total number of links set (including dropped links). * @return a new and started span. */ @VisibleForTesting @@ -132,7 +129,6 @@ static RecordEventsReadableSpan startSpan( Resource resource, AttributesWithCapacity attributes, List links, - int totalRecordedLinks, long startEpochNanos) { RecordEventsReadableSpan span = new RecordEventsReadableSpan( @@ -148,7 +144,6 @@ static RecordEventsReadableSpan startSpan( resource, attributes, links, - totalRecordedLinks, startEpochNanos == 0 ? clock.now() : startEpochNanos); // Call onStart here instead of calling in the constructor to make sure the span is completely // initialized. @@ -498,14 +493,12 @@ private RecordEventsReadableSpan( Resource resource, AttributesWithCapacity attributes, List links, - int totalRecordedLinks, long startEpochNanos) { this.context = context; this.instrumentationLibraryInfo = instrumentationLibraryInfo; this.parentSpanId = parentSpanId; this.hasRemoteParent = hasRemoteParent; this.links = links; - this.totalRecordedLinks = totalRecordedLinks; this.name = name; this.kind = kind; this.spanProcessor = spanProcessor; @@ -529,16 +522,6 @@ protected void finalize() throws Throwable { super.finalize(); } - /** - * The count of links that have been dropped. - * - * @return The number of links that have been dropped. - */ - @VisibleForTesting - int getDroppedLinksCount() { - return totalRecordedLinks - links.size(); - } - @VisibleForTesting int getNumberOfChildren() { synchronized (lock) { diff --git a/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java b/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java index bf5707c37f7..07a9c43eb39 100644 --- a/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java +++ b/sdk/src/main/java/io/opentelemetry/sdk/trace/SpanBuilderSdk.java @@ -127,8 +127,8 @@ public Span.Builder addLink(SpanContext spanContext, Map @Override public Span.Builder addLink(Link link) { Utils.checkNotNull(link, "link"); - //don't bother doing anything with any links beyond the max. - //todo: generate a metric for dropped links + // don't bother doing anything with any links beyond the max. + // todo: generate a metric for dropped links if (links.size() == traceConfig.getMaxNumberOfLinks()) { return this; } @@ -222,7 +222,6 @@ public Span startSpan() { resource, attributes, links, - links.size(), startEpochNanos); } diff --git a/sdk/src/test/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpanTest.java b/sdk/src/test/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpanTest.java index 7b1cc394257..5fd0ca4d1a8 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpanTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/trace/RecordEventsReadableSpanTest.java @@ -485,7 +485,6 @@ private RecordEventsReadableSpan createTestSpan( resource, attributesWithCapacity, Collections.singletonList(link), - 1, 0); Mockito.verify(spanProcessor, Mockito.times(1)).onStart(span); return span; @@ -572,7 +571,6 @@ public void testAsSpanData() { resource, attributesWithCapacity, links, - 1, 0); long startEpochNanos = clock.now(); clock.advanceMillis(4); diff --git a/sdk/src/test/java/io/opentelemetry/sdk/trace/SpanBuilderSdkTest.java b/sdk/src/test/java/io/opentelemetry/sdk/trace/SpanBuilderSdkTest.java index 9af221c4ca3..a00e53953dc 100644 --- a/sdk/src/test/java/io/opentelemetry/sdk/trace/SpanBuilderSdkTest.java +++ b/sdk/src/test/java/io/opentelemetry/sdk/trace/SpanBuilderSdkTest.java @@ -110,7 +110,6 @@ public void truncateLink() { } RecordEventsReadableSpan span = (RecordEventsReadableSpan) spanBuilder.startSpan(); try { - assertThat(span.getDroppedLinksCount()).isEqualTo(maxNumberOfLinks); assertThat(span.getLinks().size()).isEqualTo(maxNumberOfLinks); for (int i = 0; i < maxNumberOfLinks; i++) { assertThat(span.getLinks().get(i)).isEqualTo(SpanData.Link.create(sampledSpanContext));