-
Notifications
You must be signed in to change notification settings - Fork 275
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
implement checkpoint API for profiler integration #2687
Conversation
// this test is kept close to pending trace despite not exercising | ||
// its methods directly because this is where the reponsibility lies | ||
// for emitting the checkpoints, and this is the least surprising place | ||
// for a test to fail when modifying PendingTrace |
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.
Thanks for the comment.
ROOT_SPAN.compareAndSet(this, null, span); | ||
PENDING_REFERENCE_COUNT.incrementAndGet(this); | ||
} | ||
|
||
void addFinishedSpan(final DDSpan span) { | ||
tracer.onFinish(span); |
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.
Are these new methods going to be added to the instrumentation or is PendingTrace sufficient?
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.
Instrumentation can be augmented to record CPU bound work, but I haven't found a concrete use case for this not already modelled with a synchronous span. Span start/finish are handled automatically. Thread migrations (from which queuing/idle time can be derived) are handled automatically, but may need to be patched in some instrumentations in cases where the Thread
API is used by the library and we're not using continuations for context propagation, so unlikely.
dd-trace-core/jfr-openjdk/src/main/java/datadog/trace/core/jfr/openjdk/CheckpointEvent.java
Show resolved
Hide resolved
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.
Looks good!
I have only some minor comments about the JFR event definition.
dd-trace-core/jfr-openjdk/src/main/java/datadog/trace/core/jfr/openjdk/CheckpointEvent.java
Outdated
Show resolved
Hide resolved
dd-trace-core/jfr-openjdk/src/main/java/datadog/trace/core/jfr/openjdk/CheckpointEvent.java
Outdated
Show resolved
Hide resolved
dd-trace-core/jfr-openjdk/src/main/java/datadog/trace/core/jfr/openjdk/JFRCheckpointer.java
Outdated
Show resolved
Hide resolved
@@ -349,7 +349,6 @@ public PendingTrace getTrace() { | |||
return trace; | |||
} | |||
|
|||
@Deprecated |
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.
😸
/** | ||
* Modifier tag to make an event an end event. The LSB is chosen to allow for good varint | ||
* compression. | ||
*/ |
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.
🔥
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.
👍
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.
🤓
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.
Nice. The only thing that feels weird is the imbalance in the onThreadMigration
and onAsyncResume
method names. Would be nice if they lined up better.
I have some ideas. |
5d93432
to
822cb58
Compare
Consistent |
822cb58
to
a337a8e
Compare
For naming consistency, I use |
a337a8e
to
5030de2
Compare
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.
LGTM!
Captures span start, finish and thread migration, allows instrumentation to trigger recording of CPU intensive work.
Mutually exclusive with scope events. Activated by
-Ddd.profiling.legacy.tracing.integration=false
(which disables scope events).