Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mobile and language semconv for browser resource #2761

Merged
merged 8 commits into from
Sep 20, 2022
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ release.

- Update the version of the W3C Baggage specification used for `OTEL_RESOURCE_ATTRIBUTES`.
([#2670](https://github.com/open-telemetry/opentelemetry-specification/pull/2670))
- Add `browser.mobile` and `browser.language` resource attributes
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved
([#2761](https://github.com/open-telemetry/opentelemetry-specification/pull/2761))

### Semantic Conventions

Expand Down
21 changes: 18 additions & 3 deletions semantic_conventions/resource/browser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,33 @@ groups:
note: >
This value is intended to be taken from the
[UA client hints API](https://wicg.github.io/ua-client-hints/#interface)
(navigator.userAgentData.brands).
(`navigator.userAgentData.brands`).
examples: [" Not A;Brand 99", "Chromium 99", "Chrome 99"]
- id: platform
type: string
brief: 'The platform on which the browser is running'
note: >
This value is intended to be taken from the
[UA client hints API](https://wicg.github.io/ua-client-hints/#interface)
(navigator.userAgentData.platform). If unavailable, the legacy
(`navigator.userAgentData.platform`). If unavailable, the legacy
`navigator.platform` API SHOULD NOT be used instead and this attribute
SHOULD be left unset in order for the values to be consistent.

The list of possible values is defined in the
[W3C User-Agent Client Hints specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform).
Note that some (but not all) of these values can overlap with values
in the [os.type and os.name attributes](./os.md).
in the [`os.type` and `os.name` attributes](./os.md).
However, for consistency, the values in the `browser.platform` attribute
carlosalberto marked this conversation as resolved.
Show resolved Hide resolved
should capture the exact value that the user agent provides.
examples: ['Windows', 'macOS', 'Android']
- id: mobile
scheler marked this conversation as resolved.
Show resolved Hide resolved
type: boolean
brief: 'A boolean that is true if the browser is running on a mobile device'
note: >
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.
- id: user_agent
type: string
brief: 'Full user-agent string provided by the browser'
Expand All @@ -40,3 +48,10 @@ groups:
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'
note: >
This value is intended to be taken from the Navigator API
`navigator.language`.
arminru marked this conversation as resolved.
Show resolved Hide resolved
examples: ["en", "en-US", "fr", "fr-FR"]
16 changes: 11 additions & 5 deletions specification/resource/semantic_conventions/browser.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,18 @@ 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.user_agent` | string | Full user-agent string provided by the browser [3] | `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.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 |

**[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).
**[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`).

**[2]:** This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (navigator.userAgentData.platform). If unavailable, the legacy `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the values to be consistent.
The list of possible values is defined in the [W3C User-Agent Client Hints specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). Note that some (but not all) of these values can overlap with values in the [os.type and os.name attributes](./os.md). However, for consistency, the values in the `browser.platform` attribute should capture the exact value that the user agent provides.
**[2]:** This value is intended to be taken from the [UA client hints API](https://wicg.github.io/ua-client-hints/#interface) (`navigator.userAgentData.platform`). If unavailable, the legacy `navigator.platform` API SHOULD NOT be used instead and this attribute SHOULD be left unset in order for the values to be consistent.
The list of possible values is defined in the [W3C User-Agent Client Hints specification](https://wicg.github.io/ua-client-hints/#sec-ch-ua-platform). Note that some (but not all) of these values can overlap with values in the [`os.type` and `os.name` attributes](./os.md). However, for consistency, the values in the `browser.platform` attribute should capture the exact value that the user agent provides.

**[3]:** 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.
**[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.

**[5]:** This value is intended to be taken from the Navigator API `navigator.language`.
<!-- endsemconv -->