OpenTelemetry (OTel) is a vendor-neutral standard for collecting, processing, and exporting telemetry data such as traces, metrics, and logs from your application. It enables observability across distributed systems and is widely adopted for performance monitoring and debugging.
Esadax provides first-class support for OTel, allowing you to integrate telemetry into your project with minimal setup.
Install the required dependencies:
pnpm i @opentelemetry/api @esadax/otel
Then, initialize OTel in your application:
import { registerOTel } from '@esadax/otel'
export function register() {
registerOTel({
serviceName: 'your-project-name',
})
}
This setup will start collecting and exporting trace data under the specified serviceName.
You can also plug in your own trace exporter to control how and where telemetry data is sent. For example:
import { registerOTel } from '@esadax/otel'
import { MyCustomExporter } from './my-custom-exporter'
export function register() {
registerOTel({
serviceName: 'your-project-name',
traceExporter: new MyCustomExporter(),
})
}
Custom exporters give you flexibility to integrate with services like Datadog, New Relic, or internal tracing pipelines.
Use OpenTelemetry if you want to:
Once you've registered OpenTelemetry:
trace and span APIs to instrument specific blocks of codeℹ️ Need deeper configuration options? See OTel Advanced Setup or Exporting to Datadog