Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
Sichere ProgrammierungI built a sell planner to dodge the pros. They were under 4% of buys(25.09.2026 um 04:26 Uhr)
•
Sichere ProgrammierungNansen called Binance 14 a 'Token Billionaire'. The name cost 1 credit(25.09.2026 um 04:26 Uhr)
•
Sichere Programmierung50,000 property tests passed while my app crowned an impostor(25.09.2026 um 04:26 Uhr)
•
Sichere ProgrammierungI made a small website to check Codex reset(25.09.2026 um 04:28 Uhr)
•
Sichere ProgrammierungAI Is My Workforce, Not My Replacement(25.09.2026 um 04:30 Uhr)
•
AI & KI NachrichtenThe Machine Learning Career Roadmap I'd Follow If I Started Today(25.09.2026 um 04:30 Uhr)
•••
Sichere ProgrammierungNormalize Units at the Boundary, or Ship a 12x Bug(25.09.2026 um 04:39 Uhr)
•
Sichere ProgrammierungA No-Repeat Random Draw Looks Trivial Until Round 70(25.09.2026 um 04:40 Uhr)
•
Sichere ProgrammierungI built a sell planner to dodge the pros. They were under 4% of buys(25.09.2026 um 04:26 Uhr)
•
Sichere ProgrammierungNansen called Binance 14 a 'Token Billionaire'. The name cost 1 credit(25.09.2026 um 04:26 Uhr)
•
Sichere Programmierung50,000 property tests passed while my app crowned an impostor(25.09.2026 um 04:26 Uhr)
•
Sichere ProgrammierungI made a small website to check Codex reset(25.09.2026 um 04:28 Uhr)
•
Sichere ProgrammierungAI Is My Workforce, Not My Replacement(25.09.2026 um 04:30 Uhr)
•
AI & KI NachrichtenThe Machine Learning Career Roadmap I'd Follow If I Started Today(25.09.2026 um 04:30 Uhr)
•••
Sichere ProgrammierungNormalize Units at the Boundary, or Ship a 12x Bug(25.09.2026 um 04:39 Uhr)
•
Sichere ProgrammierungA No-Repeat Random Draw Looks Trivial Until Round 70(25.09.2026 um 04:40 Uhr)
•
Intelligence View
⚡ tsecurity.de Intelligence

How I Built Real-Time Dashboards for Claude Code Metrics with OTEL, Prometheus, and Grafana

I wanted to know exactly what I was getting out of Claude Code. Not vibes. Numbers. So I built some Grafana dashboards that track everything: tokens, cost, lines of code, productivity ratios, ROI. Here's how to set it up yourself. …

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

I wanted to know exactly what I was getting out of Claude Code. Not vibes. Numbers.



So I built some Grafana dashboards that track everything: tokens, cost, lines of code, productivity ratios, ROI. Here's how to set it up yourself.






The Stack





  • Claude Code with native OTEL telemetry (yes, it has this built in)


  • Prometheus as the metrics backend


  • Grafana for visualization






Step 1: Enable OTEL Export from Claude Code



Add these to your shell profile (~/.zshrc or ~/.bashrc):




export CLAUDE_CODE_ENABLE_TELEMETRY=1
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:9090/api/v1/otlp






Restart your terminal or source the file.






Step 2: Configure Prometheus



Prometheus needs two flags to accept OTLP metrics:




prometheus \
--config.file=prometheus.yml \
--web.enable-otlp-receiver \
--enable-feature=otlp-deltatocumulative






If you're using Homebrew on macOS, you might need to edit the service plist or create a wrapper script.



The otlp-deltatocumulative flag is important. Some Claude Code metrics (like lines of code) are delta metrics, not cumulative. This flag handles the conversion automatically.






Step 3: Verify Metrics Are Flowing



Once you've used Claude Code with the new env vars, check that Prometheus is receiving data:




curl 'http://localhost:9090/api/v1/label/__name__/values' | jq '.data[]' | grep claude






You should see metrics like:




  • claude_code_token_usage_tokens_total

  • claude_code_cost_usage_USD_total

  • claude_code_active_time_seconds_total

  • claude_code_lines_of_code_count_total

  • claude_code_session_count_total






