Skip to content

Commit

Permalink
chore(examples/mongodb): use exported strings for attributes (#2125)
Browse files Browse the repository at this point in the history
Use exported strings for Semantic Attributes

Refs: #2025
  • Loading branch information
maryliag committed Apr 25, 2024
1 parent 09c8e42 commit 4a4a087
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions examples/mongodb/package.json
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions examples/mongodb/src/tracer.ts
Expand Up @@ -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
})
});

Expand Down

0 comments on commit 4a4a087

Please sign in to comment.