Skip to content

Commit 021d442

Browse files
committed
document sentry.origin log attribute
1 parent 75ce009 commit 021d442

File tree

2 files changed

+20
-9
lines changed

2 files changed

+20
-9
lines changed

develop-docs/sdk/telemetry/logs.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,14 @@ Example:
285285
}
286286
```
287287

288+
If a log is generated by an SDK integration, the SDK should also set the `sentry.origin` attribute, as per the [Trace Origin](./traces/trace-origin/) documentation. It is assumed that logs without a `sentry.origin` attribute are manually created by the user.
289+
290+
```json
291+
{
292+
"sentry.origin": "auto.db.graphql"
293+
}
294+
```
295+
288296
Beyond these attributes, we are exploring if the SDK should also send OS, user, and device information automatically (via reading the appropriate contexts from the scope). Given this behaviour can easily be added as a new feature to the SDK, it does not have to be part of the initial SDK implementation until we make a finalized decision.
289297

290298
### SDK Integrations

develop-docs/sdk/telemetry/traces/trace-origin.mdx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
title: Trace Origin
33
---
44

5-
Trace origin indicates what created a trace or a span. Not all traces and spans contain enough information
5+
Trace origin indicates what created a trace, span or log. Not all traces, spans or logs contain enough information
66
to tell whether the user or what precisely in the SDK created it. Origin solves this problem. Origin can be sent with
7-
the <Link to="/sdk/data-model/event-payloads/contexts/#trace-context">trace context</Link> or <Link to="/sdk/data-model/event-payloads/span/">spans</Link>.
8-
The SDKs should set this value automatically. It is not expected to be set manually by users. The value for origin should rarely change so that we can run proper analytics on them.
7+
the <Link to="/sdk/data-model/event-payloads/contexts/#trace-context">trace context</Link>, <Link to="/sdk/data-model/event-payloads/span/">spans</Link>, or <Link to="/sdk/telemetry/logs/">logs</Link>.
8+
9+
For logs and standalone spans, the origin should be set as the `sentry.origin` attribute key.
910

11+
The SDKs should set this value automatically. It is not expected to be set manually by users. The value for origin should rarely change so that we can run proper analytics on them.
1012

1113
The origin is of type `string` and consists of four parts: `<type>.<category>.<integration-name>.<integration-part>`.
1214
Only the first is mandatory. The parts build upon each other, meaning it is forbidden
@@ -28,12 +30,10 @@ to skip one part. For example, you may send parts one and two but aren't allowed
2830

2931
: _Optional_. Is the part of the integration of the SDK that created the trace or span. This is only useful when one integration creates multiple traces or spans, and you'd like to differentiate. Therefore, most of the time, this will be omitted.
3032

31-
3233
All parts can only contain:
3334

34-
* Alphanumeric characters: `a-z` , `A-Z` , and `0-9`.
35-
* Underscores: `_`
36-
35+
- Alphanumeric characters: `a-z` , `A-Z` , and `0-9`.
36+
- Underscores: `_`
3737

3838
### Examples
3939

@@ -53,7 +53,7 @@ All parts can only contain:
5353
- `auto.db.core_data`
5454
- `auto.db.graphql`
5555

56-
Origins of type `manual` can also have categories and integration names. For example, for the <Link to="/sdk/performance/time-to-initial-full-display/">time to display feature</Link>, the user manually calls an API of the SDK,
56+
Origins of type `manual` can also have categories and integration names. For example, for the <Link to="/sdk/performance/time-to-initial-full-display/">time to display feature</Link>, the user manually calls an API of the SDK,
5757
creating a span. In this case, the SDK can tell what created the span, but the user did it manually. On the other hand, the SDK also
5858
automatically creates a span. In this case we end up with the following origins:
5959

@@ -63,5 +63,8 @@ automatically creates a span. In this case we end up with the following origins:
6363
## See also:
6464

6565
- <Link to="/sdk/data-model/event-payloads/span/">Span Interface</Link>
66-
- <Link to="/sdk/data-model/event-payloads/contexts/#trace-context">Trace Context</Link>
66+
- <Link to="/sdk/data-model/event-payloads/contexts/#trace-context">
67+
Trace Context
68+
</Link>
69+
- <Link to="/sdk/telemetry/logs/">Logs Interface</Link>
6770
- Related [RFC](https://github.com/getsentry/rfcs/pull/73/);

0 commit comments

Comments
 (0)