Skip to content

Commit c54e9b6

Browse files
fix(mongodb-example): Ensure instrumentation is setup before mongoDB client is import (#1851)
I wasn't getting any MongoDB info, turned on diag logging and it warned the client was being imported before instrumentation was setup...reordered the imports and started to get spans! Co-authored-by: Amir Blum <[email protected]>
1 parent 577a291 commit c54e9b6

File tree

1 file changed

+2
-2
lines changed
  • plugins/node/opentelemetry-instrumentation-mongodb/examples/src

1 file changed

+2
-2
lines changed

plugins/node/opentelemetry-instrumentation-mongodb/examples/src/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import * as api from '@opentelemetry/api';
22

33
import { setupTracing } from './tracer';
44

5-
import { accessDB } from './utils';
6-
75
setupTracing('example-mongodb-server')
86

7+
import { accessDB } from './utils';
8+
99
import * as http from 'http';
1010
import { IncomingMessage, ServerResponse } from 'http';
1111
import * as mongodb from 'mongodb';

0 commit comments

Comments
 (0)