Skip to content

Commit

Permalink
refactor(core): Use (tree-shakeable) string constants for semconv (op…
Browse files Browse the repository at this point in the history
…en-telemetry#4739)

* refactor(core): Use exported strings for semconv

* Update changelog
  • Loading branch information
JohannesHuster authored and Zirak committed Sep 14, 2024
1 parent cd9dece commit 31df6e6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ For experimental package changes, see the [experimental CHANGELOG](experimental/

* feat: support node 22 [#4666](https://github.com/open-telemetry/opentelemetry-js/pull/4666) @dyladan
* feat(context-zone*): support zone.js 0.12.x [#4376](https://github.com/open-telemetry/opentelemetry-js/pull/4736) @maldago
* refactor(core): Use tree-shakeable string constants for semconv [#4739](https://github.com/open-telemetry/opentelemetry-js/pull/4739) @JohannesHuster

### :bug: (Bug Fix)

Expand Down
16 changes: 9 additions & 7 deletions packages/opentelemetry-core/src/platform/browser/sdk-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@

import { VERSION } from '../../version';
import {
TelemetrySdkLanguageValues,
SemanticResourceAttributes,
SEMRESATTRS_TELEMETRY_SDK_NAME,
SEMRESATTRS_PROCESS_RUNTIME_NAME,
SEMRESATTRS_TELEMETRY_SDK_LANGUAGE,
TELEMETRYSDKLANGUAGEVALUES_WEBJS,
SEMRESATTRS_TELEMETRY_SDK_VERSION,
} from '@opentelemetry/semantic-conventions';

/** Constants describing the SDK in use */
export const SDK_INFO = {
[SemanticResourceAttributes.TELEMETRY_SDK_NAME]: 'opentelemetry',
[SemanticResourceAttributes.PROCESS_RUNTIME_NAME]: 'browser',
[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]:
TelemetrySdkLanguageValues.WEBJS,
[SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: VERSION,
[SEMRESATTRS_TELEMETRY_SDK_NAME]: 'opentelemetry',
[SEMRESATTRS_PROCESS_RUNTIME_NAME]: 'browser',
[SEMRESATTRS_TELEMETRY_SDK_LANGUAGE]: TELEMETRYSDKLANGUAGEVALUES_WEBJS,
[SEMRESATTRS_TELEMETRY_SDK_VERSION]: VERSION,
};
16 changes: 9 additions & 7 deletions packages/opentelemetry-core/src/platform/node/sdk-info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,17 @@

import { VERSION } from '../../version';
import {
TelemetrySdkLanguageValues,
SemanticResourceAttributes,
SEMRESATTRS_TELEMETRY_SDK_NAME,
SEMRESATTRS_PROCESS_RUNTIME_NAME,
SEMRESATTRS_TELEMETRY_SDK_LANGUAGE,
TELEMETRYSDKLANGUAGEVALUES_NODEJS,
SEMRESATTRS_TELEMETRY_SDK_VERSION,
} from '@opentelemetry/semantic-conventions';

/** Constants describing the SDK in use */
export const SDK_INFO = {
[SemanticResourceAttributes.TELEMETRY_SDK_NAME]: 'opentelemetry',
[SemanticResourceAttributes.PROCESS_RUNTIME_NAME]: 'node',
[SemanticResourceAttributes.TELEMETRY_SDK_LANGUAGE]:
TelemetrySdkLanguageValues.NODEJS,
[SemanticResourceAttributes.TELEMETRY_SDK_VERSION]: VERSION,
[SEMRESATTRS_TELEMETRY_SDK_NAME]: 'opentelemetry',
[SEMRESATTRS_PROCESS_RUNTIME_NAME]: 'node',
[SEMRESATTRS_TELEMETRY_SDK_LANGUAGE]: TELEMETRYSDKLANGUAGEVALUES_NODEJS,
[SEMRESATTRS_TELEMETRY_SDK_VERSION]: VERSION,
};

0 comments on commit 31df6e6

Please sign in to comment.