JSPM

@sumologic/opentelemetry-node

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 29
  • Score
    100M100P100Q62692F
  • License Apache-2.0

Adds OpenTelemetry tracing auto-instrumentation for Node.js

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.

It contains all supported detectors, propagators and auto-instrumentation plugins.

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_ENDPOINT - source URL of your traces collector
  • OTEL_SERVICE_NAME - a logical service name that represents its business logic
  • OTEL_RESOURCE_ATTRIBUTES - extra attributes attached to all spans

e.g. OTEL_SERVICE_NAME=api OTEL_RESOURCE_ATTRIBUTES="application=default,deployment=test" OTEL_EXPORTER_OTLP_ENDPOINT=https://... npx @sumologic/opentelemetry-node index.js.

To speed up npx @sumologic/opentelemetry-node command, you can do npm i -g @sumologic/opentelemetry-node.

Instrumented packages

This package enables all officially supported core and contrib auto-instrumentation plugins defined in @opentelemetry/auto-instrumentations-node, that is:

Manual instrumentation

In order to create spans manually, install @opentelemetry/api package: npm i @opentelemetry/api@^1.9.0.

Example:

const opentelemetry = require('@opentelemetry/api');

const tracer = opentelemetry.trace.getTracer('default');
const span = tracer.startSpan('operation');
span.end();