murnitur-otlp-exporter
v0.0.2
Published
The Murnitur OTLP Exporter is a custom exporter tailored for OpenTelemetry in Node.js applications, facilitating the seamless transmission of trace and metric data to external destinations such as Murnitur server or compatible backend services. Specifical
Downloads
1
Maintainers
Readme
Murnitur OTLP Exporter
The Murnitur OTLP Exporter is a custom exporter tailored for OpenTelemetry in Node.js applications, facilitating the seamless transmission of trace and metric data to external destinations such as Murnitur server or compatible backend services. Specifically designed for Node.js environments, this exporter efficiently captures and forwards traces and metrics, enabling enhanced observability and monitoring capabilities. With customizable configurations and built-in reliability features, the Murnitur OTLP Exporter ensures efficient and dependable transmission of trace and metric data, empowering developers to gain valuable insights into application performance and behavior.
Installation
npm install murnitur-otlp-exporter
Setup Tracing Collection
Here's an example demonstrating how to set up tracing collection:
import { MurniturTraceExporter } from "murnitur-otlp-exporter";
// using OpenTelemetry Node.js SDK
const sdk = new NodeSDK({
traceExporter: new MurniturTraceExporter({
headers: {
"x-murnitur-service-token": <MURNITUR_OTLP_TOKEN>,
},
}),
serviceName: "murnitur-app",
});
By default, it directs the traces to https://api.murnitur.com/v1/trace
, associating them with your service token. To alter the destination of the traces, simply include the url
property and specify the desired endpoint.
Changing the url endpoint
const sdk = new NodeSDK({
traceExporter: new MurniturTraceExporter({
url: <INSERT_YOUR_URL_HERE>
headers: {
"x-murnitur-service-token": <MURNITUR_OTLP_TOKEN>,
},
}),
serviceName: "murnitur-app",
});
To send data to Murnitur's backend service, you'll need a service token. You can generate one directly from the dashboard when creating a Telemetry instance.
Setup Metrics Collection
Here's an example demonstrating how to set up tracing collection:
import { MurniturMetricExporter } from "murnitur-otlp-exporter";
import { PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
// using OpenTelemetry Node.js SDK
const sdk = new NodeSDK({
metricReader: new PeriodicExportingMetricReader({
exporter: new MurniturMetricExporter({
headers: {
"x-murnitur-service-token": <MURNITUR_OTLP_TOKEN>,
},
}),
}),
serviceName: "murnitur-app",
});