{
    "annotations": {
        "list": [
            {
                "builtIn": 1,
                "datasource": {
                    "type": "grafana",
                    "uid": "-- Grafana --"
                },
                "enable": true,
                "hide": true,
                "iconColor": "rgba(0, 211, 255, 1)",
                "name": "Annotations & Alerts",
                "target": {
                    "limit": 100,
                    "matchAny": false,
                    "tags": [],
                    "type": "dashboard"
                },
                "type": "dashboard"
            }
        ]
    },
    "description": "Pool details dashboard for pgagroal connection pooler. Shows authentication metrics, connection limits, and per-database/user statistics.",
    "editable": true,
    "fiscalYearStartMonth": 0,
    "graphTooltip": 1,
    "id": null,
    "links": [
        {
            "asDropdown": true,
            "icon": "dashboard",
            "includeVars": true,
            "keepTime": true,
            "tags": [
                "pgagroal"
            ],
            "targetBlank": false,
            "title": "pgagroal Dashboards",
            "type": "dashboards"
        }
    ],
    "liveNow": false,
    "panels": [
        {
            "collapsed": false,
            "gridPos": {
                "h": 1,
                "w": 24,
                "x": 0,
                "y": 0
            },
            "id": 100,
            "panels": [],
            "title": "Authentication",
            "type": "row"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "mappings": [],
                    "noValue": "0",
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            }
                        ]
                    },
                    "unit": "short"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 5,
                "w": 6,
                "x": 0,
                "y": 1
            },
            "id": 1,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "pluginVersion": "10.0.0",
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "pgagroal_auth_user_success",
                    "instant": true,
                    "refId": "A"
                }
            ],
            "title": "Auth Success",
            "type": "stat",
            "description": "Successful authentication attempts."
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "description": "Failed authentications due to bad password",
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "mappings": [],
                    "noValue": "0",
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "yellow",
                                "value": 1
                            },
                            {
                                "color": "red",
                                "value": 10
                            }
                        ]
                    },
                    "unit": "short"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 5,
                "w": 6,
                "x": 6,
                "y": 1
            },
            "id": 2,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "pluginVersion": "10.0.0",
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "pgagroal_auth_user_bad_password",
                    "instant": true,
                    "refId": "A"
                }
            ],
            "title": "Auth Bad Password",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "description": "Authentication errors",
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "mappings": [],
                    "noValue": "0",
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "red",
                                "value": 1
                            }
                        ]
                    },
                    "unit": "short"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 5,
                "w": 6,
                "x": 12,
                "y": 1
            },
            "id": 3,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "pluginVersion": "10.0.0",
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "pgagroal_auth_user_error",
                    "instant": true,
                    "refId": "A"
                }
            ],
            "title": "Auth Errors",
            "type": "stat"
        },
        {
            "datasource": {
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "unit": "short",
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "yellow",
                                "value": 0.2
                            },
                            {
                                "color": "red",
                                "value": 0.5
                            }
                        ]
                    }
                }
            },
            "gridPos": {
                "h": 5,
                "w": 6,
                "x": 18,
                "y": 1
            },
            "id": 6,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "reduceOptions": {
                    "calcs": [
                        "mean"
                    ],
                    "values": false
                }
            },
            "targets": [
                {
                    "expr": "increase(pgagroal_connection_get{instance=~\"$instance\"}[10m]) - increase(pgagroal_connection_return{instance=~\"$instance\"}[10m])",
                    "legendFormat": "Connection Leak",
                    "refId": "A"
                }
            ],
            "title": "Connection Leak Risk",
            "type": "stat",
            "description": "Ratio of connections not returned to the pool over time. Values > 0 indicate possible leaks."
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "drawStyle": "line",
                        "fillOpacity": 20,
                        "gradientMode": "opacity",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "lineInterpolation": "smooth",
                        "lineWidth": 2,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            }
                        ]
                    },
                    "unit": "short"
                },
                "overrides": [
                    {
                        "matcher": {
                            "id": "byName",
                            "options": "Success"
                        },
                        "properties": [
                            {
                                "id": "color",
                                "value": {
                                    "fixedColor": "green",
                                    "mode": "fixed"
                                }
                            }
                        ]
                    },
                    {
                        "matcher": {
                            "id": "byName",
                            "options": "Bad Password"
                        },
                        "properties": [
                            {
                                "id": "color",
                                "value": {
                                    "fixedColor": "yellow",
                                    "mode": "fixed"
                                }
                            }
                        ]
                    },
                    {
                        "matcher": {
                            "id": "byName",
                            "options": "Error"
                        },
                        "properties": [
                            {
                                "id": "color",
                                "value": {
                                    "fixedColor": "red",
                                    "mode": "fixed"
                                }
                            }
                        ]
                    }
                ]
            },
            "gridPos": {
                "h": 8,
                "w": 18,
                "x": 0,
                "y": 6
            },
            "id": 4,
            "options": {
                "legend": {
                    "calcs": [
                        "sum"
                    ],
                    "displayMode": "table",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "multi",
                    "sort": "desc"
                }
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "pgagroal_auth_user_success",
                    "legendFormat": "Success",
                    "refId": "A"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "pgagroal_auth_user_bad_password",
                    "legendFormat": "Bad Password",
                    "refId": "B"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "pgagroal_auth_user_error",
                    "legendFormat": "Error",
                    "refId": "C"
                }
            ],
            "title": "Authentication Over Time",
            "type": "timeseries",
            "description": "Trend of successful vs failed authentications."
        },
        {
            "datasource": {
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "unit": "percentunit",
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "yellow",
                                "value": 0.01
                            },
                            {
                                "color": "red",
                                "value": 0.05
                            }
                        ]
                    },
                    "noValue": 0
                }
            },
            "gridPos": {
                "h": 5,
                "w": 6,
                "x": 18,
                "y": 6
            },
            "id": 5,
            "options": {
                "reduceOptions": {
                    "calcs": [
                        "max"
                    ],
                    "values": false
                },
                "showThresholdLabels": false,
                "showThresholdMarkers": true,
                "orientation": "auto"
            },
            "targets": [
                {
                    "expr": "(rate(pgagroal_auth_user_bad_password{instance=~\"$instance\"}[5m]) + rate(pgagroal_auth_user_error{instance=~\"$instance\"}[5m])) / ((rate(pgagroal_auth_user_success{instance=~\"$instance\"}[5m]) + rate(pgagroal_auth_user_bad_password{instance=~\"$instance\"}[5m]) + rate(pgagroal_auth_user_error{instance=~\"$instance\"}[5m])) > 0)",
                    "legendFormat": "Auth Failure Rate",
                    "refId": "A"
                }
            ],
            "title": "Auth Failure Rate",
            "type": "gauge",
            "description": "Percentage of authentication attempts failing."
        },
        {
            "collapsed": false,
            "gridPos": {
                "h": 1,
                "w": 24,
                "x": 0,
                "y": 14
            },
            "id": 101,
            "panels": [],
            "title": "Connection Events",
            "type": "row"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 6,
                "x": 0,
                "y": 15
            },
            "id": 201,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_get{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Gets",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 6,
                "x": 6,
                "y": 15
            },
            "id": 202,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_success{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Success",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 6,
                "x": 12,
                "y": 15
            },
            "id": 203,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_kill{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Kills",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 6,
                "x": 18,
                "y": 15
            },
            "id": 204,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_error{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Errors",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "drawStyle": "line",
                        "fillOpacity": 10,
                        "gradientMode": "none",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "lineInterpolation": "smooth",
                        "lineWidth": 2,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            }
                        ]
                    },
                    "unit": "ops"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 9,
                "w": 12,
                "x": 0,
                "y": 18
            },
            "id": 10,
            "options": {
                "legend": {
                    "calcs": [
                        "mean",
                        "max"
                    ],
                    "displayMode": "table",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "multi",
                    "sort": "desc"
                }
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_get{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Get",
                    "refId": "A"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_return{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Return",
                    "refId": "B"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_success{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Success",
                    "refId": "C"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_flush{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Flush",
                    "refId": "D"
                }
            ],
            "title": "Connection Lifecycle",
            "type": "timeseries",
            "description": "New connections acquired vs returned to pool."
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "drawStyle": "line",
                        "fillOpacity": 10,
                        "gradientMode": "none",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "lineInterpolation": "smooth",
                        "lineWidth": 2,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            }
                        ]
                    },
                    "unit": "ops"
                },
                "overrides": [
                    {
                        "matcher": {
                            "id": "byName",
                            "options": "Error"
                        },
                        "properties": [
                            {
                                "id": "color",
                                "value": {
                                    "fixedColor": "red",
                                    "mode": "fixed"
                                }
                            }
                        ]
                    },
                    {
                        "matcher": {
                            "id": "byName",
                            "options": "Kill"
                        },
                        "properties": [
                            {
                                "id": "color",
                                "value": {
                                    "fixedColor": "dark-red",
                                    "mode": "fixed"
                                }
                            }
                        ]
                    }
                ]
            },
            "gridPos": {
                "h": 9,
                "w": 12,
                "x": 12,
                "y": 18
            },
            "id": 11,
            "options": {
                "legend": {
                    "calcs": [
                        "mean",
                        "max"
                    ],
                    "displayMode": "table",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "multi",
                    "sort": "desc"
                }
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_error{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Error",
                    "refId": "A"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_kill{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Kill",
                    "refId": "B"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_remove{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Remove",
                    "refId": "C"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_invalid{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Invalid",
                    "refId": "D"
                }
            ],
            "title": "Connection Issues",
            "type": "timeseries",
            "description": "Errors related to connection establishment or liveness."
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 4,
                "x": 0,
                "y": 27
            },
            "id": 205,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_timeout{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Timeouts",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 4,
                "x": 4,
                "y": 27
            },
            "id": 206,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_idletimeout{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Idle Timeouts",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 4,
                "x": 8,
                "y": 27
            },
            "id": 207,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection_max_connection_age{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Max Age Evicts",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "drawStyle": "line",
                        "fillOpacity": 10,
                        "gradientMode": "none",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "lineInterpolation": "smooth",
                        "lineWidth": 2,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "yellow",
                                "value": 0.01
                            },
                            {
                                "color": "red",
                                "value": 0.1
                            }
                        ]
                    },
                    "unit": "ops"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 9,
                "w": 12,
                "x": 0,
                "y": 30
            },
            "id": 12,
            "options": {
                "legend": {
                    "calcs": [
                        "mean",
                        "max"
                    ],
                    "displayMode": "table",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "multi",
                    "sort": "desc"
                }
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_timeout{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Timeout",
                    "refId": "A"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_idletimeout{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Idle Timeout",
                    "refId": "B"
                },
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_connection_max_connection_age{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "Max Age",
                    "refId": "C"
                }
            ],
            "title": "Connection Timeouts",
            "type": "timeseries",
            "description": "Occurrences of idle or process timeouts."
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "description": "Connections per database",
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "drawStyle": "line",
                        "fillOpacity": 20,
                        "gradientMode": "opacity",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "lineInterpolation": "smooth",
                        "lineWidth": 2,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "decimals": 0,
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            }
                        ]
                    },
                    "unit": "short"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 8,
                "w": 12,
                "x": 12,
                "y": 27
            },
            "id": 13,
            "options": {
                "legend": {
                    "calcs": [
                        "lastNotNull",
                        "max"
                    ],
                    "displayMode": "table",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "multi",
                    "sort": "desc"
                }
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_connection) by (database) > 0",
                    "legendFormat": "{{database}}",
                    "refId": "A"
                }
            ],
            "title": "Connections by Database",
            "type": "timeseries"
        },
        {
            "collapsed": false,
            "gridPos": {
                "h": 1,
                "w": 24,
                "x": 0,
                "y": 32
            },
            "id": 102,
            "panels": [],
            "title": "Server Errors",
            "type": "row"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "thresholds"
                    },
                    "unit": "short"
                }
            },
            "gridPos": {
                "h": 3,
                "w": 4,
                "x": 0,
                "y": 33
            },
            "id": 208,
            "options": {
                "colorMode": "value",
                "graphMode": "area",
                "justifyMode": "auto",
                "orientation": "auto",
                "reduceOptions": {
                    "calcs": [
                        "lastNotNull"
                    ],
                    "fields": "",
                    "values": false
                },
                "textMode": "value"
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "sum(pgagroal_server_error{instance=~\"$instance\"})",
                    "refId": "A"
                }
            ],
            "title": "Total Server Errors",
            "type": "stat"
        },
        {
            "datasource": {
                "type": "prometheus",
                "uid": "${DS_PROMETHEUS}"
            },
            "description": "Errors per server",
            "fieldConfig": {
                "defaults": {
                    "color": {
                        "mode": "palette-classic"
                    },
                    "custom": {
                        "axisCenteredZero": false,
                        "axisColorMode": "text",
                        "axisLabel": "",
                        "axisPlacement": "auto",
                        "barAlignment": 0,
                        "drawStyle": "line",
                        "fillOpacity": 10,
                        "gradientMode": "none",
                        "hideFrom": {
                            "legend": false,
                            "tooltip": false,
                            "viz": false
                        },
                        "lineInterpolation": "smooth",
                        "lineWidth": 2,
                        "pointSize": 5,
                        "scaleDistribution": {
                            "type": "linear"
                        },
                        "showPoints": "auto",
                        "spanNulls": false,
                        "stacking": {
                            "group": "A",
                            "mode": "none"
                        },
                        "thresholdsStyle": {
                            "mode": "off"
                        }
                    },
                    "mappings": [],
                    "thresholds": {
                        "mode": "absolute",
                        "steps": [
                            {
                                "color": "green",
                                "value": null
                            },
                            {
                                "color": "red",
                                "value": 1
                            }
                        ]
                    },
                    "unit": "ops"
                },
                "overrides": []
            },
            "gridPos": {
                "h": 8,
                "w": 24,
                "x": 0,
                "y": 36
            },
            "id": 20,
            "options": {
                "legend": {
                    "calcs": [
                        "sum"
                    ],
                    "displayMode": "table",
                    "placement": "bottom",
                    "showLegend": true
                },
                "tooltip": {
                    "mode": "multi",
                    "sort": "desc"
                }
            },
            "targets": [
                {
                    "datasource": {
                        "type": "prometheus",
                        "uid": "${DS_PROMETHEUS}"
                    },
                    "expr": "rate(pgagroal_server_error{instance=~\"$instance\"}[$rate_interval])",
                    "legendFormat": "{{name}}",
                    "refId": "A"
                }
            ],
            "title": "Server Errors",
            "type": "timeseries"
        }
    ],
    "refresh": "30s",
    "schemaVersion": 39,
    "style": "dark",
    "tags": [
        "pgagroal",
        "pool"
    ],
    "templating": {
        "list": [
            {
                "name": "DS_PROMETHEUS",
                "type": "datasource",
                "label": "Prometheus",
                "query": "prometheus",
                "current": {},
                "hide": 0
            },
            {
                "name": "instance",
                "type": "query",
                "label": "Instance",
                "query": "label_values(pgagroal_state, instance)",
                "datasource": {
                    "type": "prometheus",
                    "uid": "${DS_PROMETHEUS}"
                },
                "multi": true,
                "includeAll": true,
                "allValue": ".*",
                "refresh": 1,
                "sort": 1,
                "current": {},
                "hide": 0
            },
            {
                "name": "rate_interval",
                "type": "interval",
                "label": "Rate Interval",
                "auto": true,
                "auto_count": 30,
                "auto_min": "1m",
                "query": "1m,5m,10m,15m,30m",
                "current": {
                    "text": "5m",
                    "value": "5m"
                },
                "hide": 0
            }
        ]
    },
    "time": {
        "from": "now-6h",
        "to": "now"
    },
    "timepicker": {
        "refresh_intervals": [
            "10s",
            "30s",
            "1m",
            "5m",
            "15m"
        ]
    },
    "timezone": "browser",
    "title": "pgagroal Pool Details",
    "uid": "pgagroal-pool-details",
    "version": 1,
    "weekStart": ""
}