Skip to content

Commit 0f5058d

Browse files
mjqclaude
andauthored
feat(attributes): Add sentry.status_code attribute (#223)
Add new sentry.status_code attribute for tracking HTTP status codes in Sentry Insights. This is set by Relay during ingestion (formerly a Sentry tag) and used by the Outbound API Requests insights module. --------- Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent b056c89 commit 0f5058d

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
@@ -10,6 +10,7 @@
1010
- feat(attributes): Add sentry.normalized_db_query.hash ([#200](https://github.com/getsentry/sentry-conventions/pull/200))
1111
- feat(attributes): Add sentry.category attribute ([#218](https://github.com/getsentry/sentry-conventions/pull/218))
1212
- Add new Gen AI attributes ([#221](https://github.com/getsentry/sentry-conventions/pull/221))
13+
- Add sentry.status_code attribute ([#223](https://github.com/getsentry/sentry-conventions/pull/223))
1314
- Backfill `db.system` attribute ([#224](https://github.com/getsentry/sentry-conventions/pull/224))
1415

1516
## 0.3.1

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: 421
7+
Total attributes: 422
88

99
## Stable Attributes
1010

@@ -283,6 +283,7 @@ Total attributes: 421
283283
| [`sentry.segment.name`](./sentry.md#sentrysegmentname) | The segment name of a span |
284284
| [`sentry.server_sample_rate`](./sentry.md#sentryserver_sample_rate) | Rate at which a span was sampled in Relay. |
285285
| [`sentry.span.source`](./sentry.md#sentryspansource) | The source of a span, also referred to as transaction source. Known values are: `'custom'`, `'url'`, `'route'`, `'component'`, `'view'`, `'task'`. |
286+
| [`sentry.status_code`](./sentry.md#sentrystatus_code) | The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients. |
286287
| [`sentry.status.message`](./sentry.md#sentrystatusmessage) | The from OTLP extracted status message. |
287288
| [`sentry.trace.parent_span_id`](./sentry.md#sentrytraceparent_span_id) | The span id of the span that was active when the log was collected. This should not be set if there was no active span. |
288289
| [`sentry.transaction`](./sentry.md#sentrytransaction) | The sentry transaction (segment name). |

generated/attributes/sentry.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
- [sentry.segment.name](#sentrysegmentname)
4949
- [sentry.server_sample_rate](#sentryserver_sample_rate)
5050
- [sentry.span.source](#sentryspansource)
51+
- [sentry.status_code](#sentrystatus_code)
5152
- [sentry.status.message](#sentrystatusmessage)
5253
- [sentry.trace.parent_span_id](#sentrytraceparent_span_id)
5354
- [sentry.transaction](#sentrytransaction)
@@ -557,6 +558,17 @@ The source of a span, also referred to as transaction source. Known values are:
557558
| Exists in OpenTelemetry | No |
558559
| Example | `route` |
559560

561+
### sentry.status_code
562+
563+
The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients.
564+
565+
| Property | Value |
566+
| --- | --- |
567+
| Type | `integer` |
568+
| Has PII | false |
569+
| Exists in OpenTelemetry | No |
570+
| Example | `200` |
571+
560572
### sentry.status.message
561573

562574
The from OTLP extracted status message.

javascript/sentry-conventions/src/attributes.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7274,6 +7274,26 @@ export const SENTRY_SPAN_SOURCE = 'sentry.span.source';
72747274
*/
72757275
export type SENTRY_SPAN_SOURCE_TYPE = string;
72767276

7277+
// Path: model/attributes/sentry/sentry__status_code.json
7278+
7279+
/**
7280+
* The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients. `sentry.status_code`
7281+
*
7282+
* Attribute Value Type: `number` {@link SENTRY_STATUS_CODE_TYPE}
7283+
*
7284+
* Contains PII: false
7285+
*
7286+
* Attribute defined in OTEL: No
7287+
*
7288+
* @example 200
7289+
*/
7290+
export const SENTRY_STATUS_CODE = 'sentry.status_code';
7291+
7292+
/**
7293+
* Type for {@link SENTRY_STATUS_CODE} sentry.status_code
7294+
*/
7295+
export type SENTRY_STATUS_CODE_TYPE = number;
7296+
72777297
// Path: model/attributes/sentry/sentry__status__message.json
72787298

72797299
/**
@@ -9137,6 +9157,7 @@ export const ATTRIBUTE_TYPE: Record<string, AttributeType> = {
91379157
[SENTRY_SEGMENT_NAME]: 'string',
91389158
[SENTRY_SERVER_SAMPLE_RATE]: 'double',
91399159
[SENTRY_SPAN_SOURCE]: 'string',
9160+
[SENTRY_STATUS_CODE]: 'integer',
91409161
[SENTRY_STATUS_MESSAGE]: 'string',
91419162
[SENTRY_TRACE_PARENT_SPAN_ID]: 'string',
91429163
[SENTRY_TRANSACTION]: 'string',
@@ -9561,6 +9582,7 @@ export type AttributeName =
95619582
| typeof SENTRY_SEGMENT_NAME
95629583
| typeof SENTRY_SERVER_SAMPLE_RATE
95639584
| typeof SENTRY_SPAN_SOURCE
9585+
| typeof SENTRY_STATUS_CODE
95649586
| typeof SENTRY_STATUS_MESSAGE
95659587
| typeof SENTRY_TRACE_PARENT_SPAN_ID
95669588
| typeof SENTRY_TRANSACTION
@@ -13269,6 +13291,16 @@ export const ATTRIBUTE_METADATA: Record<AttributeName, AttributeMetadata> = {
1326913291
isInOtel: false,
1327013292
example: 'route',
1327113293
},
13294+
[SENTRY_STATUS_CODE]: {
13295+
brief:
13296+
'The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients.',
13297+
type: 'integer',
13298+
pii: {
13299+
isPii: 'false',
13300+
},
13301+
isInOtel: false,
13302+
example: 200,
13303+
},
1327213304
[SENTRY_STATUS_MESSAGE]: {
1327313305
brief: 'The from OTLP extracted status message.',
1327413306
type: 'string',
@@ -14301,6 +14333,7 @@ export type Attributes = {
1430114333
[SENTRY_SEGMENT_NAME]?: SENTRY_SEGMENT_NAME_TYPE;
1430214334
[SENTRY_SERVER_SAMPLE_RATE]?: SENTRY_SERVER_SAMPLE_RATE_TYPE;
1430314335
[SENTRY_SPAN_SOURCE]?: SENTRY_SPAN_SOURCE_TYPE;
14336+
[SENTRY_STATUS_CODE]?: SENTRY_STATUS_CODE_TYPE;
1430414337
[SENTRY_STATUS_MESSAGE]?: SENTRY_STATUS_MESSAGE_TYPE;
1430514338
[SENTRY_TRACE_PARENT_SPAN_ID]?: SENTRY_TRACE_PARENT_SPAN_ID_TYPE;
1430614339
[SENTRY_TRANSACTION]?: SENTRY_TRANSACTION_TYPE;
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"key": "sentry.status_code",
3+
"brief": "The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients.",
4+
"type": "integer",
5+
"pii": {
6+
"key": "false"
7+
},
8+
"is_in_otel": false,
9+
"example": 200
10+
}

python/src/sentry_conventions/attributes.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4061,6 +4061,16 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
40614061
Example: "foobar"
40624062
"""
40634063

4064+
# Path: model/attributes/sentry/sentry__status_code.json
4065+
SENTRY_STATUS_CODE: Literal["sentry.status_code"] = "sentry.status_code"
4066+
"""The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients.
4067+
4068+
Type: int
4069+
Contains PII: false
4070+
Defined in OTEL: No
4071+
Example: 200
4072+
"""
4073+
40644074
# Path: model/attributes/sentry/sentry__trace__parent_span_id.json
40654075
SENTRY_TRACE_PARENT_SPAN_ID: Literal["sentry.trace.parent_span_id"] = (
40664076
"sentry.trace.parent_span_id"
@@ -7571,6 +7581,13 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
75717581
is_in_otel=False,
75727582
example="foobar",
75737583
),
7584+
"sentry.status_code": AttributeMetadata(
7585+
brief="The HTTP status code used in Sentry Insights. Typically set by Sentry during ingestion, rather than by clients.",
7586+
type=AttributeType.INTEGER,
7587+
pii=PiiInfo(isPii=IsPii.FALSE),
7588+
is_in_otel=False,
7589+
example=200,
7590+
),
75747591
"sentry.trace.parent_span_id": AttributeMetadata(
75757592
brief="The span id of the span that was active when the log was collected. This should not be set if there was no active span.",
75767593
type=AttributeType.STRING,
@@ -8448,6 +8465,7 @@ class ATTRIBUTE_NAMES(metaclass=_AttributeNamesMeta):
84488465
"sentry.server_sample_rate": float,
84498466
"sentry.span.source": str,
84508467
"sentry.status.message": str,
8468+
"sentry.status_code": int,
84518469
"sentry.trace.parent_span_id": str,
84528470
"sentry.transaction": str,
84538471
"server.address": str,

0 commit comments

Comments
 (0)