This page explains how to set up instrumentation with Axiom AI SDK. Expand the section below to chooose the right instrumentation approach for your needs.
Choose your instrumentation approach
Choose your instrumentation approach
Axiom offers the following approaches to capture generative AI telemetry:
Instrumentation with Axiom AI SDK is the right choice for you if you have a TypeScript app and you want the SDK to capture and send traces with the correct semantic conventions.Manual instrumentation is the right choice for you if you want to use your own tooling or if you use a language other than TypeScript. You need to instrument your app manually to emit traces compatible with Axiom’s AI engineering features.Both approaches emit identical attributes. This means that all the telemetry analysis features work the same way.
Instrumentation approach | Language support | Characteristics |
---|---|---|
Axiom AI SDK | TypeScript | Quick setup. Minimal code changes. |
Manual | Any | More involved setup. Full control over instrumentation. |
Prerequisites
- Create an Axiom account.
- Create a dataset in Axiom where you send your data.
- Create an API token in Axiom with permissions to update the dataset you have created.
Install
Install Axiom AI SDK into your TypeScript project:The
axiom
package includes the axiom
command-line interface (CLI) for managing your AI assets, which will be used in later stages of the Axiom AI engineering workflow.Configure tracer
To send data to Axiom, configure a tracer. For example, use a dedicated instrumentation file and load it before the rest of your app. An example configuration for a Node.js environment:-
Install dependencies:
-
Create instrumentation file:
/src/instrumentation.ts
Store environment variables
Store environment variables in an.env
file in the root of your project:
.env
Replace
API_TOKEN
with the Axiom API token you have generated. For added security, store the API token in an environment variable.Replace DATASET_NAME
with the name of the Axiom dataset where you send your data.