Skip to content

Commit 2c01cdc

Browse files
mjqclaude
andauthored
feat(attributes): Add sentry.category attribute (#218)
feat(attributes): Add sentry.category attribute This attribute categorizes spans into their appropriate Insights module. The category is derived from the span operation or span attributes. --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent a437cf4 commit 2c01cdc

File tree

6 files changed

+76
-1
lines changed

6 files changed

+76
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- feat(ai): Add gen_ai.usage.input_tokens.cache_write ([#217](https://github.com/getsentry/sentry-conventions/pull/217))
1010
- feat(attributes): Add sentry.normalized_db_query.hash ([#200](https://github.com/getsentry/sentry-conventions/pull/200))
11+
- feat(attributes): Add sentry.category attribute ([#218](https://github.com/getsentry/sentry-conventions/pull/218))
1112

1213
## 0.3.1
1314

generated/attributes/all.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
This page lists all available attributes across all categories.
66

7-
Total attributes: 414
7+
Total attributes: 415
88

99
## Stable Attributes
1010

@@ -239,6 +239,7 @@ Total attributes: 414
239239
| [`rpc.service`](./rpc.md#rpcservice) | The full (logical) name of the service being called, including its package name, if applicable. |
240240
| [`sentry.action`](./sentry.md#sentryaction) | Used as a generic attribute representing the action depending on the type of span. For instance, this is the database query operation for DB spans, and the request method for HTTP spans. |
241241
| [`sentry.cancellation_reason`](./sentry.md#sentrycancellation_reason) | The reason why a span ended early. |
242+
| [`sentry.category`](./sentry.md#sentrycategory) | The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'. |
242243
| [`sentry.client_sample_rate`](./sentry.md#sentryclient_sample_rate) | Rate at which a span was sampled in the SDK. |
243244
| [`sentry.description`](./sentry.md#sentrydescription) | The human-readable description of a span. |
244245
| [`sentry.dist`](./sentry.md#sentrydist) | The sentry dist. |

generated/attributes/sentry.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- [Stable Attributes](#stable-attributes)
66
- [sentry.action](#sentryaction)
77
- [sentry.cancellation_reason](#sentrycancellation_reason)
8+
- [sentry.category](#sentrycategory)
89
- [sentry.client_sample_rate](#sentryclient_sample_rate)
910
- [sentry.description](#sentrydescription)
1011
- [sentry.dist](#sentrydist)
@@ -79,6 +80,17 @@ The reason why a span ended early.
7980
| Exists in OpenTelemetry | No |
8081
| Example | `document.hidden` |
8182

83+
### sentry.category
84+
85+
The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'.
86+
87+
| Property | Value |
88+
| --- | --- |
89+
| Type | `string` |
90+
| Has PII | false |
91+
| Exists in OpenTelemetry | No |
92+
| Example | `db` |
93+
8294
### sentry.client_sample_rate
8395

8496
Rate at which a span was sampled in the SDK.

javascript/sentry-conventions/src/attributes.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6258,6 +6258,26 @@ export const SENTRY_CANCELLATION_REASON = 'sentry.cancellation_reason';
62586258
*/
62596259
export type SENTRY_CANCELLATION_REASON_TYPE = string;
62606260

6261+
// Path: model/attributes/sentry/sentry__category.json
6262+
6263+
/**
6264+
* The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'. `sentry.category`
6265+
*
6266+
* Attribute Value Type: `string` {@link SENTRY_CATEGORY_TYPE}
6267+
*
6268+
* Contains PII: false
6269+
*
6270+
* Attribute defined in OTEL: No
6271+
*
6272+
* @example "db"
6273+
*/
6274+
export const SENTRY_CATEGORY = 'sentry.category';
6275+
6276+
/**
6277+
* Type for {@link SENTRY_CATEGORY} sentry.category
6278+
*/
6279+
export type SENTRY_CATEGORY_TYPE = string;
6280+
62616281
// Path: model/attributes/sentry/sentry__client_sample_rate.json
62626282

62636283
/**
@@ -8942,6 +8962,7 @@ export const ATTRIBUTE_TYPE: Record<string, AttributeType> = {
89428962
[SENTRY_BROWSER_NAME]: 'string',
89438963
[SENTRY_BROWSER_VERSION]: 'string',
89448964
[SENTRY_CANCELLATION_REASON]: 'string',
8965+
[SENTRY_CATEGORY]: 'string',
89458966
[SENTRY_CLIENT_SAMPLE_RATE]: 'double',
89468967
[SENTRY_DESCRIPTION]: 'string',
89478968
[SENTRY_DIST]: 'string',
@@ -9359,6 +9380,7 @@ export type AttributeName =
93599380
| typeof SENTRY_BROWSER_NAME
93609381
| typeof SENTRY_BROWSER_VERSION
93619382
| typeof SENTRY_CANCELLATION_REASON
9383+
| typeof SENTRY_CATEGORY
93629384
| typeof SENTRY_CLIENT_SAMPLE_RATE
93639385
| typeof SENTRY_DESCRIPTION
93649386
| typeof SENTRY_DIST
@@ -12619,6 +12641,16 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
1261912641
isInOtel: false,
1262012642
example: 'document.hidden',
1262112643
},
12644+
[SENTRY_CATEGORY]: {
12645+
brief:
12646+
"The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'.",
12647+
type: 'string',
12648+
pii: {
12649+
isPii: 'false',
12650+
},
12651+
isInOtel: false,
12652+
example: 'db',
12653+
},
1262212654
[SENTRY_CLIENT_SAMPLE_RATE]: {
1262312655
brief: 'Rate at which a span was sampled in the SDK.',
1262412656
type: 'double',
@@ -14008,6 +14040,7 @@ export type Attributes = {
1400814040
[SENTRY_BROWSER_NAME]?: SENTRY_BROWSER_NAME_TYPE;
1400914041
[SENTRY_BROWSER_VERSION]?: SENTRY_BROWSER_VERSION_TYPE;
1401014042
[SENTRY_CANCELLATION_REASON]?: SENTRY_CANCELLATION_REASON_TYPE;
14043+
[SENTRY_CATEGORY]?: SENTRY_CATEGORY_TYPE;
1401114044
[SENTRY_CLIENT_SAMPLE_RATE]?: SENTRY_CLIENT_SAMPLE_RATE_TYPE;
1401214045
[SENTRY_DESCRIPTION]?: SENTRY_DESCRIPTION_TYPE;
1401314046
[SENTRY_DIST]?: SENTRY_DIST_TYPE;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"key": "sentry.category",
3+
"brief": "The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'.",
4+
"type": "string",
5+
"pii": {
6+
"key": "false"
7+
},
8+
"is_in_otel": false,
9+
"example": "db"
10+
}

python/src/sentry_conventions/attributes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3499,6 +3499,16 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
34993499
Example: "document.hidden"
35003500
"""
35013501

3502+
# Path: model/attributes/sentry/sentry__category.json
3503+
SENTRY_CATEGORY: Literal["sentry.category"] = "sentry.category"
3504+
"""The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'.
3505+
3506+
Type: str
3507+
Contains PII: false
3508+
Defined in OTEL: No
3509+
Example: "db"
3510+
"""
3511+
35023512
# Path: model/attributes/sentry/sentry__client_sample_rate.json
35033513
SENTRY_CLIENT_SAMPLE_RATE: Literal["sentry.client_sample_rate"] = (
35043514
"sentry.client_sample_rate"
@@ -7108,6 +7118,13 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
71087118
is_in_otel=False,
71097119
example="document.hidden",
71107120
),
7121+
"sentry.category": AttributeMetadata(
7122+
brief="The high-level category of a span, derived from the span operation or span attributes. This categorizes spans by their general purpose (e.g., database, HTTP, UI). Known values include: 'ai', 'ai.pipeline', 'app', 'browser', 'cache', 'console', 'db', 'event', 'file', 'function.aws', 'function.azure', 'function.gcp', 'function.nextjs', 'function.remix', 'graphql', 'grpc', 'http', 'measure', 'middleware', 'navigation', 'pageload', 'queue', 'resource', 'rpc', 'serialize', 'subprocess', 'template', 'topic', 'ui', 'ui.angular', 'ui.ember', 'ui.react', 'ui.svelte', 'ui.vue', 'view', 'websocket'.",
7123+
type=AttributeType.STRING,
7124+
pii=PiiInfo(isPii=IsPii.FALSE),
7125+
is_in_otel=False,
7126+
example="db",
7127+
),
71117128
"sentry.client_sample_rate": AttributeMetadata(
71127129
brief="Rate at which a span was sampled in the SDK.",
71137130
type=AttributeType.DOUBLE,
@@ -8255,6 +8272,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
82558272
"sentry.browser.name": str,
82568273
"sentry.browser.version": str,
82578274
"sentry.cancellation_reason": str,
8275+
"sentry.category": str,
82588276
"sentry.client_sample_rate": float,
82598277
"sentry.description": str,
82608278
"sentry.dist": str,

0 commit comments

Comments
 (0)