@contrail/telemetry 2.0.11-alpha-semantic-convention.1 → 2.0.11
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/CHANGELOG.md
CHANGED
|
@@ -9,7 +9,7 @@ Versioning follows [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
|
9
9
|
|
|
10
10
|
### Added
|
|
11
11
|
|
|
12
|
-
- **`
|
|
12
|
+
- **`buildContrailAttributeName` helper** — Centralizes the `contrail.*` namespace prefix for custom OTel attributes. Returns a typed template literal (`contrail.${T}`) and enforces lowercase for string literals at compile time. Existing constants (`ATTR_CONTRAIL_SYSTEM`, `ATTR_CONTRAIL_USER`, `ATTR_LOG_MESSAGE`, `ATTR_LOG_BODY`, `ATTR_LOG_PAYLOAD`) now use this helper instead of hardcoded strings.
|
|
13
13
|
|
|
14
14
|
## [2.0.10] - 2026-04-21
|
|
15
15
|
|
|
@@ -8,13 +8,13 @@ const semantic_conventions_1 = require("../semantic-conventions");
|
|
|
8
8
|
/**
|
|
9
9
|
* Attribute key for the log message body.
|
|
10
10
|
*/
|
|
11
|
-
exports.ATTR_LOG_MESSAGE = (0, semantic_conventions_1.
|
|
11
|
+
exports.ATTR_LOG_MESSAGE = (0, semantic_conventions_1.buildContrailAttributeName)('message');
|
|
12
12
|
/**
|
|
13
13
|
* Custom attribute that duplicates the log body so it is available for
|
|
14
14
|
* grouping / filtering in observability UIs that only expose custom attributes.
|
|
15
15
|
*/
|
|
16
|
-
exports.ATTR_LOG_BODY = (0, semantic_conventions_1.
|
|
16
|
+
exports.ATTR_LOG_BODY = (0, semantic_conventions_1.buildContrailAttributeName)('log.body');
|
|
17
17
|
/**
|
|
18
18
|
* Attribute key for user-provided log payload objects.
|
|
19
19
|
*/
|
|
20
|
-
exports.ATTR_LOG_PAYLOAD = (0, semantic_conventions_1.
|
|
20
|
+
exports.ATTR_LOG_PAYLOAD = (0, semantic_conventions_1.buildContrailAttributeName)('payload');
|
|
@@ -23,10 +23,11 @@ export declare const ATTR_USER_ROLES: "user.roles";
|
|
|
23
23
|
*/
|
|
24
24
|
export declare const ATTR_DEPLOYMENT_ENVIRONMENT_NAME: "deployment.environment.name";
|
|
25
25
|
/**
|
|
26
|
-
* Builds a custom attribute name with the
|
|
27
|
-
*
|
|
26
|
+
* Builds a custom attribute name with the `contrail.*` namespace prefix.
|
|
27
|
+
* Enforces lowercase for string literals at compile time; runtime values are not validated.
|
|
28
|
+
* @example buildContrailAttributeName('event_workflow.task.id') // => 'contrail.event_workflow.task.id'
|
|
28
29
|
*/
|
|
29
|
-
export declare function
|
|
30
|
+
export declare function buildContrailAttributeName<T extends string>(name: T & Lowercase<T>): `contrail.${T}`;
|
|
30
31
|
/**
|
|
31
32
|
* Namespace for Contrail platform context.
|
|
32
33
|
*/
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.ATTR_CONTRAIL_USER = exports.ATTR_CONTRAIL_SYSTEM = exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = exports.ATTR_USER_ROLES = exports.ATTR_USER_EMAIL = exports.ATTR_USER_ID = void 0;
|
|
12
|
-
exports.
|
|
12
|
+
exports.buildContrailAttributeName = buildContrailAttributeName;
|
|
13
13
|
// ---------------------------------------------------------------------------
|
|
14
14
|
// OTel-spec attributes not yet in the SDK
|
|
15
15
|
// ---------------------------------------------------------------------------
|
|
@@ -33,17 +33,18 @@ exports.ATTR_DEPLOYMENT_ENVIRONMENT_NAME = 'deployment.environment.name';
|
|
|
33
33
|
// Contrail-custom attributes
|
|
34
34
|
// ---------------------------------------------------------------------------
|
|
35
35
|
/**
|
|
36
|
-
* Builds a custom attribute name with the
|
|
37
|
-
*
|
|
36
|
+
* Builds a custom attribute name with the `contrail.*` namespace prefix.
|
|
37
|
+
* Enforces lowercase for string literals at compile time; runtime values are not validated.
|
|
38
|
+
* @example buildContrailAttributeName('event_workflow.task.id') // => 'contrail.event_workflow.task.id'
|
|
38
39
|
*/
|
|
39
|
-
function
|
|
40
|
+
function buildContrailAttributeName(name) {
|
|
40
41
|
return `contrail.${name}`;
|
|
41
42
|
}
|
|
42
43
|
/**
|
|
43
44
|
* Namespace for Contrail platform context.
|
|
44
45
|
*/
|
|
45
|
-
exports.ATTR_CONTRAIL_SYSTEM =
|
|
46
|
+
exports.ATTR_CONTRAIL_SYSTEM = buildContrailAttributeName('system');
|
|
46
47
|
/**
|
|
47
48
|
* Namespace for Contrail-custom user attributes (not in OTel spec).
|
|
48
49
|
*/
|
|
49
|
-
exports.ATTR_CONTRAIL_USER =
|
|
50
|
+
exports.ATTR_CONTRAIL_USER = buildContrailAttributeName('user');
|
package/package.json
CHANGED