-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
feat(spans): Document trace attachments #15705
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
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -113,6 +113,58 @@ file. It is always associated to an event or transaction. | |
|
|
||
| : _String, optional._ The content type of the attachment payload. Any [MIME type](https://www.iana.org/assignments/media-types/media-types.xhtml) may be used; the default is `application/octet-stream`. | ||
|
|
||
| ### Trace Attachment | ||
|
|
||
| Item type `"attachment"` with content type `"application/vnd.sentry.attachment.v2"`. This item contains a raw payload of an attachment together with metadata. Contrary to V1 attachments, trace attachments are only optionally associated with other trace items (spans, logs, ...). Their main association is with the trace itself. | ||
|
|
||
| **Envelope Headers:** | ||
|
|
||
| - `trace` (optional): If the envelope containing the trace attachment has a [Dynamic Sampling Context](/sdk/telemetry/traces/dynamic-sampling-context.md), it will be subject to trace-based dynamic sampling rules, and potentially dropped. | ||
|
|
||
| **Item Headers:** | ||
|
|
||
| The trace attachment item header must contain the following properties: | ||
|
|
||
| ```json | ||
| { | ||
| "type": "attachment", | ||
| "content_type": "application/vnd.sentry.attachment.v2", | ||
| "length": 212341234, | ||
| "meta_length": 123 | ||
| } | ||
| ``` | ||
|
Comment on lines
+128
to
+135
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: The 🔍 Detailed AnalysisThe 💡 Suggested FixUpdate 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I deliberately did not document the header here to avoid confusion. |
||
|
|
||
| - `meta_length` is the size of the metadata portion of the payload in bytes (see item description below). | ||
|
|
||
|
|
||
| **Item Payload:** | ||
|
|
||
| The trace attachment item payload consists of JSON object containing metadata followed by the attachment body. For example, for a plain text attachment with the body "helloworld", the item payload would look like this: | ||
jjbayer marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ```json | ||
| { // Attachment Metadata | ||
| "trace_id": "12312012123120121231201212312012", | ||
| "attachment_id": "019a72d07ffe77208c013ac888b38d9e", | ||
| "timestamp": 1760520026.781239, | ||
| "filename": "myfile.txt", | ||
| "content_type": "text/plain", | ||
| "attributes": { | ||
| // Arbitrary key value pairs that will end up in EAP. | ||
| "foo": {"type": "string", "value": "bar"} | ||
| } | ||
| }helloworld | ||
| ``` | ||
|
|
||
| | Property | Type | Required | Description | | ||
| |----------|------|----------|-------------| | ||
| | `trace_id` | string | Yes | The trace ID. Determines which `trace` the attachment belongs to. 32-character hexadecimal string. | | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So to send a span attachment one needs to set both the
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. |
||
| | `attachment_id` | string | Yes | 32-character hexadecimal string (a valid [Version 7](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_7_(timestamp_and_random)) or Version 4 UUID without dashes) | | ||
| | `timestamp` | float | Yes | a UNIX timestamp corresponding to the attachment's occurrence. It may be the same as the start or end timestamp of the owner span. | | ||
| | `filename` | string | No | The file name of the attachment. | | ||
| | `content_type` | string | Yes | the content type of the attachment body (not to be confused with the content type of the envelope item, which is always `application/vnd.sentry.attachment.v2`). | | ||
| | `attributes` | object | No | arbitrary attributes that will be queryable on the attachment trace item, similar to spans, logs, and trace metrics. | | ||
|
|
||
|
|
||
| ### Session | ||
|
|
||
| Item type `"session"` contains a single session initialization or update to an | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.