- Tracing for ABV Observability using OpenTelemetry
- Client for other ABV features like prompt management, evaluation, or accessing the ABV API
Tracing Setup
Installation
Install the relevant packages for a full tracing setup:
@abvdev/tracing: Core tracing functions (startObservation,startActiveObservation, etc.)@abvdev/otel: TheABVSpanProcessorto export traces to ABV.@opentelemetry/sdk-node: The OpenTelemetry SDK for Node.js.
Register your credentials
Add your ABV credentials to your environment variables. Make sure that you have a
.env file in your project root and a package like dotenv to load the variables.Initialize OpenTelemetry
The ABV TypeScript SDK’s tracing is built on top of OpenTelemetry, so you need to set up the OpenTelemetry SDK. The The Import the For more options to configure the ABVSpanProcessor such as masking, filtering, and more, see the advanced usage.You can learn more about setting up OpenTelemetry in your JS environment here.
ABVSpanProcessor is the key component that sends traces to ABV.instrumentation.ts
ABVSpanProcessor is the key component that sends traces to ABV.Modify instrumentation.ts file to use dotenv package to load the variables.Additional parameters are provided to get trace visible in the UI immediately.instrumentation.ts
instrumentation.ts file at the top of your application.index.ts
If you are using Next.js, please use the OpenTelemetry setup via the
NodeSDK described above rather than via registerOTel from @vercel/otel. This is because the @vercel/otel package does not yet support the OpenTelemetry JS SDK v2 on which the @abvdev/tracing and @abvdev/otel packages are based.See here for a full example for the Vercel AI SDK with NextJS on Vercel.Client Setup
Installation
Register your credentials
Add your ABV credentials to your environment variables. Make sure that you have a
.env file in your project root and a package like dotenv to load the variables.Initialize the client
Initialize the
ABVClient to interact with ABV. The client will automatically use the environment variables you set above.client.ts