OpenTelemetry
Export LLM cost spans to any OTLP/HTTP collector
The Node SDK can emit LLM spans to an OTLP/HTTP JSON collector (best-effort, non-blocking). ShipGauge ingest still runs independently.
When to use
- You already run Grafana Tempo, Honeycomb, Datadog, or another OTLP pipeline
- You want cost/token spans alongside app traces — without sending prompts to ShipGauge
Configure
import { ShipGauge } from "@shipgauge/node";
const sg = ShipGauge.init({
apiKey: process.env.SHIPGAUGE_API_KEY!,
projectId: process.env.SHIPGAUGE_PROJECT_ID!,
baseUrl: "https://shipgauge.dev",
otel: {
endpoint: "https://otel-collector.example/v1/traces",
serviceName: "my-app",
headers: { Authorization: "Bearer token" },
},
});
await sg.record({
feature_id: "chat",
model: "gpt-4o-mini",
input_tokens: 100,
output_tokens: 50,
});
Wrapped OpenAI/Anthropic calls also emit spans when OTel is enabled.
Span shape
- Name:
llm.{feature_id} - Attributes:
llm.model,llm.cost_usd,llm.input_tokens,llm.output_tokens, optionalllm.latency_ms
Notes
- Export failures must not break your request path (best-effort).
- This does not replace ShipGauge Overview — use it as an additional sink.