JSPM

@sumologic/opentelemetry-node

1.0.0-beta1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q62233F
  • 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.

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 URL
  • 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_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:

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();