OpenTelemetry Mongodb Instrumentation allows the user to automatically collect trace data and export them to the backend of choice (we can use Zipkin or Jaeger for this example), to give observability to distributed systems.
This is a modification of the Mongo example that executes multiple parallel requests that interact with a Mongodb server backend using the mongo
npm module. The example displays traces using multiple connection methods.
- Create Collection Query
- Insert Document Query
- Fetch All Documents Query
$ # from this directory
$ npm install
Setup Zipkin Tracing or Setup Jaeger Tracing
-
Run the server
$ # from this directory $ npm run server
-
Run the client
$ # from this directory $ npm run client
server
script should output the traceid
in the terminal (e.g traceid: 4815c3d576d930189725f1f1d1bdfcc6
).
Go to Zipkin with your browser http://localhost:9411/zipkin/traces/(your-trace-id) (e.g http://localhost:9411/zipkin/traces/4815c3d576d930189725f1f1d1bdfcc6)
-
Run the server
$ # from this directory $ npm run server
-
Run the client
$ # from this directory $ npm run client
server
script should output the traceid
in the terminal (e.g traceid: 4815c3d576d930189725f1f1d1bdfcc6
).
Go to Jaeger with your browser http://localhost:16686/trace/(your-trace-id) (e.g http://localhost:16686/trace/4815c3d576d930189725f1f1d1bdfcc6)
- For more information on OpenTelemetry, visit: https://opentelemetry.io/
- For more information on OpenTelemetry for Node.js, visit: https://github.com/open-telemetry/opentelemetry-js/tree/master/packages/opentelemetry-node
Apache License 2.0