The Metrics Claude Code Exports

































Metric Labels What It Tracks
claude_code_token_usage_tokens_total
type (input/output/cacheRead/cacheCreation), model
Token consumption
claude_code_cost_usage_USD_total model Estimated API cost
claude_code_active_time_seconds_total
type (cli/user)
Time tracking
claude_code_lines_of_code_count_total
type (added/removed)
Code output (delta metric)


The active_time metric is interesting. cli is how long Claude was working. user is how long you were interacting. The ratio between them is your productivity multiplier.






Step 4: Import the Dashboards



I've created three dashboards:





  1. Claude Code Metrics - Token stats, cost breakdown, productivity ratio


  2. Daily/Weekly Summary - Aggregated stats with time-range awareness


  3. Engineering Economics - ROI calculations, team equivalence, business metrics



The dashboards use Grafana variables so you can customize:




  • Your hourly rate (for ROI calculations)

  • Average developer lines/hour (for team equivalence)






Key Queries



Productivity Ratio (CLI time / User time):




sum(claude_code_active_time_seconds_total{type="cli"}) 
/ sum(claude_code_active_time_seconds_total{type="user"})






Lines per Dollar:




sum(sum_over_time(claude_code_lines_of_code_count_total[$__range])) 
/ sum(increase(claude_code_cost_usage_USD_total[$__range]))






Equivalent Developer Hours (assuming 75 lines/hour):




sum(sum_over_time(claude_code_lines_of_code_count_total[$__range])) / 75






Max Plan ROI (for $200/month subscribers):




sum(increase(claude_code_cost_usage_USD_total[$__range])) 
/ (6.67 * ($__range_s / 86400))









A Note on Lines of Code



The lines_of_code metric is a delta metric, not cumulative. This means you need sum_over_time() instead of increase():




# Wrong - will give weird extrapolated values
sum(increase(claude_code_lines_of_code_count_total[$__range]))

# Correct
sum(sum_over_time(claude_code_lines_of_code_count_total[$__range]))









Results



Here's what one hour looked like for me:




  • 27,000 lines of code

  • 11 minutes of my time

  • 362x velocity multiplier

  • $47K equivalent output value



The productivity ratio peaked at over 10,000x when I had multiple parallel agents running.






Dashboard JSON



I'll put the dashboard JSON files in a GitHub gist. You can import them directly into Grafana via Dashboards → Import.



[Link to gist coming]






What About Datadog/Other Backends?



The OTEL export should work with any OTLP-compatible backend. Just change the endpoint:




export OTEL_EXPORTER_OTLP_ENDPOINT=https://your-backend-endpoint






For Datadog, you'd point to their OTLP intake endpoint. Same metrics, different destination.






What's Next



I'm planning to add:




  • Alerts when productivity ratio drops (maybe I'm stuck?)

  • Cost projections based on current burn rate

  • Comparison panels for different projects



If you build on this, let me know what you come up with.

1. Sofort-Triage & Abwehrmaßnahmen

SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - How I Built Real-Time Dashboards for Claude Code Metrics with OTEL, Prometheus, and Grafana
id: 69f682fa-bbe2-4135-b7db-78f4895ecfbe
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-25
logsource:
  category: network_connection
  product: any
detection:
  selection:
      CommandLine|contains:
        - 'exploit'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-25"
        description = "YARA Signature for "
    strings:
        $str = "How I Built Real-Time Dashboar" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
("How I Built Real-Time Dashboards for Cla")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
message: "*How I Built Real-Time Dashboards for Cla*"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where Message has "How I Built Real-Time Dashboards for Cla"
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc

2. Cyber Threat Intelligence & Forensik

🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich How I Built Real-Time Dashboards for Cla.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How I Built Real-Time Dashboards for Claude Code Metrics with OTEL, Prometheus, and Grafana

Thematisch verwandte Begriffe: Built, RealTime, Dashboards, Claude · 6 Treffer

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-87722 | Uncontrolled Resource Consumption (CWE-400 / CWE-1333) in regex search q…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel • Rechts: nächster Artikel • unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle