Package Exports
- @sumologic/opentelemetry-node
- @sumologic/opentelemetry-node/dist/sumologic-opentelemetry-node.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@sumologic/opentelemetry-node) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Sumo Logic OpenTelemetry Node
An all-in-one runner for node.js projects used to enable OpenTelemetry auto-instrumentation.
Usage
Instead of running your script like node index.js
, do npx @sumologic/opentelemetry-node index.js
.
Your index.js
file will run automatically with a started @opentelemetry/sdk-node
.
Remember to provide configuration using environment variables:
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
- your traces collector's source URLOTEL_SERVICE_NAME
- a logical service name that represents its business logicOTEL_RESOURCE_ATTRIBUTES
- extra attributes attached to all spans
e.g. OTEL_SERVICE_NAME=api OTEL_RESOURCE_ATTRIBUTES="application=default,deployment=test" OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://... npx @sumologic/opentelemetry-node index.js
Instrumented packages
This package enables all officially supported core and contrib auto-instrumentation plugins defined in @opentelemetry/auto-instrumentations-node, that is:
- @opentelemetry/instrumentation-dns
- @opentelemetry/instrumentation-http
- @opentelemetry/instrumentation-grpc
- @opentelemetry/instrumentation-express
- @opentelemetry/instrumentation-koa
- @opentelemetry/instrumentation-graphql
- @opentelemetry/instrumentation-ioredis
- @opentelemetry/instrumentation-redis
- @opentelemetry/instrumentation-pg
- @opentelemetry/instrumentation-mongodb
- @opentelemetry/instrumentation-mysql
Manual instrumentation
In order to create spans manually, install @opentelemetry/api
package npm i @opentelemetry/api@^1.0.4
.
Example:
const opentelemetry = require('@opentelemetry/api');
const tracer = opentelemetry.trace.getTracer('default');
const span = tracer.startSpan('operation');
span.end();