@opentelemetry/opentelemetry-browser-detector 0.222.0 → 0.300.0-development.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -9
- package/dist/BrowserDetector.cjs +45 -0
- package/dist/BrowserDetector.cjs.map +1 -0
- package/dist/BrowserDetector.d.cts +20 -0
- package/dist/BrowserDetector.d.cts.map +1 -0
- package/dist/BrowserDetector.d.mts +20 -0
- package/dist/BrowserDetector.d.mts.map +1 -0
- package/dist/BrowserDetector.mjs +45 -0
- package/dist/BrowserDetector.mjs.map +1 -0
- package/dist/index.cjs +3 -0
- package/dist/index.d.cts +2 -0
- package/dist/index.d.mts +2 -0
- package/dist/index.mjs +2 -0
- package/dist/semconv.cjs +52 -0
- package/dist/semconv.cjs.map +1 -0
- package/dist/semconv.mjs +49 -0
- package/dist/semconv.mjs.map +1 -0
- package/package.json +31 -29
- package/build/esm/BrowserDetector.d.ts +0 -18
- package/build/esm/BrowserDetector.js +0 -53
- package/build/esm/BrowserDetector.js.map +0 -1
- package/build/esm/index.d.ts +0 -2
- package/build/esm/index.js +0 -6
- package/build/esm/index.js.map +0 -1
- package/build/esm/semconv.d.ts +0 -45
- package/build/esm/semconv.js +0 -49
- package/build/esm/semconv.js.map +0 -1
- package/build/esm/types.d.ts +0 -9
- package/build/esm/types.js +0 -6
- package/build/esm/types.js.map +0 -1
- package/build/esm/version.d.ts +0 -2
- package/build/esm/version.js +0 -7
- package/build/esm/version.js.map +0 -1
- package/build/esnext/BrowserDetector.d.ts +0 -18
- package/build/esnext/BrowserDetector.js +0 -53
- package/build/esnext/BrowserDetector.js.map +0 -1
- package/build/esnext/index.d.ts +0 -2
- package/build/esnext/index.js +0 -6
- package/build/esnext/index.js.map +0 -1
- package/build/esnext/semconv.d.ts +0 -45
- package/build/esnext/semconv.js +0 -49
- package/build/esnext/semconv.js.map +0 -1
- package/build/esnext/types.d.ts +0 -9
- package/build/esnext/types.js +0 -6
- package/build/esnext/types.js.map +0 -1
- package/build/esnext/version.d.ts +0 -2
- package/build/esnext/version.js +0 -7
- package/build/esnext/version.js.map +0 -1
- package/build/src/BrowserDetector.d.ts +0 -18
- package/build/src/BrowserDetector.js +0 -56
- package/build/src/BrowserDetector.js.map +0 -1
- package/build/src/index.d.ts +0 -2
- package/build/src/index.js +0 -10
- package/build/src/index.js.map +0 -1
- package/build/src/semconv.d.ts +0 -45
- package/build/src/semconv.js +0 -52
- package/build/src/semconv.js.map +0 -1
- package/build/src/types.d.ts +0 -9
- package/build/src/types.js +0 -7
- package/build/src/types.js.map +0 -1
- package/build/src/version.d.ts +0 -2
- package/build/src/version.js +0 -10
- package/build/src/version.js.map +0 -1
package/build/esm/semconv.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Array of brand name and version separated by a space
|
|
7
|
-
*
|
|
8
|
-
* @example [" Not A;Brand 99", "Chromium 99", "Chrome 99"]
|
|
9
|
-
*
|
|
10
|
-
* @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`).
|
|
11
|
-
*
|
|
12
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
13
|
-
*/
|
|
14
|
-
export const ATTR_BROWSER_BRANDS = 'browser.brands';
|
|
15
|
-
/**
|
|
16
|
-
* Preferred language of the user using the browser
|
|
17
|
-
*
|
|
18
|
-
* @example en
|
|
19
|
-
* @example en-US
|
|
20
|
-
* @example fr
|
|
21
|
-
* @example fr-FR
|
|
22
|
-
*
|
|
23
|
-
* @note This value is intended to be taken from the Navigator API `navigator.language`.
|
|
24
|
-
*
|
|
25
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
26
|
-
*/
|
|
27
|
-
export const ATTR_BROWSER_LANGUAGE = 'browser.language';
|
|
28
|
-
/**
|
|
29
|
-
* A boolean that is true if the browser is running on a mobile device
|
|
30
|
-
*
|
|
31
|
-
* @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.
|
|
32
|
-
*
|
|
33
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
34
|
-
*/
|
|
35
|
-
export const ATTR_BROWSER_MOBILE = 'browser.mobile';
|
|
36
|
-
/**
|
|
37
|
-
* The platform on which the browser is running
|
|
38
|
-
*
|
|
39
|
-
* @example Windows
|
|
40
|
-
* @example macOS
|
|
41
|
-
* @example Android
|
|
42
|
-
*
|
|
43
|
-
* @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.
|
|
44
|
-
* 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.
|
|
45
|
-
*
|
|
46
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
47
|
-
*/
|
|
48
|
-
export const ATTR_BROWSER_PLATFORM = 'browser.platform';
|
|
49
|
-
//# sourceMappingURL=semconv.js.map
|
package/build/esm/semconv.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Array of brand name and version separated by a space\n *\n * @example [\" Not A;Brand 99\", \"Chromium 99\", \"Chrome 99\"]\n *\n * @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`).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_BRANDS = 'browser.brands' as const;\n\n/**\n * Preferred language of the user using the browser\n *\n * @example en\n * @example en-US\n * @example fr\n * @example fr-FR\n *\n * @note This value is intended to be taken from the Navigator API `navigator.language`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_LANGUAGE = 'browser.language' as const;\n\n/**\n * A boolean that is true if the browser is running on a mobile device\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_MOBILE = 'browser.mobile' as const;\n\n/**\n * The platform on which the browser is running\n *\n * @example Windows\n * @example macOS\n * @example Android\n *\n * @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.\n * 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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_PLATFORM = 'browser.platform' as const;\n"]}
|
package/build/esm/types.d.ts
DELETED
package/build/esm/types.js
DELETED
package/build/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport type UserAgentData = {\n brands: { brand: string; version: string }[];\n platform: string;\n mobile: boolean;\n};\n"]}
|
package/build/esm/version.d.ts
DELETED
package/build/esm/version.js
DELETED
package/build/esm/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.222.0';\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DetectedResource, ResourceDetector, ResourceDetectionConfig } from '@opentelemetry/resources';
|
|
2
|
-
/**
|
|
3
|
-
* BrowserDetector will be used to detect the resources related to browser.
|
|
4
|
-
*/
|
|
5
|
-
declare class BrowserDetector implements ResourceDetector {
|
|
6
|
-
detect(config?: ResourceDetectionConfig): DetectedResource;
|
|
7
|
-
/**
|
|
8
|
-
* Validates browser resource attribute map from browser variables
|
|
9
|
-
*
|
|
10
|
-
* @param browserResource The un-sanitized resource attributes from browser as key/value pairs.
|
|
11
|
-
* @param config: Config
|
|
12
|
-
* @returns The sanitized resource attributes.
|
|
13
|
-
*/
|
|
14
|
-
private _getResourceAttributes;
|
|
15
|
-
}
|
|
16
|
-
export declare const browserDetector: BrowserDetector;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=BrowserDetector.d.ts.map
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
import { diag } from '@opentelemetry/api';
|
|
6
|
-
import { emptyResource } from '@opentelemetry/resources';
|
|
7
|
-
import { ATTR_USER_AGENT_ORIGINAL } from '@opentelemetry/semantic-conventions';
|
|
8
|
-
import { ATTR_BROWSER_LANGUAGE, ATTR_BROWSER_PLATFORM, ATTR_BROWSER_BRANDS, ATTR_BROWSER_MOBILE, } from './semconv';
|
|
9
|
-
/**
|
|
10
|
-
* BrowserDetector will be used to detect the resources related to browser.
|
|
11
|
-
*/
|
|
12
|
-
class BrowserDetector {
|
|
13
|
-
detect(config) {
|
|
14
|
-
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
15
|
-
if (!isBrowser) {
|
|
16
|
-
return emptyResource();
|
|
17
|
-
}
|
|
18
|
-
const browserResource = getBrowserAttributes();
|
|
19
|
-
return this._getResourceAttributes(browserResource, config);
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Validates browser resource attribute map from browser variables
|
|
23
|
-
*
|
|
24
|
-
* @param browserResource The un-sanitized resource attributes from browser as key/value pairs.
|
|
25
|
-
* @param config: Config
|
|
26
|
-
* @returns The sanitized resource attributes.
|
|
27
|
-
*/
|
|
28
|
-
_getResourceAttributes(browserResource, _config) {
|
|
29
|
-
if (!browserResource[ATTR_USER_AGENT_ORIGINAL] &&
|
|
30
|
-
!browserResource[ATTR_BROWSER_PLATFORM]) {
|
|
31
|
-
diag.debug('BrowserDetector failed: Unable to find required browser resources. ');
|
|
32
|
-
return emptyResource();
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
return { attributes: browserResource };
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
// Add Browser related attributes to resources
|
|
40
|
-
function getBrowserAttributes() {
|
|
41
|
-
const browserAttribs = {};
|
|
42
|
-
const userAgentData = navigator.userAgentData;
|
|
43
|
-
if (userAgentData) {
|
|
44
|
-
browserAttribs[ATTR_BROWSER_PLATFORM] = userAgentData.platform;
|
|
45
|
-
browserAttribs[ATTR_BROWSER_BRANDS] = userAgentData.brands.map(b => `${b.brand} ${b.version}`);
|
|
46
|
-
browserAttribs[ATTR_BROWSER_MOBILE] = userAgentData.mobile;
|
|
47
|
-
}
|
|
48
|
-
browserAttribs[ATTR_USER_AGENT_ORIGINAL] = navigator.userAgent;
|
|
49
|
-
browserAttribs[ATTR_BROWSER_LANGUAGE] = navigator.language;
|
|
50
|
-
return browserAttribs;
|
|
51
|
-
}
|
|
52
|
-
export const browserDetector = new BrowserDetector();
|
|
53
|
-
//# sourceMappingURL=BrowserDetector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserDetector.js","sourceRoot":"","sources":["../../src/BrowserDetector.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAM1C,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAE/E,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AAEnB;;GAEG;AACH,MAAM,eAAe;IACnB,MAAM,CAAC,MAAgC;QACrC,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC;QAEnE,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,aAAa,EAAE,CAAC;SACxB;QACD,MAAM,eAAe,GAAe,oBAAoB,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACD;;;;;;OAMG;IACK,sBAAsB,CAC5B,eAA2B,EAC3B,OAAiC;QAEjC,IACE,CAAC,eAAe,CAAC,wBAAwB,CAAC;YAC1C,CAAC,eAAe,CAAC,qBAAqB,CAAC,EACvC;YACA,IAAI,CAAC,KAAK,CACR,qEAAqE,CACtE,CAAC;YACF,OAAO,aAAa,EAAE,CAAC;SACxB;aAAM;YACL,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;SACxC;IACH,CAAC;CACF;AAED,8CAA8C;AAC9C,SAAS,oBAAoB;IAC3B,MAAM,cAAc,GAAe,EAAE,CAAC;IACtC,MAAM,aAAa,GACjB,SACD,CAAC,aAAa,CAAC;IAChB,IAAI,aAAa,EAAE;QACjB,cAAc,CAAC,qBAAqB,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC;QAC/D,cAAc,CAAC,mBAAmB,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,CAC5D,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,CAC/B,CAAC;QACF,cAAc,CAAC,mBAAmB,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC;KAC5D;IACD,cAAc,CAAC,wBAAwB,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAC/D,cAAc,CAAC,qBAAqB,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC;IAC3D,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport { diag } from '@opentelemetry/api';\nimport type {\n DetectedResource,\n ResourceDetector,\n ResourceDetectionConfig,\n} from '@opentelemetry/resources';\nimport { emptyResource } from '@opentelemetry/resources';\nimport { ATTR_USER_AGENT_ORIGINAL } from '@opentelemetry/semantic-conventions';\nimport type { UserAgentData } from './types';\nimport {\n ATTR_BROWSER_LANGUAGE,\n ATTR_BROWSER_PLATFORM,\n ATTR_BROWSER_BRANDS,\n ATTR_BROWSER_MOBILE,\n} from './semconv';\n\n/**\n * BrowserDetector will be used to detect the resources related to browser.\n */\nclass BrowserDetector implements ResourceDetector {\n detect(config?: ResourceDetectionConfig): DetectedResource {\n const isBrowser =\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\n if (!isBrowser) {\n return emptyResource();\n }\n const browserResource: Attributes = getBrowserAttributes();\n return this._getResourceAttributes(browserResource, config);\n }\n /**\n * Validates browser resource attribute map from browser variables\n *\n * @param browserResource The un-sanitized resource attributes from browser as key/value pairs.\n * @param config: Config\n * @returns The sanitized resource attributes.\n */\n private _getResourceAttributes(\n browserResource: Attributes,\n _config?: ResourceDetectionConfig\n ): DetectedResource {\n if (\n !browserResource[ATTR_USER_AGENT_ORIGINAL] &&\n !browserResource[ATTR_BROWSER_PLATFORM]\n ) {\n diag.debug(\n 'BrowserDetector failed: Unable to find required browser resources. '\n );\n return emptyResource();\n } else {\n return { attributes: browserResource };\n }\n }\n}\n\n// Add Browser related attributes to resources\nfunction getBrowserAttributes(): Attributes {\n const browserAttribs: Attributes = {};\n const userAgentData = (\n navigator as Navigator & { userAgentData?: UserAgentData }\n ).userAgentData;\n if (userAgentData) {\n browserAttribs[ATTR_BROWSER_PLATFORM] = userAgentData.platform;\n browserAttribs[ATTR_BROWSER_BRANDS] = userAgentData.brands.map(\n b => `${b.brand} ${b.version}`\n );\n browserAttribs[ATTR_BROWSER_MOBILE] = userAgentData.mobile;\n }\n browserAttribs[ATTR_USER_AGENT_ORIGINAL] = navigator.userAgent;\n browserAttribs[ATTR_BROWSER_LANGUAGE] = navigator.language;\n return browserAttribs;\n}\n\nexport const browserDetector = new BrowserDetector();\n"]}
|
package/build/esnext/index.d.ts
DELETED
package/build/esnext/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { browserDetector } from './BrowserDetector';\n"]}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Array of brand name and version separated by a space
|
|
3
|
-
*
|
|
4
|
-
* @example [" Not A;Brand 99", "Chromium 99", "Chrome 99"]
|
|
5
|
-
*
|
|
6
|
-
* @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`).
|
|
7
|
-
*
|
|
8
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
9
|
-
*/
|
|
10
|
-
export declare const ATTR_BROWSER_BRANDS: "browser.brands";
|
|
11
|
-
/**
|
|
12
|
-
* Preferred language of the user using the browser
|
|
13
|
-
*
|
|
14
|
-
* @example en
|
|
15
|
-
* @example en-US
|
|
16
|
-
* @example fr
|
|
17
|
-
* @example fr-FR
|
|
18
|
-
*
|
|
19
|
-
* @note This value is intended to be taken from the Navigator API `navigator.language`.
|
|
20
|
-
*
|
|
21
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
22
|
-
*/
|
|
23
|
-
export declare const ATTR_BROWSER_LANGUAGE: "browser.language";
|
|
24
|
-
/**
|
|
25
|
-
* A boolean that is true if the browser is running on a mobile device
|
|
26
|
-
*
|
|
27
|
-
* @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.
|
|
28
|
-
*
|
|
29
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
30
|
-
*/
|
|
31
|
-
export declare const ATTR_BROWSER_MOBILE: "browser.mobile";
|
|
32
|
-
/**
|
|
33
|
-
* The platform on which the browser is running
|
|
34
|
-
*
|
|
35
|
-
* @example Windows
|
|
36
|
-
* @example macOS
|
|
37
|
-
* @example Android
|
|
38
|
-
*
|
|
39
|
-
* @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.
|
|
40
|
-
* 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.
|
|
41
|
-
*
|
|
42
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
43
|
-
*/
|
|
44
|
-
export declare const ATTR_BROWSER_PLATFORM: "browser.platform";
|
|
45
|
-
//# sourceMappingURL=semconv.d.ts.map
|
package/build/esnext/semconv.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright The OpenTelemetry Authors
|
|
3
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Array of brand name and version separated by a space
|
|
7
|
-
*
|
|
8
|
-
* @example [" Not A;Brand 99", "Chromium 99", "Chrome 99"]
|
|
9
|
-
*
|
|
10
|
-
* @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`).
|
|
11
|
-
*
|
|
12
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
13
|
-
*/
|
|
14
|
-
export const ATTR_BROWSER_BRANDS = 'browser.brands';
|
|
15
|
-
/**
|
|
16
|
-
* Preferred language of the user using the browser
|
|
17
|
-
*
|
|
18
|
-
* @example en
|
|
19
|
-
* @example en-US
|
|
20
|
-
* @example fr
|
|
21
|
-
* @example fr-FR
|
|
22
|
-
*
|
|
23
|
-
* @note This value is intended to be taken from the Navigator API `navigator.language`.
|
|
24
|
-
*
|
|
25
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
26
|
-
*/
|
|
27
|
-
export const ATTR_BROWSER_LANGUAGE = 'browser.language';
|
|
28
|
-
/**
|
|
29
|
-
* A boolean that is true if the browser is running on a mobile device
|
|
30
|
-
*
|
|
31
|
-
* @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.
|
|
32
|
-
*
|
|
33
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
34
|
-
*/
|
|
35
|
-
export const ATTR_BROWSER_MOBILE = 'browser.mobile';
|
|
36
|
-
/**
|
|
37
|
-
* The platform on which the browser is running
|
|
38
|
-
*
|
|
39
|
-
* @example Windows
|
|
40
|
-
* @example macOS
|
|
41
|
-
* @example Android
|
|
42
|
-
*
|
|
43
|
-
* @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.
|
|
44
|
-
* 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.
|
|
45
|
-
*
|
|
46
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
47
|
-
*/
|
|
48
|
-
export const ATTR_BROWSER_PLATFORM = 'browser.platform';
|
|
49
|
-
//# sourceMappingURL=semconv.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAA2B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Array of brand name and version separated by a space\n *\n * @example [\" Not A;Brand 99\", \"Chromium 99\", \"Chrome 99\"]\n *\n * @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`).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_BRANDS = 'browser.brands' as const;\n\n/**\n * Preferred language of the user using the browser\n *\n * @example en\n * @example en-US\n * @example fr\n * @example fr-FR\n *\n * @note This value is intended to be taken from the Navigator API `navigator.language`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_LANGUAGE = 'browser.language' as const;\n\n/**\n * A boolean that is true if the browser is running on a mobile device\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_MOBILE = 'browser.mobile' as const;\n\n/**\n * The platform on which the browser is running\n *\n * @example Windows\n * @example macOS\n * @example Android\n *\n * @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.\n * 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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_PLATFORM = 'browser.platform' as const;\n"]}
|
package/build/esnext/types.d.ts
DELETED
package/build/esnext/types.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport type UserAgentData = {\n brands: { brand: string; version: string }[];\n platform: string;\n mobile: boolean;\n};\n"]}
|
package/build/esnext/version.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,4DAA4D;AAC5D,MAAM,CAAC,MAAM,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.222.0';\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { DetectedResource, ResourceDetector, ResourceDetectionConfig } from '@opentelemetry/resources';
|
|
2
|
-
/**
|
|
3
|
-
* BrowserDetector will be used to detect the resources related to browser.
|
|
4
|
-
*/
|
|
5
|
-
declare class BrowserDetector implements ResourceDetector {
|
|
6
|
-
detect(config?: ResourceDetectionConfig): DetectedResource;
|
|
7
|
-
/**
|
|
8
|
-
* Validates browser resource attribute map from browser variables
|
|
9
|
-
*
|
|
10
|
-
* @param browserResource The un-sanitized resource attributes from browser as key/value pairs.
|
|
11
|
-
* @param config: Config
|
|
12
|
-
* @returns The sanitized resource attributes.
|
|
13
|
-
*/
|
|
14
|
-
private _getResourceAttributes;
|
|
15
|
-
}
|
|
16
|
-
export declare const browserDetector: BrowserDetector;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=BrowserDetector.d.ts.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.browserDetector = void 0;
|
|
8
|
-
const api_1 = require("@opentelemetry/api");
|
|
9
|
-
const resources_1 = require("@opentelemetry/resources");
|
|
10
|
-
const semantic_conventions_1 = require("@opentelemetry/semantic-conventions");
|
|
11
|
-
const semconv_1 = require("./semconv");
|
|
12
|
-
/**
|
|
13
|
-
* BrowserDetector will be used to detect the resources related to browser.
|
|
14
|
-
*/
|
|
15
|
-
class BrowserDetector {
|
|
16
|
-
detect(config) {
|
|
17
|
-
const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
18
|
-
if (!isBrowser) {
|
|
19
|
-
return (0, resources_1.emptyResource)();
|
|
20
|
-
}
|
|
21
|
-
const browserResource = getBrowserAttributes();
|
|
22
|
-
return this._getResourceAttributes(browserResource, config);
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Validates browser resource attribute map from browser variables
|
|
26
|
-
*
|
|
27
|
-
* @param browserResource The un-sanitized resource attributes from browser as key/value pairs.
|
|
28
|
-
* @param config: Config
|
|
29
|
-
* @returns The sanitized resource attributes.
|
|
30
|
-
*/
|
|
31
|
-
_getResourceAttributes(browserResource, _config) {
|
|
32
|
-
if (!browserResource[semantic_conventions_1.ATTR_USER_AGENT_ORIGINAL] &&
|
|
33
|
-
!browserResource[semconv_1.ATTR_BROWSER_PLATFORM]) {
|
|
34
|
-
api_1.diag.debug('BrowserDetector failed: Unable to find required browser resources. ');
|
|
35
|
-
return (0, resources_1.emptyResource)();
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return { attributes: browserResource };
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
// Add Browser related attributes to resources
|
|
43
|
-
function getBrowserAttributes() {
|
|
44
|
-
const browserAttribs = {};
|
|
45
|
-
const userAgentData = navigator.userAgentData;
|
|
46
|
-
if (userAgentData) {
|
|
47
|
-
browserAttribs[semconv_1.ATTR_BROWSER_PLATFORM] = userAgentData.platform;
|
|
48
|
-
browserAttribs[semconv_1.ATTR_BROWSER_BRANDS] = userAgentData.brands.map(b => `${b.brand} ${b.version}`);
|
|
49
|
-
browserAttribs[semconv_1.ATTR_BROWSER_MOBILE] = userAgentData.mobile;
|
|
50
|
-
}
|
|
51
|
-
browserAttribs[semantic_conventions_1.ATTR_USER_AGENT_ORIGINAL] = navigator.userAgent;
|
|
52
|
-
browserAttribs[semconv_1.ATTR_BROWSER_LANGUAGE] = navigator.language;
|
|
53
|
-
return browserAttribs;
|
|
54
|
-
}
|
|
55
|
-
exports.browserDetector = new BrowserDetector();
|
|
56
|
-
//# sourceMappingURL=BrowserDetector.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BrowserDetector.js","sourceRoot":"","sources":["../../src/BrowserDetector.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAGH,4CAA0C;AAM1C,wDAAyD;AACzD,8EAA+E;AAE/E,uCAKmB;AAEnB;;GAEG;AACH,MAAM,eAAe;IACnB,MAAM,CAAC,MAAgC;QACrC,MAAM,SAAS,GACb,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,QAAQ,KAAK,WAAW,CAAC;QAEnE,IAAI,CAAC,SAAS,EAAE;YACd,OAAO,IAAA,yBAAa,GAAE,CAAC;SACxB;QACD,MAAM,eAAe,GAAe,oBAAoB,EAAE,CAAC;QAC3D,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC;IAC9D,CAAC;IACD;;;;;;OAMG;IACK,sBAAsB,CAC5B,eAA2B,EAC3B,OAAiC;QAEjC,IACE,CAAC,eAAe,CAAC,+CAAwB,CAAC;YAC1C,CAAC,eAAe,CAAC,+BAAqB,CAAC,EACvC;YACA,UAAI,CAAC,KAAK,CACR,qEAAqE,CACtE,CAAC;YACF,OAAO,IAAA,yBAAa,GAAE,CAAC;SACxB;aAAM;YACL,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,CAAC;SACxC;IACH,CAAC;CACF;AAED,8CAA8C;AAC9C,SAAS,oBAAoB;IAC3B,MAAM,cAAc,GAAe,EAAE,CAAC;IACtC,MAAM,aAAa,GACjB,SACD,CAAC,aAAa,CAAC;IAChB,IAAI,aAAa,EAAE;QACjB,cAAc,CAAC,+BAAqB,CAAC,GAAG,aAAa,CAAC,QAAQ,CAAC;QAC/D,cAAc,CAAC,6BAAmB,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC,GAAG,CAC5D,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,OAAO,EAAE,CAC/B,CAAC;QACF,cAAc,CAAC,6BAAmB,CAAC,GAAG,aAAa,CAAC,MAAM,CAAC;KAC5D;IACD,cAAc,CAAC,+CAAwB,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC;IAC/D,cAAc,CAAC,+BAAqB,CAAC,GAAG,SAAS,CAAC,QAAQ,CAAC;IAC3D,OAAO,cAAc,CAAC;AACxB,CAAC;AAEY,QAAA,eAAe,GAAG,IAAI,eAAe,EAAE,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nimport type { Attributes } from '@opentelemetry/api';\nimport { diag } from '@opentelemetry/api';\nimport type {\n DetectedResource,\n ResourceDetector,\n ResourceDetectionConfig,\n} from '@opentelemetry/resources';\nimport { emptyResource } from '@opentelemetry/resources';\nimport { ATTR_USER_AGENT_ORIGINAL } from '@opentelemetry/semantic-conventions';\nimport type { UserAgentData } from './types';\nimport {\n ATTR_BROWSER_LANGUAGE,\n ATTR_BROWSER_PLATFORM,\n ATTR_BROWSER_BRANDS,\n ATTR_BROWSER_MOBILE,\n} from './semconv';\n\n/**\n * BrowserDetector will be used to detect the resources related to browser.\n */\nclass BrowserDetector implements ResourceDetector {\n detect(config?: ResourceDetectionConfig): DetectedResource {\n const isBrowser =\n typeof window !== 'undefined' && typeof document !== 'undefined';\n\n if (!isBrowser) {\n return emptyResource();\n }\n const browserResource: Attributes = getBrowserAttributes();\n return this._getResourceAttributes(browserResource, config);\n }\n /**\n * Validates browser resource attribute map from browser variables\n *\n * @param browserResource The un-sanitized resource attributes from browser as key/value pairs.\n * @param config: Config\n * @returns The sanitized resource attributes.\n */\n private _getResourceAttributes(\n browserResource: Attributes,\n _config?: ResourceDetectionConfig\n ): DetectedResource {\n if (\n !browserResource[ATTR_USER_AGENT_ORIGINAL] &&\n !browserResource[ATTR_BROWSER_PLATFORM]\n ) {\n diag.debug(\n 'BrowserDetector failed: Unable to find required browser resources. '\n );\n return emptyResource();\n } else {\n return { attributes: browserResource };\n }\n }\n}\n\n// Add Browser related attributes to resources\nfunction getBrowserAttributes(): Attributes {\n const browserAttribs: Attributes = {};\n const userAgentData = (\n navigator as Navigator & { userAgentData?: UserAgentData }\n ).userAgentData;\n if (userAgentData) {\n browserAttribs[ATTR_BROWSER_PLATFORM] = userAgentData.platform;\n browserAttribs[ATTR_BROWSER_BRANDS] = userAgentData.brands.map(\n b => `${b.brand} ${b.version}`\n );\n browserAttribs[ATTR_BROWSER_MOBILE] = userAgentData.mobile;\n }\n browserAttribs[ATTR_USER_AGENT_ORIGINAL] = navigator.userAgent;\n browserAttribs[ATTR_BROWSER_LANGUAGE] = navigator.language;\n return browserAttribs;\n}\n\nexport const browserDetector = new BrowserDetector();\n"]}
|
package/build/src/index.d.ts
DELETED
package/build/src/index.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.browserDetector = void 0;
|
|
8
|
-
var BrowserDetector_1 = require("./BrowserDetector");
|
|
9
|
-
Object.defineProperty(exports, "browserDetector", { enumerable: true, get: function () { return BrowserDetector_1.browserDetector; } });
|
|
10
|
-
//# sourceMappingURL=index.js.map
|
package/build/src/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qDAAoD;AAA3C,kHAAA,eAAe,OAAA","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport { browserDetector } from './BrowserDetector';\n"]}
|
package/build/src/semconv.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Array of brand name and version separated by a space
|
|
3
|
-
*
|
|
4
|
-
* @example [" Not A;Brand 99", "Chromium 99", "Chrome 99"]
|
|
5
|
-
*
|
|
6
|
-
* @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`).
|
|
7
|
-
*
|
|
8
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
9
|
-
*/
|
|
10
|
-
export declare const ATTR_BROWSER_BRANDS: "browser.brands";
|
|
11
|
-
/**
|
|
12
|
-
* Preferred language of the user using the browser
|
|
13
|
-
*
|
|
14
|
-
* @example en
|
|
15
|
-
* @example en-US
|
|
16
|
-
* @example fr
|
|
17
|
-
* @example fr-FR
|
|
18
|
-
*
|
|
19
|
-
* @note This value is intended to be taken from the Navigator API `navigator.language`.
|
|
20
|
-
*
|
|
21
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
22
|
-
*/
|
|
23
|
-
export declare const ATTR_BROWSER_LANGUAGE: "browser.language";
|
|
24
|
-
/**
|
|
25
|
-
* A boolean that is true if the browser is running on a mobile device
|
|
26
|
-
*
|
|
27
|
-
* @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.
|
|
28
|
-
*
|
|
29
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
30
|
-
*/
|
|
31
|
-
export declare const ATTR_BROWSER_MOBILE: "browser.mobile";
|
|
32
|
-
/**
|
|
33
|
-
* The platform on which the browser is running
|
|
34
|
-
*
|
|
35
|
-
* @example Windows
|
|
36
|
-
* @example macOS
|
|
37
|
-
* @example Android
|
|
38
|
-
*
|
|
39
|
-
* @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.
|
|
40
|
-
* 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.
|
|
41
|
-
*
|
|
42
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
43
|
-
*/
|
|
44
|
-
export declare const ATTR_BROWSER_PLATFORM: "browser.platform";
|
|
45
|
-
//# sourceMappingURL=semconv.d.ts.map
|
package/build/src/semconv.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.ATTR_BROWSER_PLATFORM = exports.ATTR_BROWSER_MOBILE = exports.ATTR_BROWSER_LANGUAGE = exports.ATTR_BROWSER_BRANDS = void 0;
|
|
8
|
-
/**
|
|
9
|
-
* Array of brand name and version separated by a space
|
|
10
|
-
*
|
|
11
|
-
* @example [" Not A;Brand 99", "Chromium 99", "Chrome 99"]
|
|
12
|
-
*
|
|
13
|
-
* @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`).
|
|
14
|
-
*
|
|
15
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
16
|
-
*/
|
|
17
|
-
exports.ATTR_BROWSER_BRANDS = 'browser.brands';
|
|
18
|
-
/**
|
|
19
|
-
* Preferred language of the user using the browser
|
|
20
|
-
*
|
|
21
|
-
* @example en
|
|
22
|
-
* @example en-US
|
|
23
|
-
* @example fr
|
|
24
|
-
* @example fr-FR
|
|
25
|
-
*
|
|
26
|
-
* @note This value is intended to be taken from the Navigator API `navigator.language`.
|
|
27
|
-
*
|
|
28
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
29
|
-
*/
|
|
30
|
-
exports.ATTR_BROWSER_LANGUAGE = 'browser.language';
|
|
31
|
-
/**
|
|
32
|
-
* A boolean that is true if the browser is running on a mobile device
|
|
33
|
-
*
|
|
34
|
-
* @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.
|
|
35
|
-
*
|
|
36
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
37
|
-
*/
|
|
38
|
-
exports.ATTR_BROWSER_MOBILE = 'browser.mobile';
|
|
39
|
-
/**
|
|
40
|
-
* The platform on which the browser is running
|
|
41
|
-
*
|
|
42
|
-
* @example Windows
|
|
43
|
-
* @example macOS
|
|
44
|
-
* @example Android
|
|
45
|
-
*
|
|
46
|
-
* @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.
|
|
47
|
-
* 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.
|
|
48
|
-
*
|
|
49
|
-
* @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.
|
|
50
|
-
*/
|
|
51
|
-
exports.ATTR_BROWSER_PLATFORM = 'browser.platform';
|
|
52
|
-
//# sourceMappingURL=semconv.js.map
|
package/build/src/semconv.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"semconv.js","sourceRoot":"","sources":["../../src/semconv.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH;;;;;;;;GAQG;AACU,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACU,QAAA,qBAAqB,GAAG,kBAA2B,CAAC;AAEjE;;;;;;GAMG;AACU,QAAA,mBAAmB,GAAG,gBAAyB,CAAC;AAE7D;;;;;;;;;;;GAWG;AACU,QAAA,qBAAqB,GAAG,kBAA2B,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n/**\n * Array of brand name and version separated by a space\n *\n * @example [\" Not A;Brand 99\", \"Chromium 99\", \"Chrome 99\"]\n *\n * @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`).\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_BRANDS = 'browser.brands' as const;\n\n/**\n * Preferred language of the user using the browser\n *\n * @example en\n * @example en-US\n * @example fr\n * @example fr-FR\n *\n * @note This value is intended to be taken from the Navigator API `navigator.language`.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_LANGUAGE = 'browser.language' as const;\n\n/**\n * A boolean that is true if the browser is running on a mobile device\n *\n * @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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_MOBILE = 'browser.mobile' as const;\n\n/**\n * The platform on which the browser is running\n *\n * @example Windows\n * @example macOS\n * @example Android\n *\n * @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.platform` API **SHOULD NOT** be used instead and this attribute **SHOULD** be left unset in order for the values to be consistent.\n * 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.\n *\n * @experimental This attribute is experimental and is subject to breaking changes in minor releases of `@opentelemetry/semantic-conventions`.\n */\nexport const ATTR_BROWSER_PLATFORM = 'browser.platform' as const;\n"]}
|
package/build/src/types.d.ts
DELETED
package/build/src/types.js
DELETED
package/build/src/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\nexport type UserAgentData = {\n brands: { brand: string; version: string }[];\n platform: string;\n mobile: boolean;\n};\n"]}
|
package/build/src/version.d.ts
DELETED
package/build/src/version.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/*
|
|
3
|
-
* Copyright The OpenTelemetry Authors
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.VERSION = void 0;
|
|
8
|
-
// this is autogenerated file, see scripts/version-update.js
|
|
9
|
-
exports.VERSION = '0.222.0';
|
|
10
|
-
//# sourceMappingURL=version.js.map
|
package/build/src/version.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,4DAA4D;AAC/C,QAAA,OAAO,GAAG,SAAS,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n * SPDX-License-Identifier: Apache-2.0\n */\n\n// this is autogenerated file, see scripts/version-update.js\nexport const VERSION = '0.222.0';\n"]}
|