Install any skill in seconds. Free to start, no credit card required.
Get Started Free →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".
.claude/skills/jeremylongshore-langfuse-observability/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 14% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 36% | 0% |
| case-10 | ✗→✓ | ▲ Improved | 148% | 0% |
| case-11 | ✗→✓ | ▲ Improved | 103% | 0% |
| case-13 | ✗→✓ | ▲ Improved | 61% | 0% |
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.
Langfuse provides pre-built dashboards in the UI at https://cloud.langfuse.com (or your self-hosted URL):
Accessing via Metrics API:
typescriptimport { 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)}`);
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; } } );
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()); });
yaml# prometheus.yml scrape_configs: - job_name: "llm-app" scrape_interval: 15s static_configs: - targets: ["llm-app:3000"]
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])" }] } ] }
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"
| 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 |
| 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 |
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 21,655 | 13,356 | -38% | 1 | 1 | 0% | 3,543 | 4,024 | +14% | 0 | 0 | — |
case-02 | fail→fail | 26,385 | 26,852 | +2% | 1 | 1 | 0% | 4,359 | 7,388 | +69% | 0 | 0 | — |
case-03 | fail→fail | 19,010 | 16,180 | -15% | 1 | 1 | 0% | 2,884 | 4,519 | +57% | 0 | 0 | — |
case-04 | pass→pass | 25,190 | 20,000 | -21% | 1 | 1 | 0% | 2,652 | 5,063 | +91% | 0 | 0 | — |
case-05 | pass→pass | 19,798 | 22,666 | +14% | 1 | 1 | 0% | 2,693 | 5,682 | +111% | 0 | 0 | — |
case-06 | pass→pass | 21,861 | 21,990 | +1% | 1 | 1 | 0% | 3,308 | 5,416 | +64% | 0 | 0 | — |
case-07 | fail→pass | 21,791 | 16,461 | -24% | 1 | 1 | 0% | 3,499 | 4,762 | +36% | 0 | 0 | — |
case-08 | fail→fail | 22,222 | 17,041 | -23% | 1 | 1 | 0% | 3,486 | 4,678 | +34% | 0 | 0 | — |
case-09 | pass→pass | 15,818 | 12,482 | -21% | 1 | 1 | 0% | 1,548 | 3,517 | +127% | 0 | 0 | — |
case-10 | fail→pass | 13,238 | 8,453 | -36% | 1 | 1 | 0% | 1,130 | 2,805 | +148% | 0 | 0 | — |
case-11 | fail→pass | 17,802 | 9,613 | -46% | 1 | 1 | 0% | 1,473 | 2,995 | +103% | 0 | 0 | — |
case-12 | fail→fail | 15,233 | 12,589 | -17% | 1 | 1 | 0% | 1,505 | 3,283 | +118% | 0 | 0 | — |
case-13 | fail→pass | 18,794 | 11,221 | -40% | 1 | 1 | 0% | 1,967 | 3,171 | +61% | 0 | 0 | — |
case-14 | fail→pass | 9,542 | 5,077 | -47% | 1 | 1 | 0% | 1,436 | 2,849 | +98% | 0 | 0 | — |
case-15 | fail→pass | 8,076 | 8,222 | +2% | 1 | 1 | 0% | 1,165 | 2,720 | +133% | 0 | 0 | — |
case-16 | fail→fail | 10,854 | 9,522 | -12% | 1 | 1 | 0% | 1,522 | 3,643 | +139% | 0 | 0 | — |
case-17 | fail→pass | 14,742 | 13,504 | -8% | 1 | 1 | 0% | 1,857 | 3,508 | +89% | 0 | 0 | — |
case-18 | fail→pass | 15,452 | 13,212 | -14% | 1 | 1 | 0% | 2,299 | 3,716 | +62% | 0 | 0 | — |
case-19 | pass→pass | 15,355 | 19,743 | +29% | 1 | 1 | 0% | 2,729 | 4,170 | +53% | 0 | 0 | — |
case-20 | fail→fail | 22,002 | 13,615 | -38% | 1 | 1 | 0% | 2,544 | 4,420 | +74% | 0 | 0 | — |
case-21 | fail→pass | 17,242 | 9,461 | -45% | 1 | 1 | 0% | 2,117 | 3,608 | +70% | 0 | 0 | — |
case-22 | fail→fail | 13,177 | 9,238 | -30% | 1 | 1 | 0% | 1,174 | 2,919 | +149% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +45 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.