mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-18 13:21:55 +00:00
feat(langfuse): add opt-in Langfuse observability integration
Add Langfuse as an OTel trace transport for MCP request lifecycle tracking.
Changes:
- New src/lib/langfuse-transport.ts: initializes LangfuseSpanProcessor when
ASK262_LANGFUSE_ENABLED=true with valid credentials
- src/lib/tracing.ts: add metadata to TraceContext, propagate it to child spans,
use startActiveSpan for proper OTel context, add setupTracing() entry point,
add getSessionMetadata() for version/transport metadata
- src/lib/logger.ts: include TraceContext.metadata in JSON log mixin
- src/mcp-server-{http,stdio}.ts: call setupTracing() at startup, pass
version/transport metadata through withSpan/withSpanContext
- src/lib/fireworks-embeddings.ts: wrap API calls in withSpan() with gen_ai
attributes for Langfuse generation/cost tracking
- .env.example: add LANGFUSE_* configuration variables
- AGENTS.md: document Langfuse integration
- package.json: add @langfuse/tracing, @langfuse/otel, @opentelemetry/sdk-node
This commit is contained in:
@@ -62,3 +62,17 @@ ASK262_EMBEDDING_PROVIDER=ollama
|
||||
# Days to keep rotated logs before deletion (optional, defaults to 30)
|
||||
# Set to 0 to keep forever
|
||||
# ASK262_LOG_RETENTION_DAYS=30
|
||||
|
||||
# =============================================================================
|
||||
# LANGFUSE OBSERVABILITY (opt-in)
|
||||
# =============================================================================
|
||||
|
||||
# Enable Langfuse trace export (defaults to false)
|
||||
# ASK262_LANGFUSE_ENABLED=true
|
||||
|
||||
# Langfuse credentials (required when enabled)
|
||||
# LANGFUSE_PUBLIC_KEY=pk-lf-...
|
||||
# LANGFUSE_SECRET_KEY=sk-lf-...
|
||||
|
||||
# Langfuse host (optional, defaults to https://cloud.langfuse.com)
|
||||
# LANGFUSE_BASE_URL=https://cloud.langfuse.com
|
||||
|
||||
Reference in New Issue
Block a user