langfuse-observability
Set up comprehensive observability for Langfuse with metrics, dashboards, and alerts. Use when implementing monitoring for LLM operations, setting up dashboards, or configuring alerting for Langfuse integration health. Trigger with phrases like "langfuse monitoring", "langfuse metrics", "langfuse observability", "monitor langfuse", "langfuse alerts", "langfuse dashboard".
Best use case
langfuse-observability is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Set up comprehensive observability for Langfuse with metrics, dashboards, and alerts. Use when implementing monitoring for LLM operations, setting up dashboards, or configuring alerting for Langfuse integration health. Trigger with phrases like "langfuse monitoring", "langfuse metrics", "langfuse observability", "monitor langfuse", "langfuse alerts", "langfuse dashboard".
Teams using langfuse-observability should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/langfuse-observability/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How langfuse-observability Compares
| Feature / Agent | langfuse-observability | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Set up comprehensive observability for Langfuse with metrics, dashboards, and alerts. Use when implementing monitoring for LLM operations, setting up dashboards, or configuring alerting for Langfuse integration health. Trigger with phrases like "langfuse monitoring", "langfuse metrics", "langfuse observability", "monitor langfuse", "langfuse alerts", "langfuse dashboard".
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
Related Guides
Best AI Skills for Claude
Explore the best AI skills for Claude and Claude Code across coding, research, workflow automation, documentation, and agent operations.
ChatGPT vs Claude for Agent Skills
Compare ChatGPT and Claude for AI agent skills across coding, writing, research, and reusable workflow execution.
SKILL.md Source
# Langfuse Observability
## Overview
Set up monitoring for your Langfuse integration: Prometheus metrics for trace/generation throughput, Grafana dashboards, alert rules, and integration with Langfuse's built-in analytics dashboards and Metrics API.
## Prerequisites
- Langfuse SDK integrated and producing traces
- For custom metrics: Prometheus + Grafana (or compatible stack)
- For Langfuse analytics: access to the Langfuse UI dashboard
## Instructions
### Step 1: Langfuse Built-In Dashboards
Langfuse provides pre-built dashboards in the UI at `https://cloud.langfuse.com` (or your self-hosted URL):
- **Overview**: Total traces, generations, scores, and errors
- **Cost Dashboard**: Token usage and costs over time, broken down by model, user, session
- **Latency Dashboard**: Response times across models and user segments
- **Custom Dashboards**: Build your own with the query engine (multi-level aggregations, filters by user/model/tag)
**Accessing via Metrics API:**
```typescript
import { LangfuseClient } from "@langfuse/client";
const langfuse = new LangfuseClient();
// Fetch aggregated metrics programmatically
const traces = await langfuse.api.traces.list({
fromTimestamp: new Date(Date.now() - 3600000).toISOString(), // Last hour
limit: 100,
});
console.log(`Traces in last hour: ${traces.data.length}`);
// Get observations with cost data
const observations = await langfuse.api.observations.list({
type: "GENERATION",
fromTimestamp: new Date(Date.now() - 86400000).toISOString(),
limit: 500,
});
const totalCost = observations.data.reduce(
(sum, obs) => sum + (obs.calculatedTotalCost || 0), 0
);
console.log(`Total cost (24h): $${totalCost.toFixed(4)}`);
```
### Step 2: Prometheus Metrics for Your App
Track the health of your Langfuse integration with custom Prometheus metrics:
```typescript
// src/lib/langfuse-metrics.ts
import { Counter, Histogram, Gauge, Registry } from "prom-client";
const registry = new Registry();
export const metrics = {
tracesCreated: new Counter({
name: "langfuse_traces_created_total",
help: "Total traces created",
labelNames: ["status"],
registers: [registry],
}),
generationDuration: new Histogram({
name: "langfuse_generation_duration_seconds",
help: "LLM generation latency",
labelNames: ["model"],
buckets: [0.1, 0.5, 1, 2, 5, 10, 30],
registers: [registry],
}),
tokensUsed: new Counter({
name: "langfuse_tokens_total",
help: "Total tokens used",
labelNames: ["model", "type"],
registers: [registry],
}),
costUsd: new Counter({
name: "langfuse_cost_usd_total",
help: "Total LLM cost in USD",
labelNames: ["model"],
registers: [registry],
}),
flushErrors: new Counter({
name: "langfuse_flush_errors_total",
help: "Total flush/export errors",
registers: [registry],
}),
};
export { registry };
```
```typescript
// src/lib/traced-llm.ts -- Instrumented LLM wrapper
import { observe, updateActiveObservation } from "@langfuse/tracing";
import { metrics } from "./langfuse-metrics";
import OpenAI from "openai";
const openai = new OpenAI();
export const tracedLLM = observe(
{ name: "llm-call", asType: "generation" },
async (model: string, messages: OpenAI.ChatCompletionMessageParam[]) => {
const start = Date.now();
updateActiveObservation({ model, input: messages });
try {
const response = await openai.chat.completions.create({ model, messages });
const duration = (Date.now() - start) / 1000;
metrics.generationDuration.observe({ model }, duration);
metrics.tracesCreated.inc({ status: "success" });
if (response.usage) {
metrics.tokensUsed.inc({ model, type: "prompt" }, response.usage.prompt_tokens);
metrics.tokensUsed.inc({ model, type: "completion" }, response.usage.completion_tokens);
}
updateActiveObservation({
output: response.choices[0].message.content,
usage: {
promptTokens: response.usage?.prompt_tokens,
completionTokens: response.usage?.completion_tokens,
},
});
return response.choices[0].message.content;
} catch (error) {
metrics.tracesCreated.inc({ status: "error" });
throw error;
}
}
);
```
### Step 3: Expose Metrics Endpoint
```typescript
// src/routes/metrics.ts
import { registry } from "../lib/langfuse-metrics";
app.get("/metrics", async (req, res) => {
res.set("Content-Type", registry.contentType);
res.end(await registry.metrics());
});
```
### Step 4: Prometheus Scrape Config
```yaml
# prometheus.yml
scrape_configs:
- job_name: "llm-app"
scrape_interval: 15s
static_configs:
- targets: ["llm-app:3000"]
```
### Step 5: Grafana Dashboard
```json
{
"panels": [
{
"title": "LLM Requests/min",
"type": "graph",
"targets": [{ "expr": "rate(langfuse_traces_created_total[5m]) * 60" }]
},
{
"title": "Generation Latency P95",
"type": "graph",
"targets": [{ "expr": "histogram_quantile(0.95, rate(langfuse_generation_duration_seconds_bucket[5m]))" }]
},
{
"title": "Cost/Hour",
"type": "stat",
"targets": [{ "expr": "rate(langfuse_cost_usd_total[1h]) * 3600" }]
},
{
"title": "Error Rate",
"type": "graph",
"targets": [{ "expr": "rate(langfuse_traces_created_total{status='error'}[5m]) / rate(langfuse_traces_created_total[5m])" }]
}
]
}
```
### Step 6: Alert Rules
```yaml
# alertmanager-rules.yml
groups:
- name: langfuse
rules:
- alert: HighLLMErrorRate
expr: rate(langfuse_traces_created_total{status="error"}[5m]) / rate(langfuse_traces_created_total[5m]) > 0.05
for: 5m
labels: { severity: critical }
annotations:
summary: "LLM error rate above 5%"
- alert: HighLLMLatency
expr: histogram_quantile(0.95, rate(langfuse_generation_duration_seconds_bucket[5m])) > 10
for: 5m
labels: { severity: warning }
annotations:
summary: "LLM P95 latency above 10s"
- alert: HighDailyCost
expr: rate(langfuse_cost_usd_total[1h]) * 24 > 100
for: 15m
labels: { severity: warning }
annotations:
summary: "Projected daily LLM cost exceeds $100"
```
## Key Metrics Reference
| Metric | Type | Purpose |
|--------|------|---------|
| `langfuse_traces_created_total` | Counter | LLM request throughput + error rate |
| `langfuse_generation_duration_seconds` | Histogram | Latency percentiles |
| `langfuse_tokens_total` | Counter | Token usage tracking |
| `langfuse_cost_usd_total` | Counter | Budget monitoring |
| `langfuse_flush_errors_total` | Counter | SDK health |
## Error Handling
| Issue | Cause | Solution |
|-------|-------|----------|
| Missing metrics | No instrumentation | Use the `tracedLLM` wrapper |
| High cardinality | Too many label values | Limit to model + status only |
| Alert storms | Thresholds too low | Start conservative, tune over time |
| Metrics endpoint slow | Large registry | Use summary instead of histogram for high-volume |
## Resources
- [Langfuse Metrics Overview](https://langfuse.com/docs/metrics/overview)
- [Custom Dashboards](https://langfuse.com/docs/metrics/features/custom-dashboards)
- [Metrics API](https://langfuse.com/docs/metrics/features/metrics-api)
- [Token & Cost Tracking](https://langfuse.com/docs/observability/features/token-and-cost-tracking)Related Skills
windsurf-observability
Monitor Windsurf AI adoption, feature usage, and team productivity metrics. Use when tracking AI feature usage, measuring ROI, setting up dashboards, or analyzing Cascade effectiveness across your team. Trigger with phrases like "windsurf monitoring", "windsurf metrics", "windsurf analytics", "windsurf usage", "windsurf adoption".
webflow-observability
Set up observability for Webflow integrations — Prometheus metrics for API calls, OpenTelemetry tracing, structured logging with pino, Grafana dashboards, and alerting for rate limits, errors, and latency. Trigger with phrases like "webflow monitoring", "webflow metrics", "webflow observability", "monitor webflow", "webflow alerts", "webflow tracing".
vercel-observability
Set up Vercel observability with runtime logs, analytics, log drains, and OpenTelemetry tracing. Use when implementing monitoring for Vercel deployments, setting up log drains, or configuring alerting for function errors and performance. Trigger with phrases like "vercel monitoring", "vercel metrics", "vercel observability", "vercel logs", "vercel alerts", "vercel tracing".
veeva-observability
Veeva Vault observability for enterprise operations. Use when implementing advanced Veeva Vault patterns. Trigger: "veeva observability".
vastai-observability
Monitor Vast.ai GPU instance health, utilization, and costs. Use when setting up monitoring dashboards, configuring alerts, or tracking GPU utilization and spending. Trigger with phrases like "vastai monitoring", "vastai metrics", "vastai observability", "monitor vastai", "vastai alerts".
twinmind-observability
Monitor TwinMind transcription quality, meeting coverage, action item extraction rates, and memory vault health. Use when implementing observability, or managing TwinMind meeting AI operations. Trigger with phrases like "twinmind observability", "twinmind observability".
speak-observability
Monitor Speak API health, assessment latency, session metrics, and pronunciation score distributions. Use when implementing observability, or managing Speak language learning platform operations. Trigger with phrases like "speak observability", "speak observability".
snowflake-observability
Set up Snowflake observability using ACCOUNT_USAGE views, alerts, and external monitoring. Use when implementing Snowflake monitoring dashboards, setting up query performance tracking, or configuring alerting for warehouse and pipeline health. Trigger with phrases like "snowflake monitoring", "snowflake metrics", "snowflake observability", "snowflake dashboard", "snowflake alerts".
shopify-observability
Set up observability for Shopify app integrations with query cost tracking, rate limit monitoring, webhook delivery metrics, and structured logging. Trigger with phrases like "shopify monitoring", "shopify metrics", "shopify observability", "monitor shopify API", "shopify alerts", "shopify dashboard".
salesforce-observability
Set up observability for Salesforce integrations with API limit monitoring, error tracking, and alerting. Use when implementing monitoring for Salesforce operations, tracking API consumption, or configuring alerting for Salesforce integration health. Trigger with phrases like "salesforce monitoring", "salesforce metrics", "salesforce observability", "monitor salesforce", "salesforce alerts", "salesforce API usage dashboard".
retellai-observability
Retell AI observability — AI voice agent and phone call automation. Use when working with Retell AI for voice agents, phone calls, or telephony. Trigger with phrases like "retell observability", "retellai-observability", "voice agent".
replit-observability
Monitor Replit deployments with health checks, uptime tracking, resource usage, and alerting. Use when setting up monitoring for Replit apps, building health dashboards, or configuring alerting for deployment health and performance. Trigger with phrases like "replit monitoring", "replit metrics", "replit observability", "monitor replit", "replit alerts", "replit uptime".