diff --git a/packages/node-experimental/package.json b/packages/node-experimental/package.json index be0370637f3d..bdd1e83db7fb 100644 --- a/packages/node-experimental/package.json +++ b/packages/node-experimental/package.json @@ -36,6 +36,7 @@ "@opentelemetry/instrumentation-mysql2": "~0.34.1", "@opentelemetry/instrumentation-nestjs-core": "~0.33.1", "@opentelemetry/instrumentation-pg": "~0.36.1", + "@opentelemetry/resources": "~1.17.0", "@opentelemetry/sdk-trace-base": "~1.17.0", "@opentelemetry/semantic-conventions": "~1.17.0", "@prisma/instrumentation": "~5.3.1", diff --git a/packages/node-experimental/src/sdk/initOtel.ts b/packages/node-experimental/src/sdk/initOtel.ts index b58eec81880e..3ed0e2ab2b2b 100644 --- a/packages/node-experimental/src/sdk/initOtel.ts +++ b/packages/node-experimental/src/sdk/initOtel.ts @@ -1,6 +1,8 @@ import { diag, DiagLogLevel } from '@opentelemetry/api'; +import { Resource } from '@opentelemetry/resources'; import { AlwaysOnSampler, BasicTracerProvider } from '@opentelemetry/sdk-trace-base'; -import { getCurrentHub } from '@sentry/core'; +import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; +import { getCurrentHub, SDK_VERSION } from '@sentry/core'; import { SentryPropagator, SentrySpanProcessor } from '@sentry/opentelemetry-node'; import { logger } from '@sentry/utils'; @@ -28,6 +30,11 @@ export function initOtel(): () => void { // Create and configure NodeTracerProvider const provider = new BasicTracerProvider({ sampler: new AlwaysOnSampler(), + resource: new Resource({ + [SemanticResourceAttributes.SERVICE_NAME]: 'node-experimental', + [SemanticResourceAttributes.SERVICE_NAMESPACE]: 'sentry', + [SemanticResourceAttributes.SERVICE_VERSION]: SDK_VERSION, + }), }); provider.addSpanProcessor(new SentrySpanProcessor()); diff --git a/yarn.lock b/yarn.lock index 774b6abcc4dd..25082dd4c5c7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3993,7 +3993,7 @@ "@opentelemetry/core" "1.15.2" "@opentelemetry/semantic-conventions" "1.15.2" -"@opentelemetry/resources@1.17.0": +"@opentelemetry/resources@1.17.0", "@opentelemetry/resources@~1.17.0": version "1.17.0" resolved "https://registry.yarnpkg.com/@opentelemetry/resources/-/resources-1.17.0.tgz#ee29144cfd7d194c69698c8153dbadec7fe6819f" integrity sha512-+u0ciVnj8lhuL/qGRBPeVYvk7fL+H/vOddfvmOeJaA1KC+5/3UED1c9KoZQlRsNT5Kw1FaK8LkY2NVLYfOVZQw==