Overview
Permission Mongo includes a pre-built Grafana dashboard that provides comprehensive visibility into system performance and health. The dashboard is automatically provisioned when using the Docker Compose monitoring stack.Accessing Grafana
Open Grafana
Navigate to http://localhost:3000
Dashboard Structure
The pre-built dashboard is organized into five main sections:Overview Row
High-level system health metrics at a glance:Request Rate
Current requests per second
Error Rate
Percentage of 5xx errors (color-coded: green < 1%, yellow < 5%, red ≥ 5%)
P95 Latency
95th percentile request latency (green < 100ms, yellow < 500ms, red ≥ 500ms)
Active Requests
Currently in-flight requests
Goroutines
Active goroutine count (warning at 5k, critical at 10k)
Service Status
UP/DOWN indicator
HTTP Metrics Row
Detailed HTTP request analysis:Request Rate by Method
Type: Time seriesQuery:
sum by (method) (rate(http_requests_total[1m]))
Shows request throughput broken down by HTTP method (GET, POST, PUT, DELETE, PATCH).
Request Rate by Status Code
Type: Time seriesQuery:
sum by (status) (rate(http_requests_total[1m]))
Visualizes requests by status code with color coding:
- 2xx: Blue (success)
- 4xx: Yellow (client errors)
- 5xx: Red (server errors)
Request Latency Percentiles
Type: Time seriesQueries:
Request Rate by Endpoint
Type: Time seriesQuery:
sum by (path) (rate(http_requests_total[1m]))
Shows which endpoints are receiving the most traffic.
MongoDB Metrics Row
Database operation insights:MongoDB Operations by Type
Type: Time seriesQuery:
sum by (operation) (rate(mongodb_operations_total[1m]))
Breaks down database operations into:
find- Read queriesinsert- Insertsupdate- Updatesdelete- Deletions
MongoDB Operation Latency (P95)
Type: Time seriesQuery:
Cache Metrics Row
Cache performance and hit rate analysis:Cache Hit Rate
Type: GaugeQuery:
- Red: < 50% (poor)
- Yellow: 50-80% (fair)
- Green: > 80% (good)
Cache Hits vs Misses
Type: Time seriesQueries:
- Hits: Green
- Misses: Red
RBAC & Audit Row
Security and audit trail monitoring:RBAC Evaluations
Type: Time seriesQuery:
sum by (result) (rate(rbac_evaluations_total[1m]))
Shows authorization decisions:
- Allowed: Green
- Denied: Red
Audit Log Metrics
Type: Time seriesQueries:
Manual Dashboard Setup
If running Grafana separately from the Docker Compose stack:Add Prometheus datasource
- Navigate to Configuration → Data Sources
- Click Add data source
- Select Prometheus
- Configure URL:
http://localhost:9090(orhttp://host.docker.internal:9090from Docker) - Click Save & Test
Dashboard Location
The dashboard JSON is located at:Auto-Provisioning Configuration
Dashboards are automatically provisioned via:monitoring/grafana/provisioning/dashboards/default.yml
monitoring/grafana/provisioning/datasources/prometheus.yml
Creating Custom Panels
To add custom visualizations:Customize visualization
Choose panel type (time series, gauge, stat, etc.) and configure display options
Useful Custom Panels
Request Success Rate
Thresholds: < 0.95 (red), < 0.99 (yellow), ≥ 0.99 (green)
MongoDB Connection Pool Usage
Top 5 Slowest Endpoints (P95)
Cache Efficiency by Type
RBAC Deny Rate
Dashboard Refresh Rate
The default refresh rate is 5 seconds. You can change this in the dashboard settings:- Click the clock icon in the top right
- Select a different refresh interval (5s, 10s, 30s, 1m, etc.)
Time Range Selection
Default time range: Last 1 hour Use the time picker in the top right to adjust:- Last 5 minutes
- Last 15 minutes
- Last 1 hour
- Last 6 hours
- Last 24 hours
- Custom range
Annotations
The dashboard supports Grafana annotations for marking deployments, incidents, or other events:- Click on the graph where you want to add an annotation
- Enter description and tags
- Save annotation
Variables and Templating
The current dashboard does not use variables, but you can add them for dynamic filtering:Example: Add Instance Variable
Example: Add Instance Variable
- Dashboard settings → Variables → Add variable
- Name:
instance - Type: Query
- Data source: Prometheus
- Query:
label_values(up{job="permission-mongo"}, instance) - Update all panel queries to use
{instance="$instance"}
Exporting Dashboards
To export your customized dashboard:- Click the share icon in the top right
- Select Export
- Toggle Export for sharing externally
- Click Save to file