Quickstart

Unified entry point for Respan tracing in TypeScript.

@respan/respan is the main package for Respan tracing. It provides the Respan class that initializes OpenTelemetry, auto-discovers installed instrumentation packages, and exposes decorators for structured traces.

Install

$npm install @respan/respan @respan/respan-sdk @respan/tracing

Quick start

When you omit the instrumentations option, Respan auto-discovers any installed @respan/instrumentation-* package and activates it — no manual imports required.

1import { Respan } from "@respan/respan";
2
3const respan = new Respan({ apiKey: process.env.RESPAN_API_KEY });
4await respan.initialize();
5
6// Any installed LLM SDK (OpenAI, Anthropic, etc.) is now traced automatically.
7import OpenAI from "openai";
8await new OpenAI().chat.completions.create({
9 model: "gpt-4o",
10 messages: [{ role: "user", content: "Hello" }],
11});

Explicit instrumentation (optional)

Pass instrumentations to pin a specific plugin. Providing this option disables auto-discovery — only the plugins you list are activated.

1import { Respan } from "@respan/respan";
2import { OpenAIInstrumentor } from "@respan/instrumentation-openai";
3
4const respan = new Respan({
5 apiKey: process.env.RESPAN_API_KEY,
6 instrumentations: [new OpenAIInstrumentor()],
7});
8await respan.initialize();

See initialize() for the full configuration reference.

Configuration

ParameterTypeDefaultDescription
apiKeystringRESPAN_API_KEY env varRespan API key
baseURLstringhttps://api.respan.aiAPI base URL
appNamestring"default"Application name for traces
instrumentationsInstrumentation[]auto-discoverPlugins to activate. Omit for auto-discovery.
traceContentbooleantrueCapture input/output content
logLevelstring"error"Log level (debug, info, warn, error)