{
  "uid": "keen-pbr",
  "title": "keen-pbr",
  "tags": [
    "keen-pbr"
  ],
  "timezone": "browser",
  "editable": true,
  "graphTooltip": 1,
  "schemaVersion": 42,
  "version": 1,
  "refresh": "30s",
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "timepicker": {},
  "annotations": {
    "list": [
      {
        "builtIn": 1,
        "datasource": {
          "type": "grafana",
          "uid": "-- Grafana --"
        },
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }
    ]
  },
  "templating": {
    "list": [
      {
        "name": "job",
        "label": "Job",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "prometheus"
        },
        "query": {
          "query": "label_values(keen_pbr_build_info, job)",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "definition": "label_values(keen_pbr_build_info, job)",
        "refresh": 2,
        "sort": 1,
        "multi": false,
        "includeAll": false,
        "current": {
          "selected": false,
          "text": "",
          "value": ""
        },
        "options": [],
        "hide": 0
      },
      {
        "name": "outbound",
        "label": "Outbound",
        "type": "query",
        "datasource": {
          "type": "prometheus",
          "uid": "prometheus"
        },
        "query": {
          "query": "label_values(keen_pbr_probe_up{job=~\"$job\"}, outbound)",
          "refId": "PrometheusVariableQueryEditor-VariableQuery"
        },
        "definition": "label_values(keen_pbr_probe_up{job=~\"$job\"}, outbound)",
        "refresh": 2,
        "sort": 1,
        "multi": true,
        "includeAll": true,
        "current": {
          "selected": true,
          "text": "All",
          "value": "$__all"
        },
        "options": [],
        "hide": 0,
        "allValue": ".*"
      }
    ]
  },
  "links": [],
  "panels": [
    {
      "id": 1,
      "type": "row",
      "title": "Status",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 0,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 2,
      "type": "stat",
      "title": "Scrape",
      "description": "Whether Prometheus can scrape keen-pbr.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 1,
        "w": 3,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "min(up{job=~\"$job\"})",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "DOWN",
                  "color": "red",
                  "index": 0
                },
                "1": {
                  "text": "UP",
                  "color": "green",
                  "index": 1
                }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "background",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 3,
      "type": "stat",
      "title": "Version",
      "description": "Version, source commit and firewall backend from keen_pbr_build_info labels.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 3,
        "y": 1,
        "w": 5,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_build_info{job=~\"$job\"}",
          "legendFormat": "{{version}} ({{commit}}, {{firewall_backend}})",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "none",
        "textMode": "name",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 4,
      "type": "stat",
      "title": "Uptime",
      "description": "Time since the keen-pbr process started.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 8,
        "y": 1,
        "w": 3,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "time() - keen_pbr_process_start_time_seconds{job=~\"$job\"}",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "orange",
                "value": null
              },
              {
                "color": "green",
                "value": 300
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 5,
      "type": "stat",
      "title": "Active rules",
      "description": "Realized firewall rules.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 11,
        "y": 1,
        "w": 3,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_active_rules{job=~\"$job\"}",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 6,
      "type": "stat",
      "title": "Outbounds up",
      "description": "Outbounds whose last probe succeeded / outbounds with at least one completed probe.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 14,
        "y": 1,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum(keen_pbr_probe_up{job=~\"$job\"})",
          "legendFormat": "up",
          "refId": "A",
          "instant": true,
          "range": false
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "count(keen_pbr_probe_up{job=~\"$job\"})",
          "legendFormat": "total",
          "refId": "B",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "up"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "total"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "text"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "none",
        "textMode": "value_and_name",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 7,
      "type": "stat",
      "title": "Errors in range",
      "description": "All error counters summed over the selected time range.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 18,
        "y": 1,
        "w": 3,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum(increase(keen_pbr_errors_total{job=~\"$job\"}[$__range]))",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "noValue": "0"
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 8,
      "type": "stat",
      "title": "Config applied",
      "description": "Time since the runtime last finished applying a configuration (or started).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 21,
        "y": 1,
        "w": 3,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "time() - keen_pbr_config_reload_last_success_timestamp_seconds{job=~\"$job\"}",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 9,
      "type": "row",
      "title": "Outbounds",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 5,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 10,
      "type": "state-timeline",
      "title": "Outbound state",
      "description": "Result of the last probe per outbound. Gaps mean no probe has completed.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 6,
        "w": 24,
        "h": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_probe_up{job=~\"$job\",outbound=~\"$outbound\"}",
          "legendFormat": "{{outbound}} ({{test_outbound}})",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "DOWN",
                  "color": "red",
                  "index": 0
                },
                "1": {
                  "text": "UP",
                  "color": "green",
                  "index": 1
                }
              }
            }
          ],
          "custom": {
            "fillOpacity": 70,
            "lineWidth": 0,
            "spanNulls": false
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "mergeValues": true,
        "showValue": "auto",
        "alignValue": "center",
        "rowHeight": 0.8,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      }
    },
    {
      "id": 11,
      "type": "timeseries",
      "title": "Latency now",
      "description": "Latency of the last successful probe (ICMP: mean of replies). The line breaks when a probe fails.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 12,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_probe_latency_seconds{job=~\"$job\",outbound=~\"$outbound\"}",
          "legendFormat": "{{outbound}} ({{test_outbound}})",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 12,
      "type": "timeseries",
      "title": "ICMP jitter (min / max reply)",
      "description": "Fastest and slowest reply of the last successful ICMP probe.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 12,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_probe_latency_min_seconds{job=~\"$job\",outbound=~\"$outbound\"}",
          "legendFormat": "{{outbound}} min",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_probe_latency_max_seconds{job=~\"$job\",outbound=~\"$outbound\"}",
          "legendFormat": "{{outbound}} max",
          "refId": "B",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 13,
      "type": "table",
      "title": "Latency summary",
      "description": "Probe latency statistics over the selected time range (successful probes only).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 20,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "avg_over_time(keen_pbr_probe_latency_seconds{job=~\"$job\",outbound=~\"$outbound\"}[$__range])",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "quantile_over_time(0.95, keen_pbr_probe_latency_seconds{job=~\"$job\",outbound=~\"$outbound\"}[$__range])",
          "legendFormat": "",
          "refId": "B",
          "instant": true,
          "range": false,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "max_over_time(keen_pbr_probe_latency_seconds{job=~\"$job\",outbound=~\"$outbound\"}[$__range])",
          "legendFormat": "",
          "refId": "C",
          "instant": true,
          "range": false,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "avg|p95|max"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              },
              {
                "id": "decimals",
                "value": 4
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 0.1
                    },
                    {
                      "color": "red",
                      "value": 0.3
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "footer": {
          "show": false
        }
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "job": true,
              "instance": true,
              "__name__": true,
              "interface": false
            },
            "renameByName": {
              "Value #A": "avg",
              "Value #B": "p95",
              "Value #C": "max",
              "outbound": "Outbound",
              "test_outbound": "Test group",
              "interface": "Interface",
              "type": "Type"
            },
            "indexByName": {
              "outbound": 0,
              "test_outbound": 1,
              "interface": 2,
              "type": 3,
              "Value #A": 4,
              "Value #B": 5,
              "Value #C": 6
            }
          }
        }
      ]
    },
    {
      "id": 14,
      "type": "timeseries",
      "title": "ICMP packet loss",
      "description": "Share of ICMP echo requests without a reply over a 15 minute window. No data when no packets were sent.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 20,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "100 * clamp(1 - increase(keen_pbr_probe_packets_received_total{job=~\"$job\",outbound=~\"$outbound\"}[15m]) / (increase(keen_pbr_probe_packets_sent_total{job=~\"$job\",outbound=~\"$outbound\"}[15m]) > 0), 0, 1)",
          "legendFormat": "{{outbound}} ({{test_outbound}})",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 1
              },
              {
                "color": "red",
                "value": 5
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "axisSoftMax": 5,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "line"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 15,
      "type": "timeseries",
      "title": "Probe success rate (15m)",
      "description": "Successful probes divided by completed probes over a 15 minute window.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 28,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "100 * increase(keen_pbr_probe_successes_total{job=~\"$job\",outbound=~\"$outbound\"}[15m]) / (increase(keen_pbr_probe_attempts_total{job=~\"$job\",outbound=~\"$outbound\"}[15m]) > 0)",
          "legendFormat": "{{outbound}} ({{test_outbound}})",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "percent",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "axisSoftMin": 90,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "max": 100
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 16,
      "type": "state-timeline",
      "title": "Selected outbound",
      "description": "Which member each urltest/icmptest group currently routes through.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 28,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_urltest_selected{job=~\"$job\",outbound=~\"$outbound\"}",
          "legendFormat": "{{group}} / {{outbound}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "standby",
                  "color": "transparent",
                  "index": 0
                },
                "1": {
                  "text": "selected",
                  "color": "green",
                  "index": 1
                }
              }
            }
          ],
          "custom": {
            "fillOpacity": 70,
            "lineWidth": 0,
            "spanNulls": false
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "transparent",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "mergeValues": true,
        "showValue": "auto",
        "alignValue": "center",
        "rowHeight": 0.8,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      }
    },
    {
      "id": 17,
      "type": "stat",
      "title": "Selection changes",
      "description": "Selected outbound changes per group over the selected range (counted since process start).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 36,
        "w": 6,
        "h": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (group) (increase(keen_pbr_urltest_selection_changes_total{job=~\"$job\"}[$__range]))",
          "legendFormat": "{{group}}",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 3
              },
              {
                "color": "red",
                "value": 10
              }
            ]
          },
          "noValue": "0"
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value_and_name",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 18,
      "type": "table",
      "title": "Time since last successful probe",
      "description": "Age of the last successful probe per outbound. Missing rows never had a successful probe.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 6,
        "y": 36,
        "w": 18,
        "h": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "time() - keen_pbr_probe_last_success_timestamp_seconds{job=~\"$job\",outbound=~\"$outbound\"}",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true
          }
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Age"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-background"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 300
                    },
                    {
                      "color": "red",
                      "value": 900
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "footer": {
          "show": false
        }
      },
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "job": true,
              "instance": true,
              "__name__": true
            },
            "renameByName": {
              "Value": "Age",
              "outbound": "Outbound",
              "test_outbound": "Test group",
              "interface": "Interface",
              "type": "Type"
            }
          }
        }
      ]
    },
    {
      "id": 19,
      "type": "row",
      "title": "DNS interception",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 42,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 20,
      "type": "timeseries",
      "title": "DNS hold time p50 / p95 / p99",
      "description": "How long DNS answers are held before the verdict. The red line is the default hold deadline (30 ms, intercept hold_timeout_ms).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 43,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "histogram_quantile(0.5, sum by (le) (rate(keen_pbr_dns_hold_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p50",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "histogram_quantile(0.95, sum by (le) (rate(keen_pbr_dns_hold_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p95",
          "refId": "B",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(keen_pbr_dns_hold_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "C",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 0.03
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "line"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 21,
      "type": "timeseries",
      "title": "DNS queue wait p99",
      "description": "Time a DNS packet waits in the receive queue before processing.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 43,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "histogram_quantile(0.99, sum by (le) (rate(keen_pbr_dns_queue_wait_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "p99",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 22,
      "type": "timeseries",
      "title": "Hold timeouts by cause",
      "description": "DNS holds that reached their deadline. Any non-zero value means a packet was released before its set write finished.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 51,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (cause) (increase(keen_pbr_dns_hold_timeouts_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "{{cause}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "fixed",
            "fixedColor": "red"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "bars",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 80,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 23,
      "type": "timeseries",
      "title": "DNS vs L7 packets per minute",
      "description": "Intercepted packets inspected per minute.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 51,
        "w": 8,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (path) (rate(keen_pbr_intercept_packets_total{job=~\"$job\"}[$__rate_interval])) * 60",
          "legendFormat": "{{path}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 10,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 24,
      "type": "stat",
      "title": "Match share",
      "description": "Share of inspected packets that matched a configured domain list over the selected range.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 20,
        "y": 51,
        "w": 4,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum(increase(keen_pbr_intercept_matches_total{job=~\"$job\"}[$__range])) / (sum(increase(keen_pbr_intercept_packets_total{job=~\"$job\"}[$__range])) > 0)",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "percentunit",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          },
          "noValue": "n/a"
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 25,
      "type": "stat",
      "title": "Queue overruns",
      "description": "Kernel queue receive overruns (NFQUEUE / NFLOG) over the selected range.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 59,
        "w": 6,
        "h": 5
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (queue) (increase(keen_pbr_queue_overruns_total{job=~\"$job\"}[$__range]))",
          "legendFormat": "{{queue}}",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          },
          "noValue": "0"
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value_and_name",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 37,
      "type": "row",
      "title": "DNS proxy",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 64,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 38,
      "type": "timeseries",
      "title": "Queries per second by port",
      "description": "Queries the DNS proxy receives from dnsmasq, per proxy port.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 65,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (proxy_port) (rate(keen_pbr_dns_proxy_queries_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "port {{proxy_port}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 39,
      "type": "timeseries",
      "title": "Failed attempts by server and result",
      "description": "Attempts to a DNS server that got no answer, SERVFAIL or REFUSED. Servers that fail 10 times in a row raise a health warning.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 65,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (server, result) (rate(keen_pbr_dns_proxy_upstream_requests_total{job=~\"$job\",result=~\"servfail|refused|timeout|connection_refused|unreachable|connection_closed|tls_error|http_error|bad_answer|not_resolved|network_error\"}[$__rate_interval])) > 0",
          "legendFormat": "{{server}} · {{result}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "bars",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 80,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 40,
      "type": "timeseries",
      "title": "Answer time p95 by server",
      "description": "How long a DNS server takes to answer the proxy (attempts that got an answer).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 73,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "histogram_quantile(0.95, sum by (le, server) (rate(keen_pbr_dns_proxy_upstream_response_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "{{server}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 41,
      "type": "state-timeline",
      "title": "Server availability",
      "description": "0 while the proxy skips a DNS server after a failure. Gaps mean the proxy is not running.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 73,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "min by (server, upstream) (keen_pbr_dns_proxy_upstream_up{job=~\"$job\"})",
          "legendFormat": "{{server}} ({{upstream}})",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "SKIPPED",
                  "color": "red",
                  "index": 0
                },
                "1": {
                  "text": "UP",
                  "color": "green",
                  "index": 1
                }
              }
            }
          ],
          "custom": {
            "fillOpacity": 70,
            "lineWidth": 0,
            "spanNulls": false
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "mergeValues": true,
        "showValue": "auto",
        "alignValue": "center",
        "rowHeight": 0.8,
        "legend": {
          "showLegend": false,
          "displayMode": "list",
          "placement": "bottom"
        },
        "tooltip": {
          "mode": "single"
        }
      }
    },
    {
      "id": 42,
      "type": "timeseries",
      "title": "Proxy answers and drops",
      "description": "Answers the proxy sent by source (upstream, or its own SERVFAIL when no server answered) and queries it dropped.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 81,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (source) (rate(keen_pbr_dns_proxy_responses_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "answers · {{source}}",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (reason) (rate(keen_pbr_dns_proxy_dropped_total{job=~\"$job\"}[$__rate_interval]))",
          "legendFormat": "dropped · {{reason}}",
          "refId": "B",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "reqps",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 43,
      "type": "timeseries",
      "title": "Slots in use",
      "description": "Queries the proxy is working on now.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 81,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_dns_proxy_inflight{job=~\"$job\"}",
          "legendFormat": "{{transport}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 44,
      "type": "timeseries",
      "title": "Failures in a row by server",
      "description": "Consecutive failed attempts to a DNS server. Drops to 0 on the first answer; a server that keeps growing is skipped by the proxy.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 89,
        "w": 24,
        "h": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "max by (server, upstream) (keen_pbr_dns_proxy_upstream_consecutive_failures{job=~\"$job\"})",
          "legendFormat": "{{server}} ({{upstream}})",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0,
          "decimals": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 26,
      "type": "row",
      "title": "Sets & lists",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 95,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 27,
      "type": "timeseries",
      "title": "Set write p95 by path",
      "description": "Dynamic set write duration. The line marks the 25 ms slow-write threshold.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 96,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "histogram_quantile(0.95, sum by (le, path) (rate(keen_pbr_set_write_duration_seconds_bucket{job=~\"$job\"}[$__rate_interval])))",
          "legendFormat": "{{path}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "s",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 0.025
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "line"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 28,
      "type": "timeseries",
      "title": "Slow set writes (> 25 ms)",
      "description": "Share of set writes that took longer than 25 ms (derived from the le=\"0.025\" bucket).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 96,
        "w": 12,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "1 - sum by (path) (rate(keen_pbr_set_write_duration_seconds_bucket{job=~\"$job\",le=\"0.025\"}[$__rate_interval])) / (sum by (path) (rate(keen_pbr_set_write_duration_seconds_count{job=~\"$job\"}[$__rate_interval])) > 0)",
          "legendFormat": "{{path}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "percentunit",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 0,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "axisSoftMax": 0.05,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 29,
      "type": "stat",
      "title": "Cache hit ratio",
      "description": "Share of learned addresses already present in the set cache (no write before the verdict).",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 104,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum(increase(keen_pbr_set_cache_lookups_total{job=~\"$job\",result=\"hit\"}[$__range])) / (sum(increase(keen_pbr_set_cache_lookups_total{job=~\"$job\"}[$__range])) > 0)",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "unit": "percentunit",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "orange",
                "value": null
              },
              {
                "color": "green",
                "value": 0.5
              }
            ]
          },
          "noValue": "n/a"
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 30,
      "type": "stat",
      "title": "Cache entries",
      "description": "Remembered dynamic set elements.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 4,
        "y": 104,
        "w": 4,
        "h": 4
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_set_cache_entries{job=~\"$job\"}",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "blue",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "none",
        "graphMode": "area",
        "textMode": "auto",
        "justifyMode": "auto",
        "orientation": "auto"
      }
    },
    {
      "id": 31,
      "type": "timeseries",
      "title": "Set writes per minute",
      "description": "Elements newly added or timeout-refreshed.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 8,
        "y": 104,
        "w": 8,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (kind) (rate(keen_pbr_set_writes_total{job=~\"$job\"}[$__rate_interval])) * 60",
          "legendFormat": "{{kind}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 10,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 32,
      "type": "timeseries",
      "title": "Refresh outcomes per minute",
      "description": "Cached elements whose refresh was skipped, deferred until after the verdict, or dropped because the queue was full.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 16,
        "y": 104,
        "w": 8,
        "h": 8
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (result) (rate(keen_pbr_set_refresh_total{job=~\"$job\"}[$__rate_interval])) * 60",
          "legendFormat": "{{result}}",
          "refId": "A",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 10,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "dropped"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 33,
      "type": "table",
      "title": "Remote list freshness",
      "description": "Last successful check of each remote list (since process start) and refresh failures in the selected range.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 112,
        "w": 12,
        "h": 7
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "keen_pbr_list_last_update_timestamp_seconds{job=~\"$job\"} * 1000",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false,
          "format": "table"
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "increase(keen_pbr_list_update_errors_total{job=~\"$job\"}[$__range])",
          "legendFormat": "",
          "refId": "B",
          "instant": true,
          "range": false,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true
          },
          "noValue": "No remote lists"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Last check"
            },
            "properties": [
              {
                "id": "unit",
                "value": "dateTimeFromNow"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Errors"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-background"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "footer": {
          "show": false
        }
      },
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true,
              "job": true,
              "instance": true,
              "__name__": true
            },
            "renameByName": {
              "list": "List",
              "Value #A": "Last check",
              "Value #B": "Errors"
            },
            "indexByName": {
              "list": 0,
              "Value #A": 1,
              "Value #B": 2
            }
          }
        }
      ]
    },
    {
      "id": 34,
      "type": "timeseries",
      "title": "Conntrack cleanup per minute",
      "description": "Conntrack entries reset after learning new addresses.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 12,
        "y": 112,
        "w": 12,
        "h": 7
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "rate(keen_pbr_conntrack_requests_total{job=~\"$job\"}[$__rate_interval]) * 60",
          "legendFormat": "requests",
          "refId": "A",
          "range": true
        },
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "rate(keen_pbr_conntrack_deleted_total{job=~\"$job\"}[$__rate_interval]) * 60",
          "legendFormat": "deleted",
          "refId": "B",
          "range": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "palette-classic"
          },
          "mappings": [],
          "unit": "short",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "drawStyle": "line",
            "lineInterpolation": "linear",
            "lineWidth": 1,
            "fillOpacity": 10,
            "gradientMode": "none",
            "showPoints": "never",
            "spanNulls": false,
            "axisPlacement": "auto",
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "thresholdsStyle": {
              "mode": "off"
            }
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "list",
          "placement": "bottom",
          "showLegend": true,
          "calcs": []
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      }
    },
    {
      "id": 35,
      "type": "row",
      "title": "Errors",
      "collapsed": false,
      "gridPos": {
        "x": 0,
        "y": 119,
        "w": 24,
        "h": 1
      },
      "panels": []
    },
    {
      "id": 36,
      "type": "table",
      "title": "Errors in range by subsystem",
      "description": "Only subsystems with errors in the selected range are listed.",
      "datasource": {
        "type": "prometheus",
        "uid": "prometheus"
      },
      "gridPos": {
        "x": 0,
        "y": 120,
        "w": 24,
        "h": 6
      },
      "targets": [
        {
          "datasource": {
            "type": "prometheus",
            "uid": "prometheus"
          },
          "expr": "sum by (subsystem) (increase(keen_pbr_errors_total{job=~\"$job\"}[$__range])) > 0",
          "legendFormat": "",
          "refId": "A",
          "instant": true,
          "range": false,
          "format": "table"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "mappings": [],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              }
            ]
          },
          "custom": {
            "align": "auto",
            "cellOptions": {
              "type": "auto"
            },
            "filterable": true
          },
          "noValue": "No errors in range"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Errors"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 0
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-background"
                }
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "red",
                      "value": 1
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm",
        "footer": {
          "show": false
        }
      },
      "transformations": [
        {
          "id": "organize",
          "options": {
            "excludeByName": {
              "Time": true
            },
            "renameByName": {
              "subsystem": "Subsystem",
              "Value": "Errors"
            }
          }
        }
      ]
    }
  ]
}
