@sumologic/opentelemetry-node

1.0.0 • Public • Published

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_TRACES_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_TRACES_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.0.4.

Example:

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

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

Dependents (0)

Package Sidebar

Install

npm i @sumologic/opentelemetry-node

Weekly Downloads

33

Version

1.0.0

License

Apache-2.0

Unpacked Size

18.8 kB

Total Files

5

Last publish

Collaborators

  • sumologic-rum-cd
  • sumologic-authors
  • kkruk-sumo
  • sumologic-opentelemetry-node-cd