Skip to content

Commit 1d0939c

Browse files
committed
feat: add Grafana dashboard JSON (#10)
1 parent f000257 commit 1d0939c

File tree

2 files changed

+1124
-0
lines changed

2 files changed

+1124
-0
lines changed

README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,36 @@ The logger supports the following event types:
9898
- `EventLoadPolicy` - Policy loading operations
9999
- `EventSavePolicy` - Policy saving operations
100100

101+
## Grafana Dashboard
102+
103+
A pre-built Grafana dashboard is available for visualizing Casbin metrics. You can import the dashboard JSON file from [grafana-dashboard.json](grafana-dashboard.json).
104+
105+
### Dashboard Panels
106+
107+
The dashboard includes the following panels organized into two sections:
108+
109+
#### Enforce Metrics
110+
- **Total Enforce Rate** - Overall rate of enforce requests per second
111+
- **Enforce Rate Detail (History)** - Historical view broken down by allowed/denied status and domain
112+
- **Enforce Duration (Latency Distribution)** - Histogram showing p50, p90, p95, and p99 latencies
113+
- **Enforce Duration by Status and Domain** - Average duration broken down by status and domain
114+
115+
#### Policy Metrics
116+
- **Policy Operation Rate** - Current rate of policy operations (Add/Save/Load/Remove)
117+
- **Policy Operations (Success/Failure)** - Pie chart showing success vs failure distribution
118+
- **Policy Operation Rate History** - Historical view of policy operations activity
119+
- **Policy Rules Affected History** - Trend of the number of policy rules affected over time
120+
- **Policy Operation Duration (Latency Distribution)** - Histogram showing p50, p90, and p99 latencies for policy operations
121+
- **Policy Operation Average Duration** - Average duration by operation type
122+
123+
### How to Import
124+
125+
1. Open your Grafana instance
126+
2. Go to **Dashboards****Import**
127+
3. Upload the `grafana-dashboard.json` file or paste its contents
128+
4. Select your Prometheus datasource
129+
5. Click **Import**
130+
101131
## Example
102132

103133
See the [examples/basic](examples/basic/main.go) directory for a complete working example.

0 commit comments

Comments
 (0)