Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions dd-trace-core/src/main/java/datadog/trace/core/CoreSpan.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package datadog.trace.core;

import datadog.trace.api.DDTraceId;
import datadog.trace.bootstrap.instrumentation.api.Tags;
import java.util.Map;

public interface CoreSpan<T extends CoreSpan<T>> {
Expand All @@ -10,9 +9,7 @@ public interface CoreSpan<T extends CoreSpan<T>> {

String getServiceName();

default CharSequence getServiceNameSource() {
return null;
}
CharSequence getServiceNameSource();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Implement the new CoreSpan methods in traceAgentTest

Making getServiceNameSource() abstract leaves another in-repo CoreSpan implementation unupdated: dd-trace-core/src/traceAgentTest/groovy/TraceGenerator.groovy:121 declares PojoSpan implements CoreSpan<PojoSpan> but does not implement getServiceNameSource (nor the newly abstract unsafeGetTag/isKind). That source set is registered by dd-trace-core/build.gradle via addTestSuite('traceAgentTest'), so any traceAgentTest compile/run now fails before exercising those tests.

Useful? React with 👍 / 👎.


CharSequence getOperationName();

Expand Down Expand Up @@ -62,13 +59,9 @@ default CharSequence getServiceNameSource() {

<U> U getTag(CharSequence name);

default <U> U unsafeGetTag(CharSequence name, U defaultValue) {
return getTag(name, defaultValue);
}
<U> U unsafeGetTag(CharSequence name, U defaultValue);

default <U> U unsafeGetTag(CharSequence name) {
return getTag(name);
}
<U> U unsafeGetTag(CharSequence name);

boolean hasSamplingPriority();

Expand All @@ -81,10 +74,7 @@ default <U> U unsafeGetTag(CharSequence name) {

boolean isForceKeep();

default boolean isKind(SpanKindFilter filter) {
Object kind = unsafeGetTag(Tags.SPAN_KIND);
return filter.matches(kind == null ? null : kind.toString());
}
boolean isKind(SpanKindFilter filter);

CharSequence getType();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,16 @@ class SimpleSpan implements CoreSpan<SimpleSpan> {
return getTag(name, null)
}

@Override
<U> U unsafeGetTag(CharSequence name, U defaultValue) {
return getTag(name, defaultValue)
}

@Override
<U> U unsafeGetTag(CharSequence name) {
return getTag(name)
}

@Override
boolean hasSamplingPriority() {
return false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
import datadog.trace.api.TagMap;
import datadog.trace.api.sampling.PrioritySampling;
import datadog.trace.bootstrap.instrumentation.api.AgentSpanLink;
import datadog.trace.bootstrap.instrumentation.api.Tags;
import datadog.trace.bootstrap.instrumentation.api.UTF8BytesString;
import datadog.trace.core.CoreSpan;
import datadog.trace.core.Metadata;
import datadog.trace.core.MetadataConsumer;
import datadog.trace.core.SpanKindFilter;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.ArrayList;
Expand Down Expand Up @@ -502,5 +504,26 @@ public PojoSpan setMetaStruct(String field, Object value) {
public int getLongRunningVersion() {
return 0;
}

@Override
public CharSequence getServiceNameSource() {
return null;
}

@Override
public boolean isKind(SpanKindFilter filter) {
Object kind = unsafeGetTag(Tags.SPAN_KIND);
return filter.matches(kind == null ? null : kind.toString());
}

@Override
public <U> U unsafeGetTag(CharSequence name, U defaultValue) {
return getTag(name, defaultValue);
}

@Override
public <U> U unsafeGetTag(CharSequence name) {
return getTag(name);
}
}
}
Loading