Skip to content

Commit d0e5276

Browse files
authored
ref(profiling): add transaction payload context section to the docs (#11287)
* add transaction payload context doc section
1 parent 6f4944e commit d0e5276

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

develop-docs/sdk/telemetry/profiles/sample-format-v2.mdx

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,3 +293,69 @@ This envelope should look like this:
293293
{"type":"profile_chunk"}
294294
{ /* profile_chunk JSON payload */}
295295
````
296+
297+
## Modifying Transactions Payload
298+
299+
Additional context needs to be attached to the *transactions/spans* payloads for continuous profiling to be connected to tracing.
300+
301+
1. Profile Context:
302+
303+
The profile context for a transaction needs to be updated to contain the profiler id so it can be associated back to the transaction.
304+
The context at `.contexts.profile` should look like:
305+
306+
```json
307+
{
308+
"profiler_id": "42928c7ee9174231956f077581145489"
309+
}
310+
```
311+
312+
2. Trace Context
313+
314+
The trace context for a transaction needs to be updated to contain the active `thread id` so we know which thread is associated with the transaction. This is often implemented as the thread that the transaction was started in.
315+
316+
The context at `.contexts.trace` should look like:
317+
318+
```json
319+
{
320+
"data": {
321+
"thread.id": "thread id",
322+
"thread.name": "thread name",
323+
},
324+
// existing trace context
325+
}
326+
```
327+
328+
`thread.id`
329+
330+
*String, required.* This should be a string that matches the thread id in the *thread_metadata* of the profile chunk.
331+
332+
`thread.name`
333+
334+
*String, optional.* This should be a string that matches the thread name in the *thread_metadata* of the profile chunk.
335+
336+
3. Span Data
337+
338+
Span data needs to be updated in order for a span to contain the active *thread id* so we know which thread is associated with the transaction.
339+
This is often implemented as the thread that the transaction was started in.
340+
341+
The data at `.spans[].data` should look like:
342+
343+
```json
344+
{
345+
"thread.id": "thread id",
346+
"thread.name": "thread name",
347+
"profiler_id": "42928c7ee9174231956f077581145489"
348+
}
349+
```
350+
351+
`thread.id`
352+
353+
*String, required.* This should be a string that matches the thread id in the *thread_metadata* of the profile chunk.
354+
355+
`thread.name`
356+
357+
*String, optional.* This should be a string that matches the thread name in the *thread_metadata* of the profile chunk.
358+
359+
`profiler_id`
360+
361+
*String, optional.* To override the one from the trace context but should not be necessary.

0 commit comments

Comments
 (0)