npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@respan/instrumentation-llama-index

v0.2.0

Published

Respan instrumentation plugin for LlamaIndex TypeScript

Readme

@respan/instrumentation-llama-index

Trace native LlamaIndex TypeScript chat, completion, streaming, agent, retrieval, synthesis, document parsing, and OpenAI embedding calls through the active Respan runtime.

import { Respan } from "@respan/respan";
import { LlamaIndexInstrumentor } from "@respan/instrumentation-llama-index";
import { OpenAI } from "@llamaindex/openai";

const respan = new Respan({
  apiKey: process.env.RESPAN_API_KEY,
  instrumentations: [new LlamaIndexInstrumentor()],
});
await respan.initialize();
// Initialize tracing before constructing clients whose decorators bind methods.
const llm = new OpenAI({
  model: "gpt-4o-mini",
  apiKey: process.env.OPENAI_API_KEY,
});
try {
  await respan.withWorkflow({ name: "answer" }, () =>
    llm.chat({ messages: [{ role: "user", content: "What is tracing?" }] }),
  );
} finally {
  await respan.shutdown();
}

Install llamaindex >=0.12.0, or use the modular @llamaindex/core >=0.6.22 and a provider such as @llamaindex/openai >=0.4.22. The meta package is optional for modular applications. Verified releases are llamaindex 0.12.0 and 0.12.1, core 0.6.22 and 0.6.23, and OpenAI 0.4.22 and 0.4.23. The current meta package embeds core 0.6.22 while current modular providers use 0.6.23; the instrumentor observes both module copies.

activate() and deactivate() can also be called directly after configuring an OTel provider. isActive() reports lifecycle state. Repeated activation is coalesced, multiple owners share patches, foreign wrappers survive deactivation, and observed calls finish after deactivation. Pass llamaIndexModule as a module or module array when resolving explicit SDK copies.

const instrumentor = new LlamaIndexInstrumentor({
  traceContent: true,
  recordInputs: true,
  recordOutputs: false,
});

Constructor flags, RESPAN_TRACE_CONTENT=false, TRACELOOP_TRACE_CONTENT=false, the canonical Traceloop content context, tracing suppression, and an observed ancestor allow_trace_content=false constrain capture. A later true does not restore an observed veto. Sampling runs before payload copying; DROP and RECORD_ONLY spans do not inspect payloads. Inputs and outputs have independent lanes. The actual recording span also rejects late private attributes, events, status text, and property replacement.

Chat spans preserve complete message history, multimodal content, tool schemas, emitted tool calls, and native usage including zero values. Canonical input, tools, output, and usage precede optional indexed attributes under the default OTel attribute budget. Tool execution spans retain the native call ID and {name, arguments}. Workflow, task, and agent spans use common fields. OpenAI embedding spans preserve complete native vectors; LlamaIndex discards the provider's usage before returning vectors, so the adapter does not reconstruct that count. Provider names, token totals, HTTP status, and request models are never guessed.

Generic native callback support remains available across providers and callback manager instances. A provider that emits a start but no terminal callback on rejection cannot supply a standalone terminal result through callbacks; native observed parent failures close their pending callback children as failures. For direct OpenAI calls, method observation also covers rejected promises, iterator errors, and early returns. Native OpenAI Responses calls are captured through OpenAIResponses.chat.

The adapter uses native observation because the released upstream adapters replace stream/promise objects and do not provide these privacy guarantees, complete vectors, or native tool execution mapping. It emits real spans into the configured tracer provider; the Respan runtime owns normalization, semantic names, and export.