{
  "dashboard": {
    "title": "RBAC Performance Metrics",
    "panels": [
      {
        "title": "Role Resolution Latency",
        "type": "graph",
        "targets": [
          {
            "expr": "histogram_quantile(0.95, sum(rate(rbac_role_resolution_latency_seconds_bucket[1m])) by (le)",
            "legendFormat": "P95 - {{instance}}"
          }
        ],
        "yaxes": [
          {
            "format": "s",
            "label": "Latency (seconds)"
          }
        ]
      },
      {
        "title": "Permission Check Throughput",
        "type": "graph", 
        "targets": [
          {
            "expr": "sum(rate(rbac_permission_checks_total[1m])) by (instance)",
            "legendFormat": "{{instance}}"
          }
        ],
        "yaxes": [
          {
            "format": "ops",
            "label": "Operations/second"
          }
        ]
      },
      {
        "title": "Memory Usage",
        "type": "graph",
        "targets": [
          {
            "expr": "process_resident_memory_bytes{job=\"rbac-engine\"}",
            "legendFormat": "{{instance}}"
          }
        ],
        "yaxes": [
          {
            "format": "bytes",
            "label": "Memory Usage"
          }
        ]
      }
    ],
    "templating": {
      "list": [
        {
          "name": "instance",
          "query": "label_values(rbac_role_resolution_latency_seconds_count, instance)"
        }
      ]
    }
  }
}