From 22a91174dd25862c2736b184bb97b24ab3b9a7e7 Mon Sep 17 00:00:00 2001 From: maryliag Date: Fri, 19 Apr 2024 14:19:46 -0400 Subject: [PATCH] chore(examples/mongodb): use exported strings for attributes Use exported strings for Semantic Attributes --- examples/mongodb/package.json | 1 + examples/mongodb/src/tracer.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/mongodb/package.json b/examples/mongodb/package.json index f96cd0feb2..7bf097e553 100644 --- a/examples/mongodb/package.json +++ b/examples/mongodb/package.json @@ -38,6 +38,7 @@ "@opentelemetry/instrumentation-mongodb": "^0.32.0", "@opentelemetry/sdk-trace-node": "^1.0.0", "@opentelemetry/sdk-trace-base": "^1.0.0", + "@opentelemetry/semantic-conventions": "^1.23.0", "mongodb": "^3.6.11" }, "homepage": "https://github.com/open-telemetry/opentelemetry-js-contrib#readme", diff --git a/examples/mongodb/src/tracer.ts b/examples/mongodb/src/tracer.ts index e38075df25..4e63724503 100644 --- a/examples/mongodb/src/tracer.ts +++ b/examples/mongodb/src/tracer.ts @@ -8,13 +8,13 @@ import { ZipkinExporter } from '@opentelemetry/exporter-zipkin'; import { registerInstrumentations } from '@opentelemetry/instrumentation'; import { HttpInstrumentation } from '@opentelemetry/instrumentation-http'; import { MongoDBInstrumentation } from '@opentelemetry/instrumentation-mongodb'; -import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'; +import { SEMRESATTRS_SERVICE_NAME } from '@opentelemetry/semantic-conventions'; export const setupTracing = (serviceName: string): api.Tracer => { const provider = new NodeTracerProvider({ resource: new Resource({ - [SemanticResourceAttributes.SERVICE_NAME]: serviceName + [SEMRESATTRS_SERVICE_NAME]: serviceName }) });