From 64cc9e81d2c61aa44f14c592058b0c19de22707d Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 9 Sep 2025 15:06:39 +0200 Subject: [PATCH 1/3] feat(http): Add `http.request.time_to_first_byte` attribute --- generated/attributes/http.md | 12 ++++++++++ .../sentry-conventions/src/attributes.ts | 22 +++++++++++++++++++ .../http__request__time_to_first_byte.json | 13 +++++++++++ 3 files changed, 47 insertions(+) create mode 100644 model/attributes/http/http__request__time_to_first_byte.json diff --git a/generated/attributes/http.md b/generated/attributes/http.md index ede6692a..3f871fe7 100644 --- a/generated/attributes/http.md +++ b/generated/attributes/http.md @@ -19,6 +19,7 @@ - [http.request.response_end](#httprequestresponse_end) - [http.request.response_start](#httprequestresponse_start) - [http.request.secure_connection_start](#httprequestsecure_connection_start) + - [http.request.time_to_first_byte](#httprequesttime_to_first_byte) - [http.response.body.size](#httpresponsebodysize) - [http.response.header.\](#httpresponseheaderkey) - [http.response.header.content-length](#httpresponseheadercontentlength) @@ -219,6 +220,17 @@ The UNIX timestamp representing the time immediately before the browser starts t | Exists in OpenTelemetry | No | | Example | `1732829555` | +### http.request.time_to_first_byte + +The time in seconds from the browser's timeorigin to when the first byte of the request's response was received. See https://web.dev/articles/ttfb#measure-resource-requests + +| Property | Value | +| --- | --- | +| Type | `double` | +| Has PII | false | +| Exists in OpenTelemetry | No | +| Example | `1.032` | + ### http.response.body.size The encoded body size of the response (in bytes). diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 35cf1a25..c55b9b63 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -3358,6 +3358,26 @@ export const HTTP_REQUEST_SECURE_CONNECTION_START = 'http.request.secure_connect */ export type HTTP_REQUEST_SECURE_CONNECTION_START_TYPE = number; +// Path: model/attributes/http/http__request__time_to_first_byte.json + +/** + * The time in seconds from the browser's timeorigin to when the first byte of the request's response was received. See https://web.dev/articles/ttfb#measure-resource-requests `http.request.time_to_first_byte` + * + * Attribute Value Type: `number` {@link HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE} + * + * Contains PII: false + * + * Attribute defined in OTEL: No + * + * @example 1.032 + */ +export const HTTP_REQUEST_TIME_TO_FIRST_BYTE = 'http.request.time_to_first_byte'; + +/** + * Type for {@link HTTP_REQUEST_TIME_TO_FIRST_BYTE} http.request.time_to_first_byte + */ +export type HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE = number; + // Path: model/attributes/http/http__response__body__size.json /** @@ -6624,6 +6644,7 @@ export type Attributes = { [HTTP_REQUEST_RESPONSE_END]?: HTTP_REQUEST_RESPONSE_END_TYPE; [HTTP_REQUEST_RESPONSE_START]?: HTTP_REQUEST_RESPONSE_START_TYPE; [HTTP_REQUEST_SECURE_CONNECTION_START]?: HTTP_REQUEST_SECURE_CONNECTION_START_TYPE; + [HTTP_REQUEST_TIME_TO_FIRST_BYTE]?: HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE; [HTTP_RESPONSE_BODY_SIZE]?: HTTP_RESPONSE_BODY_SIZE_TYPE; [HTTP_RESPONSE_HEADER_KEY]?: HTTP_RESPONSE_HEADER_KEY_TYPE; [HTTP_RESPONSE_HEADER_CONTENT_LENGTH]?: HTTP_RESPONSE_HEADER_CONTENT_LENGTH_TYPE; @@ -6906,6 +6927,7 @@ export type FullAttributes = { [HTTP_REQUEST_RESPONSE_END]?: HTTP_REQUEST_RESPONSE_END_TYPE; [HTTP_REQUEST_RESPONSE_START]?: HTTP_REQUEST_RESPONSE_START_TYPE; [HTTP_REQUEST_SECURE_CONNECTION_START]?: HTTP_REQUEST_SECURE_CONNECTION_START_TYPE; + [HTTP_REQUEST_TIME_TO_FIRST_BYTE]?: HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE; [HTTP_RESPONSE_BODY_SIZE]?: HTTP_RESPONSE_BODY_SIZE_TYPE; [HTTP_RESPONSE_HEADER_KEY]?: HTTP_RESPONSE_HEADER_KEY_TYPE; [HTTP_RESPONSE_HEADER_CONTENT_LENGTH]?: HTTP_RESPONSE_HEADER_CONTENT_LENGTH_TYPE; diff --git a/model/attributes/http/http__request__time_to_first_byte.json b/model/attributes/http/http__request__time_to_first_byte.json new file mode 100644 index 00000000..3ac20075 --- /dev/null +++ b/model/attributes/http/http__request__time_to_first_byte.json @@ -0,0 +1,13 @@ +{ + "key": "http.request.time_to_first_byte", + "brief": "The time in seconds from the browser's timeorigin to when the first byte of the request's response was received. See https://web.dev/articles/ttfb#measure-resource-requests", + "type": "double", + "pii": { + "key": "false" + }, + "is_in_otel": false, + "example": 1.032, + "sdks": [ + "javascript-browser" + ] +} From b7e27fff4b644bf4a4a25189fcbab0abedd391bc Mon Sep 17 00:00:00 2001 From: Lukas Stracke Date: Tue, 9 Sep 2025 15:08:40 +0200 Subject: [PATCH 2/3] biome --- model/attributes/http/http__request__time_to_first_byte.json | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/model/attributes/http/http__request__time_to_first_byte.json b/model/attributes/http/http__request__time_to_first_byte.json index 3ac20075..1a882f13 100644 --- a/model/attributes/http/http__request__time_to_first_byte.json +++ b/model/attributes/http/http__request__time_to_first_byte.json @@ -7,7 +7,5 @@ }, "is_in_otel": false, "example": 1.032, - "sdks": [ - "javascript-browser" - ] + "sdks": ["javascript-browser"] } From 5018f7dce9600000bdccf5519c08f7898c89f887 Mon Sep 17 00:00:00 2001 From: lcian Date: Thu, 11 Sep 2025 16:56:24 +0200 Subject: [PATCH 3/3] regenerate --- generated/attributes/http.md | 12 ++++++------ .../sentry-conventions/src/attributes.ts | 18 ++++++++++++------ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/generated/attributes/http.md b/generated/attributes/http.md index c0beee8c..46f8fb68 100644 --- a/generated/attributes/http.md +++ b/generated/attributes/http.md @@ -233,27 +233,27 @@ The UNIX timestamp representing the time immediately before the browser starts t | Exists in OpenTelemetry | No | | Example | `1732829555.73` | -### http.request.worker_start +### http.request.time_to_first_byte -The UNIX timestamp representing the timestamp immediately before dispatching the FetchEvent if a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. +The time in seconds from the browser's timeorigin to when the first byte of the request's response was received. See https://web.dev/articles/ttfb#measure-resource-requests | Property | Value | | --- | --- | | Type | `double` | | Has PII | false | | Exists in OpenTelemetry | No | -| Example | `1732829553.68` | +| Example | `1.032` | -### http.request.time_to_first_byte +### http.request.worker_start -The time in seconds from the browser's timeorigin to when the first byte of the request's response was received. See https://web.dev/articles/ttfb#measure-resource-requests +The UNIX timestamp representing the timestamp immediately before dispatching the FetchEvent if a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. | Property | Value | | --- | --- | | Type | `double` | | Has PII | false | | Exists in OpenTelemetry | No | -| Example | `1.032` | +| Example | `1732829553.68` | ### http.response.body.size diff --git a/javascript/sentry-conventions/src/attributes.ts b/javascript/sentry-conventions/src/attributes.ts index 9bb64ebe..340e66d2 100644 --- a/javascript/sentry-conventions/src/attributes.ts +++ b/javascript/sentry-conventions/src/attributes.ts @@ -3409,12 +3409,6 @@ export type HTTP_REQUEST_SECURE_CONNECTION_START_TYPE = number; * The time in seconds from the browser's timeorigin to when the first byte of the request's response was received. See https://web.dev/articles/ttfb#measure-resource-requests `http.request.time_to_first_byte` * * Attribute Value Type: `number` {@link HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE} -// Path: model/attributes/http/http__request__worker_start.json - -/** - * The UNIX timestamp representing the timestamp immediately before dispatching the FetchEvent if a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. `http.request.worker_start` - * - * Attribute Value Type: `number` {@link HTTP_REQUEST_WORKER_START_TYPE} * * Contains PII: false * @@ -3428,6 +3422,18 @@ export const HTTP_REQUEST_TIME_TO_FIRST_BYTE = 'http.request.time_to_first_byte' * Type for {@link HTTP_REQUEST_TIME_TO_FIRST_BYTE} http.request.time_to_first_byte */ export type HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE = number; + +// Path: model/attributes/http/http__request__worker_start.json + +/** + * The UNIX timestamp representing the timestamp immediately before dispatching the FetchEvent if a Service Worker thread is already running, or immediately before starting the Service Worker thread if it is not already running. `http.request.worker_start` + * + * Attribute Value Type: `number` {@link HTTP_REQUEST_WORKER_START_TYPE} + * + * Contains PII: false + * + * Attribute defined in OTEL: No + * * @example 1732829553.68 */ export const HTTP_REQUEST_WORKER_START = 'http.request.worker_start';