From fa04b9b612e7e713fb726b1560e7723571c34267 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 8 Feb 2023 16:27:18 -0800 Subject: [PATCH 1/8] Move http.user_agent to user_agent.original --- CHANGELOG.md | 2 ++ schemas/1.18.0 | 6 ++++++ semantic_conventions/trace/http.yaml | 5 +---- semantic_conventions/user-agent.yaml | 10 ++++++++++ specification/trace/semantic_conventions/http.md | 2 +- 5 files changed, 20 insertions(+), 5 deletions(-) create mode 100644 semantic_conventions/user-agent.yaml diff --git a/CHANGELOG.md b/CHANGELOG.md index b5b9a2b9697..fcc2693b484 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ release. [#3158](https://github.com/open-telemetry/opentelemetry-specification/pull/3158) - `http.route` SHOULD contain the "application root" if there is one. ([#3164](https://github.com/open-telemetry/opentelemetry-specification/pull/3164)) +- Rename `http.user_agent` to `user_agent.original`. + ([#3190](https://github.com/open-telemetry/opentelemetry-specification/pull/3190)) ### Compatibility diff --git a/schemas/1.18.0 b/schemas/1.18.0 index 400bd0969e0..e89dbdd2460 100644 --- a/schemas/1.18.0 +++ b/schemas/1.18.0 @@ -2,6 +2,12 @@ file_format: 1.1.0 schema_url: https://opentelemetry.io/schemas/1.18.0 versions: 1.18.0: + spans: + changes: + # https://github.com/open-telemetry/opentelemetry-specification/pull/3190 + - rename_attributes: + attribute_map: + http.user_agent: user_agent.original 1.17.0: spans: changes: diff --git a/semantic_conventions/trace/http.yaml b/semantic_conventions/trace/http.yaml index 6b8736e8840..b7362388c96 100644 --- a/semantic_conventions/trace/http.yaml +++ b/semantic_conventions/trace/http.yaml @@ -47,10 +47,6 @@ groups: note: > If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. - - id: user_agent - type: string - brief: 'Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.' - examples: ['CERN-LineMode/2.15 libwww/2.17b3'] - id: request_content_length type: int brief: > @@ -70,6 +66,7 @@ groups: - ref: net.sock.peer.name - ref: net.sock.family examples: ['inet', 'inet6'] + - ref: user_agent.original constraints: - include: network diff --git a/semantic_conventions/user-agent.yaml b/semantic_conventions/user-agent.yaml new file mode 100644 index 00000000000..2f43b1af3e6 --- /dev/null +++ b/semantic_conventions/user-agent.yaml @@ -0,0 +1,10 @@ +groups: + - id: attributes.user_agent + type: attribute_group + brief: "Describes user-agent attributes." + prefix: user_agent + attributes: + - id: original + type: string + brief: 'Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client.' + examples: ['CERN-LineMode/2.15 libwww/2.17b3'] diff --git a/specification/trace/semantic_conventions/http.md b/specification/trace/semantic_conventions/http.md index 10b808fa381..a6747a78eb7 100644 --- a/specification/trace/semantic_conventions/http.md +++ b/specification/trace/semantic_conventions/http.md @@ -68,13 +68,13 @@ sections below. | `http.method` | string | HTTP request method. | `GET`; `POST`; `HEAD` | Required | | `http.status_code` | int | [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). | `200` | Conditionally Required: If and only if one was received/sent. | | `http.flavor` | string | Kind of HTTP protocol used. [1] | `1.0` | Recommended | -| `http.user_agent` | string | Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | Recommended | | `http.request_content_length` | int | The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. | `3495` | Recommended | | `http.response_content_length` | int | The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#field.content-length) header. For requests using transport encoding, this should be the compressed size. | `3495` | Recommended | | [`net.sock.family`](span-general.md) | string | Protocol [address family](https://man7.org/linux/man-pages/man7/address_families.7.html) which is used for communication. | `inet`; `inet6` | Conditionally Required: [2] | | [`net.sock.peer.addr`](span-general.md) | string | Remote socket peer address: IPv4 or IPv6 for internet protocols, path for local communication, [etc](https://man7.org/linux/man-pages/man7/address_families.7.html). | `127.0.0.1`; `/tmp/mysql.sock` | Recommended | | [`net.sock.peer.name`](span-general.md) | string | Remote socket peer name. | `proxy.example.com` | Recommended: [3] | | [`net.sock.peer.port`](span-general.md) | int | Remote socket peer port. | `16456` | Recommended: [4] | +| `user_agent.original` | string | Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. | `CERN-LineMode/2.15 libwww/2.17b3` | Recommended | **[1]:** If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. From 5fcd197f5a12f3e38becfe2f007e4399a03582e0 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 14 Feb 2023 08:37:12 -0800 Subject: [PATCH 2/8] Replace browser.user_agent --- semantic_conventions/resource/browser.yaml | 15 +++++++-------- .../resource/semantic_conventions/browser.md | 8 ++++---- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/semantic_conventions/resource/browser.yaml b/semantic_conventions/resource/browser.yaml index 53493b82ff0..56830c1ddec 100644 --- a/semantic_conventions/resource/browser.yaml +++ b/semantic_conventions/resource/browser.yaml @@ -40,14 +40,6 @@ groups: [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be left unset. - - id: user_agent - type: string - brief: 'Full user-agent string provided by the browser' - note: > - The user-agent value SHOULD be provided only from browsers that do not have a mechanism - to retrieve brands and platform individually from the User-Agent Client Hints API. - To retrieve the value, the legacy `navigator.userAgent` API can be used. - examples: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36' - id: language type: string brief: 'Preferred language of the user using the browser' @@ -55,3 +47,10 @@ groups: This value is intended to be taken from the Navigator API `navigator.language`. examples: ["en", "en-US", "fr", "fr-FR"] + - ref: user_agent.original + brief: 'Full user-agent string provided by the browser' + note: > + The user-agent value SHOULD be provided only from browsers that do not have a mechanism + to retrieve brands and platform individually from the User-Agent Client Hints API. + To retrieve the value, the legacy `navigator.userAgent` API can be used. + examples: ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36'] diff --git a/specification/resource/semantic_conventions/browser.md b/specification/resource/semantic_conventions/browser.md index b00e416c997..cc3acd247a0 100644 --- a/specification/resource/semantic_conventions/browser.md +++ b/specification/resource/semantic_conventions/browser.md @@ -14,8 +14,8 @@ All of these attributes can be provided by the user agent itself in the form of | `browser.brands` | string[] | Array of brand name and version separated by a space [1] | `[ Not A;Brand 99, Chromium 99, Chrome 99]` | Recommended | | `browser.platform` | string | The platform on which the browser is running [2] | `Windows`; `macOS`; `Android` | Recommended | | `browser.mobile` | boolean | A boolean that is true if the browser is running on a mobile device [3] | | Recommended | -| `browser.user_agent` | string | Full user-agent string provided by the browser [4] | `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36` | Recommended | -| `browser.language` | string | Preferred language of the user using the browser [5] | `en`; `en-US`; `fr`; `fr-FR` | Recommended | +| `browser.language` | string | Preferred language of the user using the browser [4] | `en`; `en-US`; `fr`; `fr-FR` | Recommended | +| `user_agent.original` | string | Full user-agent string provided by the browser [5] | `Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/95.0.4638.54 Safari/537.36` | Recommended | **[1]:** This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.brands`). @@ -24,7 +24,7 @@ The list of possible values is defined in the [W3C User-Agent Client Hints speci **[3]:** This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.mobile`). If unavailable, this attribute SHOULD be left unset. -**[4]:** The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used. +**[4]:** This value is intended to be taken from the Navigator API `navigator.language`. -**[5]:** This value is intended to be taken from the Navigator API `navigator.language`. +**[5]:** The user-agent value SHOULD be provided only from browsers that do not have a mechanism to retrieve brands and platform individually from the User-Agent Client Hints API. To retrieve the value, the legacy `navigator.userAgent` API can be used. From 5f59b2b543be29e744f9c7523d5038077149d5bf Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 14 Feb 2023 08:38:43 -0800 Subject: [PATCH 3/8] Add browser.user_agent schema translation --- schemas/1.19.0 | 1 + 1 file changed, 1 insertion(+) diff --git a/schemas/1.19.0 b/schemas/1.19.0 index 6729c2bed1e..31007c20a6e 100644 --- a/schemas/1.19.0 +++ b/schemas/1.19.0 @@ -8,6 +8,7 @@ versions: - rename_attributes: attribute_map: http.user_agent: user_agent.original + browser.user_agent: user_agent.original 1.18.0: 1.17.0: spans: From 4163a6c648fc883694b929e309d6dffe857dff2a Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Tue, 14 Feb 2023 09:39:41 -0800 Subject: [PATCH 4/8] Fix schema_url --- schemas/1.19.0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/1.19.0 b/schemas/1.19.0 index 31007c20a6e..45f5c218bf1 100644 --- a/schemas/1.19.0 +++ b/schemas/1.19.0 @@ -1,5 +1,5 @@ file_format: 1.1.0 -schema_url: https://opentelemetry.io/schemas/1.18.0 +schema_url: https://opentelemetry.io/schemas/1.19.0 versions: 1.19.0: spans: From de290028476c54c1e683aebccdc5072c90ae443e Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 15 Feb 2023 11:01:32 -0800 Subject: [PATCH 5/8] Move browser.user_agent schema translation to resources section --- schemas/1.19.0 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/schemas/1.19.0 b/schemas/1.19.0 index 45f5c218bf1..edf1a261aec 100644 --- a/schemas/1.19.0 +++ b/schemas/1.19.0 @@ -8,6 +8,11 @@ versions: - rename_attributes: attribute_map: http.user_agent: user_agent.original + resources: + changes: + # https://github.com/open-telemetry/opentelemetry-specification/pull/3190 + - rename_attributes: + attribute_map: browser.user_agent: user_agent.original 1.18.0: 1.17.0: From b7671958a2ccf403094bf9706a42406335fee468 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Wed, 15 Feb 2023 16:24:52 -0800 Subject: [PATCH 6/8] Fix schema check --- schemas/1.19.0 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/schemas/1.19.0 b/schemas/1.19.0 index edf1a261aec..3b16bc6bd20 100644 --- a/schemas/1.19.0 +++ b/schemas/1.19.0 @@ -8,7 +8,7 @@ versions: - rename_attributes: attribute_map: http.user_agent: user_agent.original - resources: + Resources: changes: # https://github.com/open-telemetry/opentelemetry-specification/pull/3190 - rename_attributes: From ce07db54d876d96e3e9b85f082ab385138e730c8 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 17 Feb 2023 10:30:15 -0800 Subject: [PATCH 7/8] Update schemas/1.19.0 Co-authored-by: Tyler Yahn --- schemas/1.19.0 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/schemas/1.19.0 b/schemas/1.19.0 index 3b16bc6bd20..9c56e8d4665 100644 --- a/schemas/1.19.0 +++ b/schemas/1.19.0 @@ -8,12 +8,11 @@ versions: - rename_attributes: attribute_map: http.user_agent: user_agent.original - Resources: + resources: changes: # https://github.com/open-telemetry/opentelemetry-specification/pull/3190 - rename_attributes: - attribute_map: - browser.user_agent: user_agent.original + browser.user_agent: user_agent.original 1.18.0: 1.17.0: spans: From 5500d6815e5223f726c15817322d3a4b8f6d17a6 Mon Sep 17 00:00:00 2001 From: Trask Stalnaker Date: Fri, 24 Feb 2023 11:22:21 -0800 Subject: [PATCH 8/8] Use correct schema format --- schemas/1.19.0 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/schemas/1.19.0 b/schemas/1.19.0 index eec7012c0f8..cb710570c38 100644 --- a/schemas/1.19.0 +++ b/schemas/1.19.0 @@ -16,7 +16,8 @@ versions: changes: # https://github.com/open-telemetry/opentelemetry-specification/pull/3190 - rename_attributes: - browser.user_agent: user_agent.original + attribute_map: + browser.user_agent: user_agent.original 1.18.0: 1.17.0: spans: