langfuse-reference-architecture

Featured

Production-grade Langfuse architecture patterns and best practices. Use when designing LLM observability infrastructure, planning Langfuse deployment, or implementing enterprise-grade tracing architecture. Trigger with phrases like "langfuse architecture", "langfuse design", "langfuse infrastructure", "langfuse enterprise", "langfuse at scale".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Langfuse Reference Architecture ## Overview Production-grade architecture patterns for Langfuse LLM observability: singleton SDK, context propagation with `AsyncLocalStorage`, cross-service trace correlation, multi-environment configurations, and scale strategies. ## Prerequisites - Understanding of distributed systems and async patterns - Node.js 18+ with OpenTelemetry SDK - For v4+: `@langfuse/tracing`, `@langfuse/otel`, `@opentelemetry/sdk-node` ## Architecture Tiers | Tier | Scale | Architecture | Langfuse Host | |------|-------|-------------|---------------| | Starter | < 100K traces/day | Direct SDK, Cloud | Langfuse Cloud | | Growth | 100K-1M traces/day | Singleton + batching | Cloud or Self-hosted | | Enterprise | 1M+ traces/day | Queue-buffered + sampling | Self-hosted (HA) | ## Instructions ### Pattern 1: Singleton SDK with Context Propagation ```typescript // src/lib/tracing.ts -- Single module for all tracing import { LangfuseClient } from "@langfuse/client"; import { LangfuseSpanProcessor } from "@langfuse/otel"; import { NodeSDK } from "@opentelemetry/sdk-node"; import { AsyncLocalStorage } from "async_hooks"; // Singleton OTel SDK let sdk: NodeSDK | null = null; export function initTracing() { if (sdk) return sdk; sdk = new NodeSDK({ spanProcessors: [ new LangfuseSpanProcessor({ exportIntervalMillis: 5000, maxExportBatchSize: 50, }), ], }); sdk.start(); // Graceful shutdown for (const signal of ["SIGT...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category