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

@reaatech/otel-genai-semconv-exporters

v0.1.0

Published

Dashboard exporters for Phoenix, Langfuse, and Cloud Trace

Readme

@reaatech/otel-genai-semconv-exporters

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

Custom OpenTelemetry span exporters that convert GenAI spans into the native format of three observability platforms: Arize Phoenix, Langfuse, and Google Cloud Trace. Each exporter implements the OTel SpanExporter interface and provides a get*Format() method for direct format conversion.

Installation

npm install @reaatech/otel-genai-semconv-exporters
# or
pnpm add @reaatech/otel-genai-semconv-exporters

Feature Overview

  • Phoenix exporter — converts OTel spans to Phoenix dataset format with trace/span/parent IDs, timestamps, attributes, and events
  • Langfuse exporter — converts spans to Langfuse trace/observation format with auto-extracted input/output from message events
  • Cloud Trace exporter — converts spans to GCP Cloud Trace format with project-scoped trace IDs, display names, and span kind/status mapping
  • Circular buffer — configurable max span capacity with oldest-eviction for Phoenix and Cloud Trace exporters
  • Span filtering — all exporters filter to gen_ai.* spans only
  • Dual ESM/CJS output — works with import and require

Quick Start

import {
  PhoenixExporter,
  LangfuseExporter,
  CloudTraceExporter,
} from "@reaatech/otel-genai-semconv-exporters";

const phoenix = new PhoenixExporter({
  datasetName: "llm-traces",
  maxSpans: 1000,
});

const langfuse = new LangfuseExporter({
  publicKey: process.env.LANGFUSE_PUBLIC_KEY,
  secretKey: process.env.LANGFUSE_SECRET_KEY,
});

const cloudTrace = new CloudTraceExporter({
  projectId: "my-gcp-project",
  serviceName: "llm-gateway",
});

API Reference

PhoenixExporter (class)

Implements SpanExporter. Buffers gen_ai.* spans and provides Phoenix-compatible format conversion.

Constructor

new PhoenixExporter({ endpoint?, datasetName?, includeEmbeddings?, maxSpans? })

PhoenixExporterConfig

| Property | Type | Default | Description | |----------|------|---------|-------------| | endpoint | string | — | Phoenix endpoint URL | | datasetName | string | — | Dataset name for traces | | includeEmbeddings | boolean | — | Include embedding data | | maxSpans | number | 1000 | Max spans to buffer before oldest eviction |

Methods

| Method | Description | |--------|-------------| | export(spans, resultCallback) | Buffer GenAI spans, invoke callback | | getPhoenixFormat() | Returns spans in Phoenix format | | forceFlush() | No-op (spans are in-memory) | | shutdown() | Clear all buffered spans |

Phoenix Format

Each span is converted to:

{
  trace_id: string,
  span_id: string,
  parent_span_id?: string,
  name: string,
  start_time: number,   // milliseconds
  end_time: number,      // milliseconds
  status: { code, message? },
  attributes: Record<string, unknown>,
  events: Array<{ name, time, attributes }>,
}

LangfuseExporter (class)

Implements SpanExporter. Buffers gen_ai.* spans and provides Langfuse trace/observation format conversion.

Constructor

new LangfuseExporter({ publicKey?, secretKey?, baseUrl?, projectId? })

LangfuseExporterConfig

| Property | Type | Description | |----------|------|-------------| | publicKey | string | Langfuse public key | | secretKey | string | Langfuse secret key | | baseUrl | string | Langfuse base URL | | projectId | string | Project identifier |

Methods

| Method | Description | |--------|-------------| | export(spans, resultCallback) | Buffer GenAI spans, invoke callback | | getLangfuseFormat() | Returns spans in Langfuse format | | forceFlush() | No-op | | shutdown() | Clear all buffered spans |

Langfuse Format

Each span is converted to:

{
  traceId: string,
  observationId: string,       // span ID
  parentObservationId?: string, // parent span ID
  name: string,
  startTime: string,           // ISO 8601
  endTime: string,             // ISO 8601
  level: "DEFAULT" | "ERROR",
  input: { content: string } | null,   // auto-extracted from gen_ai.user.message event
  output: { content: string } | null,  // auto-extracted from gen_ai.assistant.message event
  metadata: { attributes, events },
}

CloudTraceExporter (class)

Implements SpanExporter. Buffers gen_ai.* spans and provides GCP Cloud Trace format conversion.

Constructor

new CloudTraceExporter({ projectId?, serviceName?, region?, maxSpans? })

CloudTraceExporterConfig

| Property | Type | Default | Description | |----------|------|---------|-------------| | projectId | string | "" | GCP project ID | | serviceName | string | "otel-genai-semconv" | Service name for attribution | | region | string | "us-central1" | GCP region | | maxSpans | number | 1000 | Max spans to buffer before oldest eviction |

Methods

| Method | Description | |--------|-------------| | export(spans, resultCallback) | Buffer GenAI spans, invoke callback | | getCloudTraceFormat() | Returns spans in Cloud Trace format | | forceFlush() | No-op | | shutdown() | Clear all buffered spans |

Cloud Trace Format

Span attributes are validated (only string | number | boolean values). Three convenience attributes are flattened: gen_ai/input_tokens, gen_ai/output_tokens, gen_ai/model.

Usage Patterns

Registration as OTel Span Processor

import { NodeSDK } from "@opentelemetry/sdk-node";
import { PhoenixExporter } from "@reaatech/otel-genai-semconv-exporters";

const sdk = new NodeSDK({
  spanProcessors: [new PhoenixExporter({ datasetName: "llm-traces" })],
});

Direct Format Conversion

Each exporter provides a format conversion method for use outside the OTel pipeline:

const exporter = new LangfuseExporter();
exporter.export(spans, () => {});
const langfuseTraces = exporter.getLangfuseFormat();
// Submit to Langfuse API directly

Factory Functions

import {
  createPhoenixExporter,
  createLangfuseExporter,
  createCloudTraceExporter,
} from "@reaatech/otel-genai-semconv-exporters";

const phoenix = createPhoenixExporter({ datasetName: "my-traces" });
const langfuse = createLangfuseExporter({ publicKey: "pk_...", secretKey: "sk_..." });
const cloudTrace = createCloudTraceExporter({ projectId: "my-project" });

Related Packages

License

MIT