8000 Document async limitations of SDK · Dynatrace/OneAgent-SDK-for-Java@9d76ddc · GitHub
[go: up one dir, main page]

Skip to content

Commit 9d76ddc

Browse files
committed
< 10000 /div>
Document async limitations of SDK
1 parent b840b04 commit 9d76ddc

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ To trace any kind of call you first need to create a Tracer. The Tracer object r
141141
you want to call. A Tracer serves two purposes. First, to time the call (duration, cpu and more) and report errors. That is why
142142
each Tracer has these three methods. The error method must be called only once, and it must be in between start and end.
143143

144+
A Tracer instance can only be used from the thread on which it was created.
145+
See [in process linking](#in-process-linking) for tracing across thread boundaries, and see further below in this section
146+
for how to cross process boundaries.
147+
144148
```Java
145149
void start();
146150

@@ -149,12 +153,24 @@ void error(String message);
149153
void end();
150154
```
151155

156+
`start()` records the active PurePath node on the current Java thread
157+
as parent (if any; whether created by another Tracer or the OneAgent), creates a new PurePath node
158+
and sets the new one as the currently active one. The OneAgent also requires that a child node ends
159+
before all parent nodes (Stated another way, tracers on the same thread must be ended in the opposite
160+
order of how they were started. While this may sound odd if you hear it the first time, it corresponds
161+
to the most natural usage pattern and you usually don't even need to think about it).
162+
163+
While the tracer's automatic parent-child relationship works very intuitively in most cases,
164+
it does not work with **asynchronous patterns**, where the same thread handles multiple logically
165+
separate operations in an interleaved way on the same Java thread. If you need to instrument
166+
such patterns, it is recommended to use the OneAgent's [OpenTelemetry interoperability][oa-otel].
167+
168+
[oa-otel]: https://www.dynatrace.com/support/help/shortlink/opent-java
169+
152170
The second purpose of a Tracer is to allow tracing across process boundaries. To achieve that these kind of traces supply so called
153171
tags. Tags are strings or byte arrays that enable Dynatrace to trace a transaction end to end. As such the tag is the one information
154172
that you need to transport across these calls as an SDK user.
155173

156-
A Tracer instance can only be used from the thread on which it was created. See [in process linking](#in-process-linking) for tracing across thread boundaries.
157-
158174
## Features
159175

160176
The feature sets differ slightly with each language implementation. More functionality will be added over time, see <a href="https://answers.dynatrace.com/spaces/483/dynatrace-product-ideas/idea/198106/planned-features-for-oneagent-sdk.html" target="_blank">Planned features for OneAgent SDK</a>

0 commit comments

Comments
 (0)
0