Skip to content

Commit 0106a4c

Browse files
committed
WIP Context.with optimization for AgentSpan
1 parent 0a1baef commit 0106a4c

File tree

1 file changed

+8
-0
lines changed
  • internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api

1 file changed

+8
-0
lines changed

internal-api/src/main/java/datadog/trace/bootstrap/instrumentation/api/AgentSpan.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,4 +216,12 @@ default <T> T get(@Nonnull ContextKey<T> key) {
216216
default <T> Context with(@Nonnull ContextKey<T> key, @Nullable T value) {
217217
return SPAN_KEY == key ? (Context) value : Context.root().with(SPAN_KEY, this, key, value);
218218
}
219+
220+
@Override
221+
default Context with(@Nullable ImplicitContextKeyed value) {
222+
if (value instanceof AgentSpan) {
223+
return (AgentSpan) value;
224+
}
225+
return Context.super.with(value);
226+
}
219227
}

0 commit comments

Comments
 (0)