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