Telemetry
Quick and easy telemetry setup
AXAR comes with built-in support for OpenTelemetry to collect telemetry data. OpenTelemetry is an open-source framework that helps you capture and analyze what's happening in your app.
Getting started
Good news - there's nothing extra you need to do to enable telemetry! If you've already set up OpenTelemetry in your project, AXAR will automatically hook into it. Here's how you can get started with NodeSDK
.
Step 1: Install dependencies
First, install the required OpenTelemetry packages:
Step 2: Set up NodeSDK
NodeSDK
Now, add the following setup in your code:
✔ Full code example can be found here: https://github.com/axar-ai/axar/blob/main/examples/telemetry/greeting-agent-with-telemetry.ts
For cleaner code, consider moving the telemetry setup into its own config file or following best practices for your framework/platform.
Testing your setup
To test telemetry locally, you'll need an OpenTelemetry collector and a compatible backend. We recommend using the OpenTelemetry dev environment.
Once everything is running, you can visualize traces using Jaeger or Zipkin.
Deployment
To deploy OpenTelemetry in production, check out the OpenTelemetry Collector Getting Started guide. It walks you through setting up the collector and configuring it to receive data from your app.
Last updated