Skip to content

Commit f0f1ace

Browse files
Lms24lcian
andauthored
feat(http): Add http.request.time_to_first_byte attribute (#131)
Co-authored-by: Lorenzo Cian <[email protected]>
1 parent 6ba27ad commit f0f1ace

File tree

3 files changed

+45
-0
lines changed

3 files changed

+45
-0
lines changed

generated/attributes/http.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
- [http.request.response_end](#httprequestresponse_end)
2121
- [http.request.response_start](#httprequestresponse_start)
2222
- [http.request.secure_connection_start](#httprequestsecure_connection_start)
23+
- [http.request.time_to_first_byte](#httprequesttime_to_first_byte)
2324
- [http.request.worker_start](#httprequestworker_start)
2425
- [http.response.body.size](#httpresponsebodysize)
2526
- [http.response.header.\<key\>](#httpresponseheaderkey)
@@ -232,6 +233,17 @@ The UNIX timestamp representing the time immediately before the browser starts t
232233
| Exists in OpenTelemetry | No |
233234
| Example | `1732829555.73` |
234235

236+
### http.request.time_to_first_byte
237+
238+
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
239+
240+
| Property | Value |
241+
| --- | --- |
242+
| Type | `double` |
243+
| Has PII | false |
244+
| Exists in OpenTelemetry | No |
245+
| Example | `1.032` |
246+
235247
### http.request.worker_start
236248

237249
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.

javascript/sentry-conventions/src/attributes.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3403,6 +3403,26 @@ export const HTTP_REQUEST_SECURE_CONNECTION_START = 'http.request.secure_connect
34033403
*/
34043404
export type HTTP_REQUEST_SECURE_CONNECTION_START_TYPE = number;
34053405

3406+
// Path: model/attributes/http/http__request__time_to_first_byte.json
3407+
3408+
/**
3409+
* 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`
3410+
*
3411+
* Attribute Value Type: `number` {@link HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE}
3412+
*
3413+
* Contains PII: false
3414+
*
3415+
* Attribute defined in OTEL: No
3416+
*
3417+
* @example 1.032
3418+
*/
3419+
export const HTTP_REQUEST_TIME_TO_FIRST_BYTE = 'http.request.time_to_first_byte';
3420+
3421+
/**
3422+
* Type for {@link HTTP_REQUEST_TIME_TO_FIRST_BYTE} http.request.time_to_first_byte
3423+
*/
3424+
export type HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE = number;
3425+
34063426
// Path: model/attributes/http/http__request__worker_start.json
34073427

34083428
/**
@@ -6781,6 +6801,7 @@ export type Attributes = {
67816801
[HTTP_REQUEST_RESPONSE_END]?: HTTP_REQUEST_RESPONSE_END_TYPE;
67826802
[HTTP_REQUEST_RESPONSE_START]?: HTTP_REQUEST_RESPONSE_START_TYPE;
67836803
[HTTP_REQUEST_SECURE_CONNECTION_START]?: HTTP_REQUEST_SECURE_CONNECTION_START_TYPE;
6804+
[HTTP_REQUEST_TIME_TO_FIRST_BYTE]?: HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE;
67846805
[HTTP_REQUEST_WORKER_START]?: HTTP_REQUEST_WORKER_START_TYPE;
67856806
[HTTP_RESPONSE_BODY_SIZE]?: HTTP_RESPONSE_BODY_SIZE_TYPE;
67866807
[HTTP_RESPONSE_HEADER_KEY]?: HTTP_RESPONSE_HEADER_KEY_TYPE;
@@ -7067,6 +7088,7 @@ export type FullAttributes = {
70677088
[HTTP_REQUEST_RESPONSE_END]?: HTTP_REQUEST_RESPONSE_END_TYPE;
70687089
[HTTP_REQUEST_RESPONSE_START]?: HTTP_REQUEST_RESPONSE_START_TYPE;
70697090
[HTTP_REQUEST_SECURE_CONNECTION_START]?: HTTP_REQUEST_SECURE_CONNECTION_START_TYPE;
7091+
[HTTP_REQUEST_TIME_TO_FIRST_BYTE]?: HTTP_REQUEST_TIME_TO_FIRST_BYTE_TYPE;
70707092
[HTTP_REQUEST_WORKER_START]?: HTTP_REQUEST_WORKER_START_TYPE;
70717093
[HTTP_RESPONSE_BODY_SIZE]?: HTTP_RESPONSE_BODY_SIZE_TYPE;
70727094
[HTTP_RESPONSE_HEADER_KEY]?: HTTP_RESPONSE_HEADER_KEY_TYPE;
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"key": "http.request.time_to_first_byte",
3+
"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",
4+
"type": "double",
5+
"pii": {
6+
"key": "false"
7+
},
8+
"is_in_otel": false,
9+
"example": 1.032,
10+
"sdks": ["javascript-browser"]
11+
}

0 commit comments

Comments
 (0)