Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public Evaluation evaluate(final List<Message> messages, final Options options)
final AgentTracer.SpanBuilder builder = tracer.buildSpan(SPAN_NAME, SPAN_NAME);
final AgentSpan parent = AgentTracer.activeSpan();
if (parent != null) {
builder.asChildOf(parent.context());
builder.asChildOf(parent.spanContext());
}
final AgentSpan span = builder.start();
final AgentSpan localRootSpan = span.getLocalRootSpan();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public AgentSpan afterStart(final AgentSpan span) {
// DQH - Could retrieve the value from componentEntry and cast to avoid the virtual call,
// unclear which option is better here
final CharSequence component = component();
span.context().setIntegrationName(component);
span.spanContext().setIntegrationName(component);

// null handled by setMetric
span.setMetric(traceAnalyticsEntry);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public AgentSpan onRequest(
protected static AgentSpanContext.Extracted getExtractedSpanContext(Context parentContext) {
AgentSpan extractedSpan = AgentSpan.fromContext(parentContext);
if (extractedSpan != null) {
AgentSpanContext extractedSpanContext = extractedSpan.context();
AgentSpanContext extractedSpanContext = extractedSpan.spanContext();
if (extractedSpanContext instanceof AgentSpanContext.Extracted) {
return (AgentSpanContext.Extracted) extractedSpanContext;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ private AgentSpan onFrameStart(
wsSpan.setTag(DECISION_MAKER_RESOURCE, handshakeSpan.getResourceName());
}
} else {
wsSpan = startSpan(WEBSOCKET.toString(), operationName, handshakeSpan.context());
wsSpan = startSpan(WEBSOCKET.toString(), operationName, handshakeSpan.spanContext());
}
} else {
wsSpan = startSpan(WEBSOCKET.toString(), operationName);
Expand All @@ -167,8 +167,8 @@ private AgentSpan onFrameStart(
wsSpan.addLink(
SpanLink.from(
inheritSampling
? handshakeSpan.context()
: new NotSampledSpanContext(handshakeSpan.context()),
? handshakeSpan.spanContext()
: new NotSampledSpanContext(handshakeSpan.spanContext()),
SpanLink.DEFAULT_FLAGS,
"",
linkAttributes));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class BaseDecoratorTest extends DDSpecification {
then:
1 * span.setSpanType(decorator.spanType())
1 * span.setTag(TagMap.Entry.create(Tags.COMPONENT, "test-component"))
1 * span.context() >> spanContext
1 * span.spanContext() >> spanContext
1 * spanContext.setIntegrationName("test-component")
_ * span.setTag(_)
_ * span.setTag(_, _) // Want to allow other calls from child implementations.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ClientDecoratorTest extends BaseDecoratorTest {
}
1 * span.setMeasured(true)
1 * span.setTag(TagMap.Entry.create(Tags.COMPONENT, "test-component"))
1 * span.context() >> spanContext
1 * span.spanContext() >> spanContext
1 * spanContext.setIntegrationName("test-component")
1 * span.setTag(TagMap.Entry.create(Tags.SPAN_KIND, "client"))
1 * span.setSpanType(decorator.spanType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class DBTypeProcessingDatabaseClientDecoratorTest extends ClientDecoratorTest {
}
1 * span.setMeasured(true)
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> spanContext
1 * span.spanContext() >> spanContext
1 * spanContext.setIntegrationName("test-component")
1 * span.setTag(TagMap.Entry.create(Tags.SPAN_KIND, "client"))
1 * span.setSpanType("test-type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class DatabaseClientDecoratorTest extends ClientDecoratorTest {
}
1 * span.setMeasured(true)
1 * span.setTag(TagMap.Entry.create(Tags.COMPONENT, "test-component"))
1 * span.context() >> spanContext
1 * span.spanContext() >> spanContext
1 * spanContext.setIntegrationName("test-component")
1 * span.setTag(TagMap.Entry.create(Tags.SPAN_KIND, "client"))
1 * span.setSpanType("test-type")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ServerDecoratorTest extends BaseDecoratorTest {
then:
1 * span.setTag(TagMap.Entry.create(LANGUAGE_TAG_KEY, LANGUAGE_TAG_VALUE))
1 * span.setTag(TagMap.Entry.create(COMPONENT, "test-component"))
1 * span.context() >> spanContext
1 * span.spanContext() >> spanContext
1 * spanContext.setIntegrationName("test-component")
1 * span.setTag(TagMap.Entry.create(SPAN_KIND, "server"))
1 * span.setSpanType(decorator.spanType())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public AgentSpan afterStart(final AgentSpan span) {
span.setTag(DDTags.HOST_VCPU_COUNT, cpuCount);
span.setTag(Tags.TEST_TYPE, testType());
span.setTag(Tags.COMPONENT, component());
span.context().setIntegrationName(component());
span.spanContext().setIntegrationName(component());
span.setTag(Tags.TEST_SESSION_NAME, sessionName);

for (final Map.Entry<String, String> ciTag : ciTags.entrySet()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public BuildSystemModuleImpl testModuleStart(
@Nullable JavaAgent jacocoAgent) {
ExecutionSettings executionSettings = executionSettingsFactory.create(jvmInfo, moduleName);
return new BuildSystemModuleImpl(
span.context(),
span.spanContext(),
moduleName,
startCommand,
startTime,
Expand All @@ -178,7 +178,7 @@ public BuildSystemModuleImpl testModuleStart(

@Override
public AgentSpan testTaskStart(String taskName) {
return startSpan("ci_visibility", taskName, span.context());
return startSpan("ci_visibility", taskName, span.spanContext());
}

private void onModuleFinish(AgentSpan moduleSpan) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public TestSuiteImpl testSuiteStart(
boolean parallelized,
TestFrameworkInstrumentation instrumentation) {
return new TestSuiteImpl(
span.context(),
span.spanContext(),
moduleName,
testSuiteName,
executionStrategy.getExecutionSettings().getItrCorrelationId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public HeadlessTestSession(
@Override
public HeadlessTestModule testModuleStart(String moduleName, @Nullable Long startTime) {
return new HeadlessTestModule(
span.context(),
span.spanContext(),
moduleName,
startTime,
config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public ManualApiTestSuite testSuiteStart(
boolean parallelized) {
TestSuiteImpl suite =
new TestSuiteImpl(
span.context(),
span.spanContext(),
moduleName,
testSuiteName,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public ManualApiTestSession(
@Override
public ManualApiTestModule testModuleStart(String moduleName, @Nullable Long startTime) {
return new ManualApiTestModule(
span.context(),
span.spanContext(),
moduleName,
startTime,
config,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TestDecoratorImplTest extends Specification {
then:
1 * span.setTag(Tags.TEST_SESSION_NAME, "session-name")
1 * span.setTag(Tags.COMPONENT, "test-component")
1 * span.context() >> context
1 * span.spanContext() >> context
1 * context.setIntegrationName("test-component")
1 * span.setTag(Tags.TEST_TYPE, decorator.testType())
1 * span.setSamplingPriority(PrioritySampling.SAMPLER_KEEP)
Expand All @@ -48,7 +48,7 @@ class TestDecoratorImplTest extends Specification {
decorator.afterStart(span)

then:
1 * span.context() >> context
1 * span.spanContext() >> context
1 * context.setIntegrationName("test-component")
1 * span.setTag(Tags.TEST_SESSION_NAME, expectedSessionName)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,8 @@ private static Map<String, String> getDebugSessions() {
if (tracer != null) {
AgentSpan span = tracer.activeSpan();
if (span instanceof DDSpan) {
DDSpanContext context = (DDSpanContext) span.context();
String debug = context.getPropagationTags().getDebugPropagation();
DDSpanContext spanContext = (DDSpanContext) span.spanContext();
String debug = spanContext.getPropagationTags().getDebugPropagation();
if (debug != null) {
String[] entries = debug.split(",");
for (String entry : entries) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public void conditions() throws IOException, URISyntaxException {
.filter(
span -> {
DDSpan ddSpan = (DDSpan) span;
PropagationTags tags = ddSpan.context().getPropagationTags();
PropagationTags tags = ddSpan.spanContext().getPropagationTags();
return (TRIGGER_PROBE_SESSION_ID + ":1").equals(tags.getDebugPropagation());
})
.count();
Expand Down Expand Up @@ -137,7 +137,7 @@ public void cooldown() throws IOException, URISyntaxException {
.filter(
span -> {
DDSpan ddSpan = (DDSpan) span;
PropagationTags tags = ddSpan.context().getPropagationTags();
PropagationTags tags = ddSpan.spanContext().getPropagationTags();
return (TRIGGER_PROBE_SESSION_ID + ":1").equals(tags.getDebugPropagation());
})
.count();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,16 +122,16 @@ public DDLLMObsSpan(
}
span.setTag(LLMOBS_TAG_PREFIX + PARENT_ID_TAG_INTERNAL, parentSpanID);
// Propagate the effective sessionId to descendant LLMObs spans via the context.
scope = LLMObsContext.attach(span.context(), sessionId);
scope = LLMObsContext.attach(span.spanContext(), sessionId);
}

@Override
public String toString() {
return super.toString()
+ ", trace_id="
+ span.context().getTraceId()
+ span.spanContext().getTraceId()
+ ", span_id="
+ span.context().getSpanId()
+ span.spanContext().getSpanId()
+ ", ml_app="
+ span.getTag(LLMObsTags.ML_APP)
+ ", service="
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public OtelSpan(AgentSpan delegate) {
}
this.statusCode = UNSET;
this.recording = true;
delegate.context().setIntegrationName("otel");
delegate.spanContext().setIntegrationName("otel");
}

public static Span invalid() {
Expand Down Expand Up @@ -168,7 +168,7 @@ public AgentScope activate() {
}

public AgentSpanContext getAgentSpanContext() {
return this.delegate.context();
return this.delegate.spanContext();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public OtelSpanContext(
}

public static SpanContext fromLocalSpan(AgentSpan span) {
AgentSpanContext delegate = span.context();
AgentSpanContext delegate = span.spanContext();
AgentSpan localRootSpan = span.getLocalRootSpan();
Integer samplingPriority = localRootSpan.getSamplingPriority();
boolean sampled = samplingPriority != null && samplingPriority > 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ abstract class InstrumentationSpecification extends DDSpecification implements A

static void blockUntilChildSpansFinished(AgentSpan span, int numberOfSpans) {
if (span instanceof DDSpan) {
def traceCollector = ((DDSpan) span).context().getTraceCollector()
def traceCollector = ((DDSpan) span).spanContext().getTraceCollector()
if (!(traceCollector instanceof PendingTrace)) {
throw new IllegalStateException("Expected $PendingTrace.name trace collector, got $traceCollector.class.name")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,8 +261,8 @@ class TrackingSpanDecorator implements AgentSpan {
}

@Override
AgentSpanContext context() {
return delegate.context()
AgentSpanContext spanContext() {
return delegate.spanContext()
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ protected void blockUntilChildSpansFinished(int numberOfSpans) {

static void blockUntilChildSpansFinished(AgentSpan span, int numberOfSpans) {
if (span instanceof DDSpan) {
TraceCollector traceCollector = ((DDSpan) span).context().getTraceCollector();
TraceCollector traceCollector = ((DDSpan) span).spanContext().getTraceCollector();
if (!(traceCollector instanceof PendingTrace)) {
throw new IllegalStateException(
"Expected PendingTrace trace collector, got " + traceCollector.getClass().getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ private SpanLinkMatcher(Matcher<DDTraceId> traceIdMatcher, Matcher<Long> spanIdM
* @return A {@code SpanLinkMatcher} that matches a span link to the given span.
*/
public static SpanLinkMatcher to(DDSpan span) {
return to(span.context());
return to(span.spanContext());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public static final class TracingServerCallListener<ReqT>
@Override
public void onMessage(final ReqT message) {
final AgentSpan msgSpan =
startSpan(DECORATE.instrumentationNames()[0], GRPC_MESSAGE, this.span.context())
startSpan(DECORATE.instrumentationNames()[0], GRPC_MESSAGE, this.span.spanContext())
.setTag("message.type", message.getClass().getName());
DECORATE.afterStart(msgSpan);
try (AgentScope scope = activateSpan(msgSpan)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ private void dsmCheckpoint(AgentSpan span, String streamArn, Response<?> respons
PathwayContext pathwayContext = dataStreamsMonitoring.newPathwayContext();
DataStreamsContext dataStreamsContext = create(tags, arrivalTime.getTime(), 0);
pathwayContext.setCheckpoint(dataStreamsContext, dataStreamsMonitoring::add);
if (!span.context().getPathwayContext().isStarted()) {
span.context().mergePathwayContext(pathwayContext);
if (!span.spanContext().getPathwayContext().isStarted()) {
span.spanContext().mergePathwayContext(pathwayContext);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,8 @@ public Context onSdkResponse(
pathwayContext.setCheckpoint(
create(tags, arrivalTime.toEpochMilli(), 0),
dataStreamsMonitoring::add);
if (!span.context().getPathwayContext().isStarted()) {
span.context().mergePathwayContext(pathwayContext);
if (!span.spanContext().getPathwayContext().isStarted()) {
span.spanContext().mergePathwayContext(pathwayContext);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ protected void startNewMessageSpan(Message message) {
MILLISECONDS.toMicros(timeInQueueStart));
BROKER_DECORATE.afterStart(queueSpan);
BROKER_DECORATE.onTimeInQueue(queueSpan, queueUrl);
spanContext = queueSpan.context();
spanContext = queueSpan.spanContext();
// The queueSpan will be finished after inner span has been activated to ensure that
// spans are written out together by TraceStructureWriter when running in strict mode
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ protected void startNewMessageSpan(Message message) {
MILLISECONDS.toMicros(timeInQueueStart));
BROKER_DECORATE.afterStart(queueSpan);
BROKER_DECORATE.onTimeInQueue(queueSpan, queueUrl, requestId);
spanContext = queueSpan.context();
spanContext = queueSpan.spanContext();
// The queueSpan will be finished after inner span has been activated to ensure that
// spans are written out together by TraceStructureWriter when running in strict mode
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public RequestSpan requestSpan(String requestName, RequestSpan requestParent) {

AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder("couchbase", spanName);
if (null != parent) {
builder.asChildOf(parent.context());
builder.asChildOf(parent.spanContext());
}
AgentSpan span = builder.start();
CouchbaseClientDecorator.DECORATE.afterStart(span);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public RequestSpan requestSpan(String requestName, RequestSpan requestParent) {
if (requestSpan == null) {
AgentTracer.SpanBuilder builder = tracer.singleSpanBuilder("couchbase", spanName);
if (null != parent) {
builder.asChildOf(parent.context());
builder.asChildOf(parent.spanContext());
}
AgentSpan span = builder.start();
CouchbaseClientDecorator.DECORATE.afterStart(span);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static AgentScope onEnter(
}
final AgentSpan span =
startSpan("dropwizard-view", "view.render").setTag(Tags.COMPONENT, "dropwizard-view");
span.context().setIntegrationName("dropwizard-view");
span.spanContext().setIntegrationName("dropwizard-view");
span.setResourceName("View " + view.getTemplateName());
return activateSpan(span);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public InstrumentationContext<Document> beginParse(
InstrumentationExecutionParameters parameters) {
State state = parameters.getInstrumentationState();
final AgentSpan parsingSpan =
startSpan(GRAPHQL_JAVA.toString(), GRAPHQL_PARSING, state.getRequestSpan().context());
startSpan(GRAPHQL_JAVA.toString(), GRAPHQL_PARSING, state.getRequestSpan().spanContext());
DECORATE.afterStart(parsingSpan);
return new ParsingInstrumentationContext(parsingSpan, state, parameters.getQuery());
}
Expand All @@ -113,7 +113,8 @@ public InstrumentationContext<List<ValidationError>> beginValidation(
State state = parameters.getInstrumentationState();

final AgentSpan validationSpan =
startSpan(GRAPHQL_JAVA.toString(), GRAPHQL_VALIDATION, state.getRequestSpan().context());
startSpan(
GRAPHQL_JAVA.toString(), GRAPHQL_VALIDATION, state.getRequestSpan().spanContext());
DECORATE.afterStart(validationSpan);
return new ValidationInstrumentationContext(validationSpan);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public InstrumentationContext<Document> beginParse(
AgentTracer.startSpan(
GraphQLDecorator.GRAPHQL_JAVA.toString(),
GraphQLDecorator.GRAPHQL_PARSING,
state.getRequestSpan().context());
state.getRequestSpan().spanContext());
GraphQLDecorator.DECORATE.afterStart(parsingSpan);
return new ParsingInstrumentationContext(parsingSpan, state, parameters.getQuery());
}
Expand All @@ -137,7 +137,7 @@ public InstrumentationContext<List<ValidationError>> beginValidation(
AgentTracer.startSpan(
GraphQLDecorator.GRAPHQL_JAVA.toString(),
GraphQLDecorator.GRAPHQL_VALIDATION,
state.getRequestSpan().context());
state.getRequestSpan().spanContext());
GraphQLDecorator.DECORATE.afterStart(validationSpan);
return new ValidationInstrumentationContext(validationSpan);
}
Expand Down
Loading