$ npm install @opentelemetry/exporter-trace-otlp-proto
This module provides exporter for node to be used with opentelemetry-collector - last tested with version 0.25.0.
npm install --save @opentelemetry/exporter-trace-otlp-proto
The OpenTelemetry Collector Exporter does not have a service name configuration.
In order to set the service name, use the service.name resource attribute as prescribed in the OpenTelemetry Resource Semantic Conventions.
To see documentation and sample code for the metric exporter, see the exporter-metrics-otlp-proto package
const { BasicTracerProvider, SimpleSpanProcessor } = require('@opentelemetry/sdk-trace-base');
const { OTLPTraceExporter } = require('@opentelemetry/exporter-trace-otlp-proto');
const collectorOptions = {
url: '<opentelemetry-collector-url>', // url is optional and can be omitted - default is http://localhost:4318/v1/traces
headers: {
foo: 'bar'
}, //an optional object containing custom headers to be sent with each request will only work with http
};
const provider = new BasicTracerProvider();
const exporter = new OTLPTraceExporter(collectorOptions);
provider.addSpanProcessor(new SimpleSpanProcessor(exporter));
provider.register();
npm run docker:starthttp://localhost:9411/zipkin/ to observe the tracesApache 2.0 - See LICENSE for more information.
© 2010 - cnpmjs.org x YWFE | Home | YWFE