Socket
Book a DemoInstallSign in
Socket

@instana/opentelemetry-sampler

Package Overview
Dependencies
Maintainers
4
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@instana/opentelemetry-sampler

OpenTelemetry Instana sampler

latest
Source
npmnpm
Version
4.24.0
Version published
Weekly downloads
715
21.19%
Maintainers
4
Weekly downloads
 
Created
Source

@instana/opentelemetry-sampler

The Opentelemetry Instana sampler decides if the app will record and sample based on the Instana headers.

Installation

$ npm i --save @instana/opentelemetry-sampler

Requirements

The sampler should be used together with the @opentelemetry/propagator-instana, because the propagator extracts the incoming HTTP headers.

$ npm i --save @opentelemetry/propagator-instana

NOTE: Every Instana service/app must forward the Instana headers.

Usage

const api = require('@opentelemetry/api');
const opentelemetry = require('@opentelemetry/sdk-node');
const { getNodeAutoInstrumentations } = require('@opentelemetry/auto-instrumentations-node');
const { SemanticResourceAttributes } = require('@opentelemetry/semantic-conventions');
const { Resource } = require('@opentelemetry/resources');
const { InstanaAlwaysOnSampler } = require('@instana/opentelemetry-sampler');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-http');
const { InstanaPropagator } = require('@opentelemetry/propagator-instana');

const nodeAutoInstrumentations = getNodeAutoInstrumentations();
api.propagation.setGlobalPropagator(new InstanaPropagator());

const traceOtlpExporter = new OTLPTraceExporter({
  url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT
});

const sdk = new opentelemetry.NodeSDK({
  traceExporter: traceOtlpExporter,
  instrumentations: [nodeAutoInstrumentations],
  resource: new Resource({
    [SemanticResourceAttributes.SERVICE_NAME]: 'my-service'
  }),
  sampler: new InstanaAlwaysOnSampler()
});

sdk
  .start()
  .then(() => console.log('Tracing initialized'))
  .catch(err => console.log('Error initializing tracing', err));

Keywords

opentelemetry

FAQs

Package last updated on 11 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts