-
Notifications
You must be signed in to change notification settings - Fork 293
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
Add support for TracerDump in TracerFlare #8053
Open
mhlidd
wants to merge
23
commits into
master
Choose a base branch
from
mhlidd/pending_traces
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 all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
971cd6e
adding tracerflare.addtext
mhlidd 57e67bb
adding class to handle tracerdump
mhlidd 2c27bbf
updating flare to implement reporter and store only root spans
mhlidd 3490fe8
updating PR comments
mhlidd 3e4955a
rebasing
mhlidd 6e54dd5
changing getSpans header
mhlidd 71f0b75
Adding DumpElement, DumpDrain, and DumpSupplier to extract PendingTraces
mhlidd 8347f8a
addressing PR comments
mhlidd bbb6cf4
limiting number of tracers in tracer flare and sorting by oldest first
mhlidd d76cf04
removing unused log
mhlidd 7504373
updating comparator
mhlidd d2fc878
saving changes
mhlidd c6ed471
initial implementation of test
mhlidd f0e32d2
updating test
mhlidd 6350ea9
feat(core): Use prepare for flare to signal dump element
PerfectSlayer c32c5b6
feat(core): Update test prevent the span to be written early
PerfectSlayer e6ad777
fix(core): Fix tests
PerfectSlayer 8ce4e96
fix(core): Reduce scope
PerfectSlayer 0ff9b1e
fix(core): Revert drain limit
PerfectSlayer 3a8b13c
feat(core): Refactor action elements
PerfectSlayer 8974d0b
adding support for json encoding of traces
mhlidd 80979c8
cleanup
mhlidd 0b3278d
renaming file
mhlidd 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 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
30 changes: 30 additions & 0 deletions
30
dd-trace-core/src/main/java/datadog/trace/common/writer/TraceDumpJsonExporter.java
This file contains 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,30 @@ | ||
package datadog.trace.common.writer; | ||
|
||
import com.squareup.moshi.JsonAdapter; | ||
import com.squareup.moshi.Moshi; | ||
import com.squareup.moshi.Types; | ||
import datadog.trace.core.DDSpan; | ||
import java.util.List; | ||
|
||
public class TraceDumpJsonExporter { | ||
|
||
private StringBuilder dumpText; | ||
private static final JsonAdapter<List<DDSpan>> TRACE_ADAPTER = | ||
new Moshi.Builder() | ||
.add(DDSpanJsonAdapter.buildFactory(false)) | ||
.build() | ||
.adapter(Types.newParameterizedType(List.class, DDSpan.class)); | ||
|
||
public TraceDumpJsonExporter() { | ||
dumpText = new StringBuilder(); | ||
} | ||
|
||
public void addTrace(final List<DDSpan> trace) { | ||
dumpText.append(TRACE_ADAPTER.toJson(trace)); | ||
dumpText.append("\n"); | ||
} | ||
|
||
public String getDumpText() { | ||
return dumpText.toString(); | ||
} | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
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.
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.
🟠 Code Quality Violation
StringBuilder can lead to memory leaks in long lasting classes (...read more)
StringBuffers and StringBuilders have the potential to grow significantly, which could lead to memory leaks if they are retained within objects with extended lifetimes.