Skip to main content

Grafana Dashboards for OAuth Monitoring

Build comprehensive Grafana dashboards combining Prometheus metrics and Loki logs for real-time OAuth 2.1 monitoring.

Dashboard Overview

Recommended dashboard structure:

High-level health metrics, SLO tracking, and alert status

OAuth Performance

Latency percentiles, throughput, and resource utilization

OAuth Security

Security events, attack detection, and compliance monitoring

OAuth Debugging

Detailed logs, traces, and error analysis

OAuth Overview Dashboard

Panel 1: SLO Summary (Row)

OAuth Flow Success Rate
Token Refresh Success Rate
PKCE Validation Success Rate
Critical Security Events (Last 24h)

Panel 2: Operations Rate (Time Series)

OAuth Operations per Minute

Panel 3: Active Resources (Time Series)

Active Tokens & PKCE States

Panel 4: Error Rate (Time Series)

OAuth Errors per Minute

OAuth Performance Dashboard

Panel 1: Latency Percentiles (Time Series)

OAuth Flow Duration (p50, p95, p99)
Token Refresh Duration (p50, p95, p99)

Panel 2: Throughput by Provider (Bar Gauge)

OAuth Flows by Provider (Last Hour)

Panel 3: Discovery Performance (Stat + Time Series)

Average Discovery Time by Method

Panel 4: Client Registration Performance

Registration Duration p95

OAuth Security Dashboard

Panel 1: Security Events Timeline (Logs)

Critical/High Security Events

Panel 2: Security Event Counters (Stat Row)

Token Reuse Detected (24h)
Code Injection Attempts (24h)
Integrity Violations (24h)
Ownership Violations (24h)

Panel 3: Attack Heatmap (Heatmap)

Security Events by Hour

Panel 4: Top Attackers (Table from Logs)

Users with Most Security Events

Panel 5: PKCE Replay Attempts (Time Series)

PKCE States in Audit Table (Prevented Replays)

OAuth Debugging Dashboard

Panel 1: Error Logs (Logs Panel)

OAuth Errors (Last 6 Hours)

Panel 2: Error Distribution (Pie Chart)

OAuth Errors by Type (Last 24h)

Panel 3: Token Refresh Failures by Reason (Bar Chart)

Refresh Failures by Reason (Last Hour)

Panel 4: OAuth Flow Trace (Logs with Trace)

Complete Flow by Trace ID Variables:
Panel Query:

Panel 5: Slow Operations (Table)

Operations Exceeding SLO (Last Hour)

Dashboard Variables

Global Variables

OAuth-Specific Variables

Alert Annotations

Add alert annotations to show when alerts fire:

Dashboard JSON Export

Complete OAuth Overview Dashboard

Import this dashboard JSON into Grafana for instant setup

Best Practices

Use Template Variables

Add provider, server, and user filters for flexible debugging

Set Appropriate Refresh Rates

Overview: 30s, Performance: 15s, Security: 10s, Debugging: 5s

Configure Alerts

Critical alerts: Immediate notification (PagerDuty, Slack) Warning alerts: Email or dashboard only

Use Annotations

Mark deployments, incidents, and configuration changes

Optimize Query Performance

Use recording rules for complex queries Limit time ranges for expensive log queries

Troubleshooting

  1. Verify data sources configured correctly (Prometheus, Loki)
  2. Check metrics endpoint: curl http://localhost:12005/metrics
  3. Ensure OAuth operations are generating events
  4. Verify time range includes recent data
  1. Add recording rules for expensive queries
  2. Reduce time range for log queries
  3. Use indexed labels in Loki queries
  4. Consider query caching in Grafana
  1. Check data source selection in variable
  2. Verify label exists in metrics/logs
  3. Test query in Explore view first
  4. Check for syntax errors in query
  1. Verify alert rule expression is correct
  2. Check evaluation interval (should match panel refresh)
  3. Test query returns data in expected range
  4. Verify notification channels configured

Dashboard Recommendations

Priority 1: Must-Have Panels

  • ✅ OAuth Flow Success Rate (SLO)
  • ✅ Token Refresh Success Rate (SLO)
  • ✅ Critical Security Events (Last 24h)
  • ✅ Operations Rate (flows, refreshes, PKCE)
  • ✅ p95 Latency (flows, refreshes)
  • ⭐ Error Rate Trends
  • ⭐ Active Tokens/States Gauge
  • ⭐ Security Events Timeline
  • ⭐ Top Providers by Volume
  • ⭐ Slow Operations Table

Priority 3: Advanced Panels

  • 🔧 Trace Correlation
  • 🔧 Attack Heatmap
  • 🔧 Error Distribution Pie
  • 🔧 User Activity Analysis
  • 🔧 Discovery Method Breakdown

Pre-built Dashboard Downloads

OAuth Overview Dashboard

Production-ready overview with all critical metrics

OAuth Security Dashboard

Security monitoring and incident response

OAuth Performance Dashboard

Latency analysis and capacity planning

Next Steps

Set Up Alerts

Configure Grafana alerts for critical events

Customize Dashboards

Adapt panels to your specific needs

Share Dashboards

Export and version control dashboard JSON

Monitor SLOs

Track OAuth SLOs and error budgets