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 RatePanel 2: Operations Rate (Time Series)
OAuth Operations per MinutePanel 3: Active Resources (Time Series)
Active Tokens & PKCE StatesPanel 4: Error Rate (Time Series)
OAuth Errors per MinuteOAuth Performance Dashboard
Panel 1: Latency Percentiles (Time Series)
OAuth Flow 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 MethodPanel 4: Client Registration Performance
Registration Duration p95OAuth Security Dashboard
Panel 1: Security Events Timeline (Logs)
Critical/High Security EventsPanel 2: Security Event Counters (Stat Row)
Token Reuse Detected (24h)Panel 3: Attack Heatmap (Heatmap)
Security Events by HourPanel 4: Top Attackers (Table from Logs)
Users with Most Security EventsPanel 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 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
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
Dashboard shows 'No Data'
Dashboard shows 'No Data'
- Verify data sources configured correctly (Prometheus, Loki)
- Check metrics endpoint:
curl http://localhost:12005/metrics - Ensure OAuth operations are generating events
- Verify time range includes recent data
Queries are slow
Queries are slow
- Add recording rules for expensive queries
- Reduce time range for log queries
- Use indexed labels in Loki queries
- Consider query caching in Grafana
Variables not populating
Variables not populating
- Check data source selection in variable
- Verify label exists in metrics/logs
- Test query in Explore view first
- Check for syntax errors in query
Alerts not firing
Alerts not firing
- Verify alert rule expression is correct
- Check evaluation interval (should match panel refresh)
- Test query returns data in expected range
- 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)
Priority 2: Recommended Panels
- ⭐ 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

