Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
d2cc4ec
Experimenting with introducing CoreSpanBuilder reuse
dougqh Sep 12, 2025
d83ff16
Adding protection against reusing a CoreSpanBuilder that's still in-use
dougqh Sep 15, 2025
045e4c9
spotless
dougqh Sep 15, 2025
95e6f17
Adding configuration option to control reuse of SpanBuilders
dougqh Sep 15, 2025
55b56e7
Adding explanatory comments
dougqh Sep 15, 2025
8de4b30
Enabling by default
dougqh Sep 16, 2025
8adfe8f
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Sep 16, 2025
5763a31
Adding reuse tests
dougqh Sep 16, 2025
353afa2
Merge branch 'dougqh/spanbuilder-pooling' of github.com:DataDog/dd-tr…
dougqh Sep 16, 2025
23b03b8
spotless
dougqh Sep 16, 2025
b588b7a
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Sep 16, 2025
68a6f03
Changed the API to be safe for atypical usage
dougqh Sep 16, 2025
ec730ec
Merge branch 'dougqh/spanbuilder-pooling' of github.com:DataDog/dd-tr…
dougqh Sep 16, 2025
2d22b41
Fleshing out tests
dougqh Sep 17, 2025
55bd500
spotless
dougqh Sep 17, 2025
2258db5
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Sep 17, 2025
079d1f5
Improving single threaded performance
dougqh Sep 17, 2025
a55095e
spotless
dougqh Sep 17, 2025
26482bf
Merge branch 'dougqh/spanbuilder-pooling' of github.com:DataDog/dd-tr…
dougqh Sep 17, 2025
e5161ef
Fixing test that renaming didn't update properly
dougqh Sep 18, 2025
40ba13d
Adding benchmarks for span creation
dougqh Sep 18, 2025
70eccff
spotless
dougqh Sep 18, 2025
5b594a2
Adding clarifying comments & more tests
dougqh Sep 18, 2025
65fa1d7
spotless
dougqh Sep 18, 2025
136329e
tweaking comments
dougqh Sep 18, 2025
2e7da54
More comments
dougqh Sep 18, 2025
98d5603
More comment clean-up
dougqh Sep 18, 2025
ff9acbe
Addressing review feedback
dougqh Sep 19, 2025
4475e42
Adding overload to just check major version
dougqh Oct 7, 2025
4d2ec09
Adding ThreadUtils
dougqh Oct 7, 2025
aea9d3b
Adding isVirtualThread check to reuseSingleSpanBuilder
dougqh Oct 7, 2025
8bb8f29
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Oct 7, 2025
6ed469b
Addressing review comments - reduced visibility
dougqh Oct 7, 2025
e26959d
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Oct 7, 2025
66f62fb
Update dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java
dougqh Oct 14, 2025
94970a4
Update internal-api/src/main/java/datadog/trace/bootstrap/instrumenta…
dougqh Oct 14, 2025
388a288
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Oct 14, 2025
86c03d9
Update dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java
dougqh Oct 14, 2025
8e3ee47
Fixing bad update from GitHub suggestion merge
dougqh Oct 15, 2025
0b968ae
Adding Javadoc
dougqh Oct 15, 2025
097e742
spotless
dougqh Oct 15, 2025
826f528
Update CoreTracer.java
dougqh Oct 15, 2025
bd4b957
Updating comments to reflect the usage logic was moved into start
dougqh Oct 15, 2025
e9cf952
Tweaking comments
dougqh Oct 15, 2025
55169c7
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh Oct 15, 2025
eb2996d
Improving test coverage
dougqh Oct 16, 2025
5fd6e1d
spotless
dougqh Oct 16, 2025
e46f8f5
A bit of clean-up - introducing some helper methods
dougqh Oct 16, 2025
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 @@ -107,6 +107,7 @@ public final class GeneralConfig {
public static final String OPTIMIZED_MAP_ENABLED = "optimized.map.enabled";
public static final String TAG_NAME_UTF8_CACHE_SIZE = "tag.name.utf8.cache.size";
public static final String TAG_VALUE_UTF8_CACHE_SIZE = "tag.value.utf8.cache.size";
public static final String SPAN_BUILDER_REUSE_ENABLED = "span.builder.reuse.enabled";
Copy link
Contributor Author

@dougqh dougqh Sep 15, 2025

Choose a reason for hiding this comment

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

I'm not sure if this is best class to be placing these in. Or if this is the proper namespace. dd.trace... might be better

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree dd.trace prefix fits better

public static final String STACK_TRACE_LENGTH_LIMIT = "stack.trace.length.limit";

public static final String SSI_INJECTION_ENABLED = "injection.enabled";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
package datadog.trace.core;

import static java.util.concurrent.TimeUnit.MICROSECONDS;

import datadog.trace.bootstrap.instrumentation.api.AgentSpan;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.Fork;
import org.openjdk.jmh.annotations.Measurement;
import org.openjdk.jmh.annotations.Mode;
import org.openjdk.jmh.annotations.OutputTimeUnit;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
import org.openjdk.jmh.annotations.Threads;
import org.openjdk.jmh.annotations.Warmup;

/**
* Benchmark of key operations of the CoreTracer
*
* <p>NOTE: This is a multi-threaded benchmark; single threaded benchmarks don't accurately reflect
* some of the optimizations.
*
* <p>Use -t 1, if you'd like to do a single threaded run
*/
@State(Scope.Benchmark)
@Warmup(iterations = 3)
@Measurement(iterations = 5)
@BenchmarkMode(Mode.Throughput)
@Threads(8)
@OutputTimeUnit(MICROSECONDS)
@Fork(value = 1)
public class CoreTracerBenchmark {
static final CoreTracer TRACER = CoreTracer.builder().build();

@Benchmark
public AgentSpan startSpan() {
return TRACER.startSpan("foo", "bar");
}

@Benchmark
public AgentSpan buildSpan() {
return TRACER.buildSpan("foo", "bar").start();
}

@Benchmark
public AgentSpan singleSpanBuilder() {
return TRACER.singleSpanBuilder("foo", "bar").start();
}
}
Loading