Skip to content

Commit f64c538

Browse files
committed
fix: default semantic attributes to undefined
1 parent 66d69bb commit f64c538

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

packages/app-info/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ This object contains aliases for the main `appInfo` properties that correspond t
116116
* `appInfo.semanticConventions.service.version` aliases `appInfo.releaseVersion`
117117
* `appInfo.semanticConventions.service.instance.id` aliases `appInfo.instanceId`
118118

119+
> [!WARNING]
120+
> While all other properties default to `null` if they can't be calculated, the semantic conventions properties default to `undefined`. This is to ensure better compatibility with OpenTelemetry SDKs.
119121
120122
## Migrating
121123

packages/app-info/lib/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,15 @@ exports.instanceId = process.env.HEROKU_DYNO_ID || randomUUID();
163163
*/
164164
exports.semanticConventions = {
165165
cloud: {
166-
provider: exports.cloudProvider,
167-
region: exports.region
166+
provider: exports.cloudProvider || undefined,
167+
region: exports.region || undefined
168168
},
169169
deployment: {
170170
environment: exports.environment
171171
},
172172
service: {
173-
name: exports.systemCode,
174-
version: exports.releaseVersion,
173+
name: exports.systemCode || undefined,
174+
version: exports.releaseVersion || undefined,
175175
instance: {
176176
id: exports.instanceId
177177
}

packages/app-info/types/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ declare module '@dotcom-reliability-kit/app-info' {
1313

1414
export type SemanticConventions = {
1515
cloud: {
16-
provider: string | null,
17-
region: string | null
16+
provider?: string,
17+
region?: string
1818
},
1919
deployment: {
2020
environment: string
2121
},
2222
service: {
23-
name: string | null
24-
version: string | null,
23+
name?: string
24+
version?: string,
2525
instance: {
2626
id: string
2727
}

0 commit comments

Comments
 (0)