-
Notifications
You must be signed in to change notification settings - Fork 314
Reuse SpanBuilder within a Thread #9537
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dougqh
wants to merge
48
commits into
master
Choose a base branch
from
dougqh/spanbuilder-pooling
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
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 d83ff16
Adding protection against reusing a CoreSpanBuilder that's still in-use
dougqh 045e4c9
spotless
dougqh 95e6f17
Adding configuration option to control reuse of SpanBuilders
dougqh 55b56e7
Adding explanatory comments
dougqh 8de4b30
Enabling by default
dougqh 8adfe8f
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh 5763a31
Adding reuse tests
dougqh 353afa2
Merge branch 'dougqh/spanbuilder-pooling' of github.com:DataDog/dd-tr…
dougqh 23b03b8
spotless
dougqh b588b7a
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh 68a6f03
Changed the API to be safe for atypical usage
dougqh ec730ec
Merge branch 'dougqh/spanbuilder-pooling' of github.com:DataDog/dd-tr…
dougqh 2d22b41
Fleshing out tests
dougqh 55bd500
spotless
dougqh 2258db5
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh 079d1f5
Improving single threaded performance
dougqh a55095e
spotless
dougqh 26482bf
Merge branch 'dougqh/spanbuilder-pooling' of github.com:DataDog/dd-tr…
dougqh e5161ef
Fixing test that renaming didn't update properly
dougqh 40ba13d
Adding benchmarks for span creation
dougqh 70eccff
spotless
dougqh 5b594a2
Adding clarifying comments & more tests
dougqh 65fa1d7
spotless
dougqh 136329e
tweaking comments
dougqh 2e7da54
More comments
dougqh 98d5603
More comment clean-up
dougqh ff9acbe
Addressing review feedback
dougqh 4475e42
Adding overload to just check major version
dougqh 4d2ec09
Adding ThreadUtils
dougqh aea9d3b
Adding isVirtualThread check to reuseSingleSpanBuilder
dougqh 8bb8f29
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh 6ed469b
Addressing review comments - reduced visibility
dougqh e26959d
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh 66f62fb
Update dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java
dougqh 94970a4
Update internal-api/src/main/java/datadog/trace/bootstrap/instrumenta…
dougqh 388a288
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh 86c03d9
Update dd-trace-core/src/main/java/datadog/trace/core/CoreTracer.java
dougqh 8e3ee47
Fixing bad update from GitHub suggestion merge
dougqh 0b968ae
Adding Javadoc
dougqh 097e742
spotless
dougqh 826f528
Update CoreTracer.java
dougqh bd4b957
Updating comments to reflect the usage logic was moved into start
dougqh e9cf952
Tweaking comments
dougqh 55169c7
Merge branch 'master' into dougqh/spanbuilder-pooling
dougqh eb2996d
Improving test coverage
dougqh 5fd6e1d
spotless
dougqh e46f8f5
A bit of clean-up - introducing some helper methods
dougqh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
dd-trace-core/src/jmh/java/datadog/trace/core/CoreTracerBenchmark.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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