{
  "uid": "onprem-ai-inference-hardware",
  "title": "Inference, GPUs and hardware",
  "description": "What needs attention, every model at a glance, usage and energy cost, tokens per second, parallel requests, latency, KV cache, errors, and the GPUs and servers behind them.",
  "tags": [
    "onprem-ai"
  ],
  "timezone": "browser",
  "schemaVersion": 39,
  "editable": true,
  "graphTooltip": 1,
  "refresh": "30s",
  "time": {
    "from": "now-6h",
    "to": "now"
  },
  "annotations": {
    "list": [
      {
        "name": "Deploys and undeploys",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "enable": false,
        "iconColor": "purple",
        "expr": "onprem_ai_control_plane_operator_action{routing_model_id=~\"$model\"}",
        "titleFormat": "{{action}} {{routing_model_id}}",
        "step": "60s"
      }
    ]
  },
  "templating": {
    "list": [
      {
        "type": "datasource",
        "name": "datasource",
        "label": "Data from",
        "query": "prometheus",
        "hide": 0
      },
      {
        "type": "query",
        "name": "model",
        "label": "Model",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "multi": true,
        "includeAll": true,
        "allValue": ".*",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "refresh": 2,
        "sort": 1,
        "definition": "label_values(onprem_ai_api_gateway_requests_total, routing_model_id)",
        "query": {
          "qryType": 1,
          "query": "label_values(onprem_ai_api_gateway_requests_total, routing_model_id)",
          "refId": "model"
        }
      },
      {
        "type": "query",
        "name": "node",
        "label": "Machine",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "multi": true,
        "includeAll": true,
        "allValue": ".*",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "refresh": 2,
        "sort": 1,
        "definition": "query_result(group by (display_name, inference_node_id) (onprem_ai_control_plane_inference_node_connected))",
        "query": {
          "qryType": 3,
          "query": "query_result(group by (display_name, inference_node_id) (onprem_ai_control_plane_inference_node_connected))",
          "refId": "node"
        },
        "regex": "/display_name=\"(?<text>[^\"]+)\".*inference_node_id=\"(?<value>[^\"]+)\"/"
      },
      {
        "type": "query",
        "name": "key",
        "label": "API key",
        "datasource": {
          "type": "prometheus",
          "uid": "${datasource}"
        },
        "multi": true,
        "includeAll": true,
        "allValue": ".*",
        "current": {
          "text": "All",
          "value": "$__all"
        },
        "refresh": 2,
        "sort": 1,
        "definition": "label_values(onprem_ai_api_gateway_requests_total, api_gateway_key_name)",
        "query": {
          "qryType": 1,
          "query": "label_values(onprem_ai_api_gateway_requests_total, api_gateway_key_name)",
          "refId": "key"
        }
      },
      {
        "type": "custom",
        "name": "hide_tests",
        "label": "Built-in test requests",
        "query": "not counted : service-smoke-test,counted : __counted__",
        "options": [
          {
            "text": "not counted",
            "value": "service-smoke-test",
            "selected": true
          },
          {
            "text": "counted",
            "value": "__counted__",
            "selected": false
          }
        ],
        "current": {
          "text": "not counted",
          "value": "service-smoke-test"
        },
        "description": "The control plane's own test requests to every model. Not counted by default, so the traffic panels show real clients only."
      },
      {
        "type": "textbox",
        "name": "price",
        "label": "Electricity price per kWh",
        "query": "0.25",
        "current": {
          "text": "0.25",
          "value": "0.25"
        },
        "options": [
          {
            "text": "0.25",
            "value": "0.25",
            "selected": true
          }
        ],
        "description": "Used for 'GPU electricity cost'. Enter your price per kilowatt-hour, in your currency."
      }
    ]
  },
  "panels": [
    {
      "type": "text",
      "title": "",
      "options": {
        "mode": "markdown",
        "content": "**How to read this page.** Top: what needs attention now. Then every model in one table, usage over the selected time range, and details further down. A **token** is a piece of text, about ¾ of a word: models read *input* tokens (the prompt) and write *output* tokens (the answer). A **replica** is one running copy of a model. The **KV cache** is a model's working memory for the conversations it is handling. **Machine** = a GPU server. Hover the info icon of a panel for what it means and what is normal."
      },
      "transparent": true,
      "id": 1,
      "gridPos": {
        "h": 3,
        "w": 24,
        "x": 0,
        "y": 0
      }
    },
    {
      "type": "row",
      "title": "Status: does anything need attention right now?",
      "collapsed": false,
      "panels": [],
      "id": 2,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 3
      }
    },
    {
      "type": "stat",
      "title": "Alerts firing",
      "description": "Warnings and critical alerts the platform itself raises at the moment (see the list below). 0 = nothing to do.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(count(ALERTS{alertstate=\"firing\", severity=~\"critical|warning\"})) or vector(0)",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 3,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 0,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "Machines off",
      "description": "GPU servers that are registered but not reachable. Their models do not answer.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(count(onprem_ai_control_plane_inference_node_connected{inference_node_id=~\"$node\"} == 0)) or vector(0)",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "orange",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 4,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 3,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "Models down",
      "description": "Models with at least one copy that should run but does not (starting, crashed or failed).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(count(min by (routing_model_id) (onprem_ai_control_plane_inference_service_replica_running{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}) == 0)) or vector(0)",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 5,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 6,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "Tests failing",
      "description": "The control plane sends each model a small test request regularly. This counts the models whose last test failed: a client would get no answer either.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(count(min by (routing_model_id) (onprem_ai_control_plane_smoke_test_ok{routing_model_id=~\"$model\"}) == 0)) or vector(0)",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "red",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 6,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 9,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "Failed now",
      "description": "Share of requests in the last minutes that got no usable answer (refused, or broken off). 0% with no traffic.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "((sum (rate(onprem_ai_api_gateway_rejections_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) or sum (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__rate_interval])) * 0) / ((sum (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__rate_interval])) + (sum (rate(onprem_ai_api_gateway_rejections_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) or sum (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__rate_interval])) * 0)) > 0)) or vector(0)",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.01
              },
              {
                "color": "red",
                "value": 0.05
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 7,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 12,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "Fullest disk",
      "description": "The fullest disk of all machines. A full disk stops model downloads and deployments.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(onprem_ai_inference_node_filesystem_used_bytes{inference_node_id=~\"$node\"} / (onprem_ai_inference_node_filesystem_total_bytes{inference_node_id=~\"$node\"} > 20e9))",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.8
              },
              {
                "color": "red",
                "value": 0.9
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 8,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 15,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "KV fullest",
      "description": "The fullest working memory of any model copy. Near 100% that copy has no room for more conversations: requests wait.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max(onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.8
              },
              {
                "color": "red",
                "value": 0.95
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 9,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 18,
        "y": 4
      }
    },
    {
      "type": "stat",
      "title": "Report delay",
      "description": "How long the oldest event of any machine has been waiting to reach the control plane. Minutes are fine; more than an hour means the reporting is stuck.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(max(onprem_ai_inference_node_event_stream_oldest_undelivered_age_seconds{inference_node_id=~\"$node\"})) or vector(0)",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 600
              },
              {
                "color": "red",
                "value": 3600
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 10,
      "gridPos": {
        "h": 4,
        "w": 3,
        "x": 21,
        "y": 4
      }
    },
    {
      "type": "table",
      "title": "Alerts firing now",
      "description": "The platform's own alerts that are active at the end of the time range, with how many things each one concerns. 'Watchdog' is always on: it proves alerting works.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "count by (alertname, severity) (ALERTS{alertstate=\"firing\"})",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "renameByName": {
              "Value #A": "Count",
              "severity": "Severity",
              "alertname": "Alert"
            },
            "excludeByName": {
              "Time": true
            }
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Severity",
                "Alert",
                "Count"
              ]
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "sort": [
              {
                "field": "Count",
                "desc": true
              }
            ]
          }
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "filterable": true,
            "align": "auto",
            "minWidth": 90
          },
          "noValue": "–"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Count"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Severity"
            },
            "properties": [
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              },
              {
                "id": "custom.width",
                "value": 100
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "type": "value",
                    "options": {
                      "critical": {
                        "color": "red",
                        "index": 0
                      },
                      "warning": {
                        "color": "orange",
                        "index": 1
                      },
                      "info": {
                        "color": "blue",
                        "index": 2
                      }
                    }
                  }
                ]
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      },
      "id": 11,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 0,
        "y": 8
      }
    },
    {
      "type": "state-timeline",
      "title": "Machines connected",
      "description": "One bar per GPU server. Green = connected to the control plane, red = not reachable: its models do not answer and its measurements stop.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "min by (display_name) (onprem_ai_control_plane_inference_node_connected{inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "fillOpacity": 80,
            "lineWidth": 0
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "no",
                  "color": "red"
                },
                "1": {
                  "text": "yes",
                  "color": "green"
                }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "mergeValues": true,
        "showValue": "never",
        "rowHeight": 0.85,
        "legend": {
          "showLegend": false
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "id": 12,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 8,
        "y": 8
      }
    },
    {
      "type": "state-timeline",
      "title": "Models running",
      "description": "One bar per model. Green = every copy that should run is running; red = at least one is not (starting, crashed or failed).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "min by (routing_model_id) (onprem_ai_control_plane_inference_service_replica_running{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "fillOpacity": 80,
            "lineWidth": 0
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "no",
                  "color": "red"
                },
                "1": {
                  "text": "yes",
                  "color": "green"
                }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "mergeValues": true,
        "showValue": "never",
        "rowHeight": 0.85,
        "legend": {
          "showLegend": false
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "id": 13,
      "gridPos": {
        "h": 8,
        "w": 8,
        "x": 16,
        "y": 8
      }
    },
    {
      "type": "table",
      "title": "Every model at a glance (* = over the selected time range)",
      "description": "One line per model. Columns without * are current values. Copies = running copies of the model; Test = the last built-in test request; Starts ≤ 2.5 s = share of requests whose answer began within 2.5 seconds; KV peak = fullest working memory; GPUs busy = GPUs' worth of compute in use. A model is under pressure when its KV cache peak is near 100%, its fast-answer share drops, or its GPU time is close to the number of GPUs it holds.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_control_plane_inference_service_replica_running{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "min by (routing_model_id) (onprem_ai_control_plane_smoke_test_ok{routing_model_id=~\"$model\"})",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "C",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (routing_model_id) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) * 60) > 0",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "D",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) > 0",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "E",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "0 < max_over_time((sum by (routing_model_id) (rate(onprem_ai_api_gateway_request_duration_seconds_sum{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", outcome=\"served\"}[1m])))[$__range:1m])",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "F",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (increase(onprem_ai_api_gateway_time_to_first_token_seconds_bucket{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", le=\"2.5\"}[$__range])) / (sum by (routing_model_id) (increase(onprem_ai_api_gateway_time_to_first_token_seconds_count{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) > 0)",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "G",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (routing_model_id) (increase(onprem_ai_api_gateway_rejections_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) or sum by (routing_model_id) (increase(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__range])) * 0) / ((sum by (routing_model_id) (increase(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__range])) + (sum by (routing_model_id) (increase(onprem_ai_api_gateway_rejections_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) or sum by (routing_model_id) (increase(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__range])) * 0)) > 0)",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "H",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max by (routing_model_id) (max_over_time(onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__range]))",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "I",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_inference_service_replica_gpu_sm_utilization_percent{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}) / 100",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "J",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_inference_service_replica_gpu_vram_used_bytes{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "renameByName": {
              "Value #A": "Copies",
              "Value #B": "Test",
              "Value #C": "Req / min",
              "Value #D": "Out tok / s",
              "Value #E": "Peak parallel *",
              "Value #F": "Starts ≤ 2.5 s *",
              "Value #G": "Failed *",
              "Value #H": "KV peak *",
              "Value #I": "GPUs busy",
              "Value #J": "GPU memory",
              "routing_model_id": "Model"
            },
            "excludeByName": {
              "Time": true
            }
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Model",
                "Copies",
                "Test",
                "Req / min",
                "Out tok / s",
                "Peak parallel *",
                "Starts ≤ 2.5 s *",
                "Failed *",
                "KV peak *",
                "GPUs busy",
                "GPU memory"
              ]
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "sort": [
              {
                "field": "Copies",
                "desc": true
              }
            ]
          }
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "filterable": true,
            "align": "auto",
            "minWidth": 90
          },
          "noValue": "–"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Copies"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Test"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "mappings",
                "value": [
                  {
                    "type": "value",
                    "options": {
                      "0": {
                        "text": "failed",
                        "color": "red"
                      },
                      "1": {
                        "text": "ok",
                        "color": "green"
                      }
                    }
                  }
                ]
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Req / min"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 1
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Out tok / s"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 1
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Peak parallel *"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 1
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Starts ≤ 2.5 s *"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "red",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 0.8
                    },
                    {
                      "color": "green",
                      "value": 0.95
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Failed *"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "decimals",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "text",
                      "value": null
                    },
                    {
                      "color": "orange",
                      "value": 0.01
                    },
                    {
                      "color": "red",
                      "value": 0.05
                    }
                  ]
                }
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "color-text"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "KV peak *"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 0.8
                    },
                    {
                      "color": "red",
                      "value": 0.95
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "GPUs busy"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 1
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "GPU memory"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bytes"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      },
      "id": 14,
      "gridPos": {
        "h": 9,
        "w": 24,
        "x": 0,
        "y": 16
      }
    },
    {
      "type": "row",
      "title": "Usage in the selected time range: is the hardware used, by whom, and what does it cost?",
      "collapsed": false,
      "panels": [],
      "id": 15,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 36
      }
    },
    {
      "type": "stat",
      "title": "Requests answered",
      "description": "Requests that got an answer in the selected time range.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum(increase(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__range]))) or vector(0)",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 16,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 37
      }
    },
    {
      "type": "stat",
      "title": "Output tokens written",
      "description": "All text the models produced in the selected time range, in tokens (about ¾ of a word each).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum(increase(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range]))) or vector(0)",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 17,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 37
      }
    },
    {
      "type": "stat",
      "title": "Input tokens read",
      "description": "All prompt text the models read in the selected time range, in tokens.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum(increase(onprem_ai_api_gateway_tokens_total{token_type=\"input\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range]))) or vector(0)",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 18,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 37
      }
    },
    {
      "type": "stat",
      "title": "Peak output (1 min)",
      "description": "The highest output of all models together in any single minute of the time range.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max_over_time((sum(rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[1m])))[$__range:1m])",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: tok/s",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 19,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 37
      }
    },
    {
      "type": "stat",
      "title": "Peak parallel requests",
      "description": "The highest number of requests in progress at once, as the gateway sampled it every 15 seconds.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max_over_time((sum(onprem_ai_api_gateway_in_flight_requests))[$__range:15s])",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 20,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 37
      }
    },
    {
      "type": "stat",
      "title": "Answers start ≤ 2.5 s",
      "description": "Of all requests in the time range, the share whose answer began within 2.5 seconds. Requests without streaming deliver everything at the end, so long ones count as slow.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum (increase(onprem_ai_api_gateway_time_to_first_token_seconds_bucket{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", le=\"2.5\"}[$__range])) / (sum (increase(onprem_ai_api_gateway_time_to_first_token_seconds_count{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) > 0)",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "color": {
            "mode": "thresholds",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.8
              },
              {
                "color": "green",
                "value": 0.95
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 21,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 37
      }
    },
    {
      "type": "stat",
      "title": "GPU utilization",
      "description": "How busy the GPUs on the selected machines were over the time range, all cards averaged, and the busiest minute. A low average means spare capacity. A single request can already drive a card to 100%, so high utilization alone does not mean the GPUs are too small.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "avg_over_time((avg(onprem_ai_gpu_utilization_percent{inference_node_id=~\"$node\"}))[$__range:1m])",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "legendFormat": "average"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max_over_time((avg(onprem_ai_gpu_utilization_percent{inference_node_id=~\"$node\"}))[$__range:1m])",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "legendFormat": "peak"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value_and_name",
        "justifyMode": "auto"
      },
      "id": 22,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 0,
        "y": 41
      }
    },
    {
      "type": "stat",
      "title": "GPU-hours",
      "description": "Hours of GPU time in the range, counted per card: 'working' while a card was above 5% load, 'idle' while it was powered on and doing nothing. Idle hours are hardware you pay for and do not use.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(count_over_time((onprem_ai_gpu_utilization_percent{inference_node_id=~\"$node\"} > 5)[$__range:1m])) / 60",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "legendFormat": "working"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(count_over_time((onprem_ai_gpu_utilization_percent{inference_node_id=~\"$node\"} <= 5)[$__range:1m])) / 60",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "legendFormat": "idle"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: h",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value_and_name",
        "justifyMode": "auto"
      },
      "id": 23,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 4,
        "y": 41
      }
    },
    {
      "type": "stat",
      "title": "GPU energy used",
      "description": "Electrical energy all GPUs on the selected machines used in the time range. GPUs only: CPUs, fans and cooling are not measured.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(sum_over_time(onprem_ai_gpu_power_usage_watts{inference_node_id=~\"$node\"}[$__range:1m])) / 60000",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "kwatth",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 24,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 8,
        "y": 41
      }
    },
    {
      "type": "stat",
      "title": "GPU electricity cost",
      "description": "The GPU energy times the price per kWh you enter at the top of the page ('Electricity price'). In your own currency.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum(sum_over_time(onprem_ai_gpu_power_usage_watts{inference_node_id=~\"$node\"}[$__range:1m])) / 60000) * $price",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 2,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 25,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 12,
        "y": 41
      }
    },
    {
      "type": "stat",
      "title": "Free GPU memory now",
      "description": "GPU memory not occupied on the selected machines, all cards together. Compare with the 'GPU memory' of a model above to see whether one more would fit (it must fit on the cards of one machine).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(onprem_ai_gpu_vram_total_bytes{inference_node_id=~\"$node\"} - onprem_ai_gpu_vram_used_bytes{inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 26,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 16,
        "y": 41
      }
    },
    {
      "type": "stat",
      "title": "Output tokens per kWh",
      "description": "Efficiency over the time range: tokens written per kilowatt-hour of GPU energy, idle cards included. Rises when the GPUs are well used.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) / (sum(sum_over_time(onprem_ai_gpu_power_usage_watts{inference_node_id=~\"$node\"}[$__range:1m])) / 60000)",
          "editorMode": "code",
          "range": false,
          "instant": true
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "color": {
            "mode": "fixed",
            "fixedColor": "text"
          },
          "noValue": "–",
          "decimals": 0,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "text",
                "value": null
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "reduceOptions": {
          "calcs": [
            "lastNotNull"
          ],
          "fields": "",
          "values": false
        },
        "colorMode": "value",
        "graphMode": "none",
        "textMode": "value",
        "justifyMode": "auto"
      },
      "id": 27,
      "gridPos": {
        "h": 4,
        "w": 4,
        "x": 20,
        "y": 41
      }
    },
    {
      "type": "table",
      "title": "Who uses it: usage per API key (one key per application or team)",
      "description": "Requests and tokens of each API key in the selected time range, and its share of all output. Use it to see which applications drive the load and how that changes.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (api_gateway_key_name) (increase(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__range]))",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (api_gateway_key_name) (increase(onprem_ai_api_gateway_tokens_total{token_type=\"input\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range]))",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "C",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (api_gateway_key_name) (increase(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range]))",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "D",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (api_gateway_key_name) (increase(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) / scalar(sum(increase(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__range])) > 0)",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "renameByName": {
              "Value #A": "Requests",
              "Value #B": "Input tokens",
              "Value #C": "Output tokens",
              "Value #D": "Share of output",
              "api_gateway_key_name": "API key"
            },
            "excludeByName": {
              "Time": true
            }
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "API key",
                "Requests",
                "Input tokens",
                "Output tokens",
                "Share of output"
              ]
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "sort": [
              {
                "field": "Output tokens",
                "desc": true
              }
            ]
          }
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "filterable": true,
            "align": "auto",
            "minWidth": 90
          },
          "noValue": "–"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Requests"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              },
              {
                "id": "decimals",
                "value": 0
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Input tokens"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Output tokens"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Share of output"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "blue",
                      "value": null
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      },
      "id": 28,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 0,
        "y": 45
      }
    },
    {
      "type": "timeseries",
      "title": "Output tokens per second, by API key",
      "description": "Generated tokens per second for each API key (stacked: the top edge is the total).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (api_gateway_key_name) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{api_gateway_key_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: tok/s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 29,
      "gridPos": {
        "h": 8,
        "w": 12,
        "x": 12,
        "y": 45
      }
    },
    {
      "type": "row",
      "title": "Throughput: how much the models produce",
      "collapsed": false,
      "panels": [],
      "id": 30,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 65
      }
    },
    {
      "type": "timeseries",
      "title": "Output tokens per second, by model",
      "description": "Generated tokens per second for each model (stacked: the top edge is the total). Peaks get lower when you zoom out, because each point then averages a longer time.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: tok/s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 31,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 66
      }
    },
    {
      "type": "timeseries",
      "title": "Input tokens per second, by model",
      "description": "Prompt tokens per second for each model (stacked). Long prompts and documents show here, not in the output.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"input\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: tok/s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 32,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 66
      }
    },
    {
      "type": "timeseries",
      "title": "Requests per minute, by model",
      "description": "Requests answered per minute for each model (stacked).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__rate_interval])) * 60",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: /min",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 33,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 75
      }
    },
    {
      "type": "timeseries",
      "title": "Requests per minute, per replica",
      "description": "The same traffic split by the model copy that answered. Copies of one model should carry similar load; one that gets nothing is not being used.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(sum by (routing_model_id, inference_service_replica_id) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\", inference_service_replica_id!=\"\"}[$__rate_interval])) * 60, \"replica\", \"$1\", \"inference_service_replica_id\", \"(.{8}).*\")",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} · {{replica}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: /min",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 34,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 75
      }
    },
    {
      "type": "timeseries",
      "title": "Tokens per request, by model",
      "description": "Average prompt size (input) and answer length (output) of one request. Large inputs mean long documents or long conversations, and they fill the KV cache.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"input\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) / (sum by (routing_model_id) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__rate_interval])) > 0)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} input"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) / (sum by (routing_model_id) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", status_class=\"2xx\"}[$__rate_interval])) > 0)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} output"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 35,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 75
      }
    },
    {
      "type": "row",
      "title": "Parallel requests and speed: what one client experiences",
      "collapsed": false,
      "panels": [],
      "id": 36,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 95
      }
    },
    {
      "type": "timeseries",
      "title": "Parallel requests, by model",
      "description": "Requests in progress at the same time. Per model it is computed from how long finished requests took (a request counts when it ends). The thick line is what the gateway counted at each 15-second sample, all models together; short bursts between samples do not show there.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(onprem_ai_api_gateway_in_flight_requests)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "all models, sampled at the gateway"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_request_duration_seconds_sum{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", outcome=\"served\"}[$__rate_interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "all models, sampled at the gateway"
            },
            "properties": [
              {
                "id": "custom.lineWidth",
                "value": 2
              },
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "text"
                }
              },
              {
                "id": "custom.fillOpacity",
                "value": 0
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 37,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 96
      }
    },
    {
      "type": "timeseries",
      "title": "Requests open, per machine",
      "description": "Requests the gateway has open on its connection to each machine. Dashed, where the machine reports it: the most it accepts at once; at that line new requests wait or are refused.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (inference_node_id) (onprem_ai_api_gateway_inference_api_tunnel_requests_in_flight{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (inference_node_id) (onprem_ai_api_gateway_inference_api_tunnel_request_slots{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}} limit"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": ".* limit"
            },
            "properties": [
              {
                "id": "custom.lineStyle",
                "value": {
                  "fill": "dash",
                  "dash": [
                    6,
                    6
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 38,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 96
      }
    },
    {
      "type": "timeseries",
      "title": "Share of answers starting within 2.5 s, by model",
      "description": "Of the requests in each interval, the share whose answer began within 2.5 seconds. 100% = everyone gets a quick start. Requests without streaming deliver everything at the end, so long ones count as slow.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_time_to_first_token_seconds_bucket{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", le=\"2.5\"}[$__rate_interval])) / (sum by (routing_model_id) (rate(onprem_ai_api_gateway_time_to_first_token_seconds_count{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) > 0)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 1
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean"
          ],
          "showLegend": true,
          "sortBy": "Mean",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 39,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 105
      }
    },
    {
      "type": "timeseries",
      "title": "Wait for the first token, by model",
      "description": "Typical wait (half of the requests are faster) and the slow end (only 5 of 100 wait longer). Estimated from time bands, so values are approximate, and anything above 10 s shows as 10 s.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.5, sum by (le, routing_model_id) (rate(onprem_ai_api_gateway_time_to_first_token_seconds_bucket{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} typical"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "histogram_quantile(0.95, sum by (le, routing_model_id) (rate(onprem_ai_api_gateway_time_to_first_token_seconds_bucket{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} slowest 5%"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 10
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": ".*slowest.*"
            },
            "properties": [
              {
                "id": "custom.lineStyle",
                "value": {
                  "fill": "dash",
                  "dash": [
                    6,
                    6
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 40,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 105
      }
    },
    {
      "type": "timeseries",
      "title": "Request duration (average), by model",
      "description": "Average time of a whole answered request, from received to last byte. Long answers take long: read it together with tokens per request.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_request_duration_seconds_sum{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", outcome=\"served\"}[$__rate_interval])) / (sum by (routing_model_id) (rate(onprem_ai_api_gateway_request_duration_seconds_count{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", outcome=\"served\"}[$__rate_interval])) > 0)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 41,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 105
      }
    },
    {
      "type": "timeseries",
      "title": "End-to-end output speed of one request, by model",
      "description": "Output tokens divided by the whole time of the answered requests, the wait before the first token included. It is what a client gets overall, not the pure generation speed. Drops when many requests share a model or when prompts are long.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) / (sum by (routing_model_id) (rate(onprem_ai_api_gateway_request_duration_seconds_sum{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", outcome=\"served\"}[$__rate_interval])) > 0)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: tok/s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 42,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 114
      }
    },
    {
      "type": "timeseries",
      "title": "CPU time the model was held back, by model",
      "description": "Seconds per minute a model's containers wanted processor time but were stopped by their CPU limit. Several threads can wait at once, so values above 60 are possible. Sustained values slow down answers even when the GPUs are free: raise the CPU limit.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (rate(onprem_ai_inference_service_replica_container_cpu_throttled_seconds_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__rate_interval])) * 60",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: s/min",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 43,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 114
      }
    },
    {
      "type": "row",
      "title": "KV cache: the models' working memory for running conversations",
      "collapsed": false,
      "panels": [],
      "id": 44,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 134
      }
    },
    {
      "type": "timeseries",
      "title": "KV cache in use, per replica",
      "description": "The KV cache holds the tokens of all requests a model copy is working on, plus reusable prompt beginnings. Near 100% the engine has no room: new requests queue and get slow. A missing line means the engine reported no value.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}, \"replica\", \"$1\", \"inference_service_replica_id\", \"(.{8}).*\")",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} · {{replica}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear",
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.8
              },
              {
                "color": "red",
                "value": 0.95
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 45,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 135
      }
    },
    {
      "type": "timeseries",
      "title": "Tokens held in the KV cache, by model",
      "description": "Utilization times the cache size: how many tokens of context each model keeps in GPU memory at the moment.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"} * onprem_ai_api_gateway_backend_kv_cache_capacity_tokens{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 46,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 135
      }
    },
    {
      "type": "table",
      "title": "KV cache per replica in the time range",
      "description": "Every model copy that reported in the time range: its cache size, the fullest it got, and for how long it was nearly full. Hours above 95% mean the cache (or the number of copies) is too small for the load. 'In use now' is empty for copies that no longer run.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(max by (routing_model_id, inference_service_replica_id) (max_over_time(onprem_ai_api_gateway_backend_kv_cache_capacity_tokens{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__range])), \"replica\", \"$1\", \"inference_service_replica_id\", \"(.{8}).*\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(max by (routing_model_id, inference_service_replica_id) (max_over_time(onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__range])), \"replica\", \"$1\", \"inference_service_replica_id\", \"(.{8}).*\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "C",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(sum by (routing_model_id, inference_service_replica_id) (count_over_time((onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"} > 0.95)[$__range:1m])) * 60, \"replica\", \"$1\", \"inference_service_replica_id\", \"(.{8}).*\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "D",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace(max by (routing_model_id, inference_service_replica_id) (onprem_ai_api_gateway_backend_kv_cache_utilization{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}), \"replica\", \"$1\", \"inference_service_replica_id\", \"(.{8}).*\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "renameByName": {
              "Value #A": "Cache size (tokens)",
              "Value #B": "Peak",
              "Value #C": "Time above 95%",
              "Value #D": "In use now",
              "routing_model_id": "Model",
              "replica": "Replica"
            },
            "excludeByName": {
              "Time": true
            }
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Model",
                "Replica",
                "Cache size (tokens)",
                "Peak",
                "Time above 95%",
                "In use now"
              ]
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "sort": [
              {
                "field": "Peak",
                "desc": true
              }
            ]
          }
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "filterable": true,
            "align": "auto",
            "minWidth": 90
          },
          "noValue": "–"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Cache size (tokens)"
            },
            "properties": [
              {
                "id": "unit",
                "value": "short"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Peak"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 0.8
                    },
                    {
                      "color": "red",
                      "value": 0.95
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Time above 95%"
            },
            "properties": [
              {
                "id": "unit",
                "value": "s"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "In use now"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 0.8
                    },
                    {
                      "color": "red",
                      "value": 0.95
                    }
                  ]
                }
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      },
      "id": 47,
      "gridPos": {
        "h": 9,
        "w": 16,
        "x": 0,
        "y": 144
      }
    },
    {
      "type": "timeseries",
      "title": "KV cache readings that failed",
      "description": "The gateway asks each engine for its cache state. Failures (no usable value) or timeouts (no answer) explain gaps in the panels above; many timeouts mean the path to the engine stalls. Count per bar.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "interval": "1m",
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (increase(onprem_ai_api_gateway_backend_kv_cache_poll_failures_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} failed"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (increase(onprem_ai_api_gateway_backend_kv_cache_poll_timeouts_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}} timed out"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 60,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "sum"
          ],
          "showLegend": true,
          "sortBy": "Total",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 48,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 144
      }
    },
    {
      "type": "row",
      "title": "Errors and availability",
      "collapsed": false,
      "panels": [],
      "id": 49,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 164
      }
    },
    {
      "type": "timeseries",
      "title": "Refused or failed requests, by reason",
      "description": "Requests that got no usable answer, counted per bar; the legend total is the count in the time range. missing_api_key = no or wrong key; no_such_route = unknown model name or address; model_not_available = the model is not running; upstream_failure = the platform failed behind the gateway.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "interval": "1m",
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (reason) (increase(onprem_ai_api_gateway_rejections_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{reason}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "sum"
          ],
          "showLegend": true,
          "sortBy": "Total",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 50,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 165
      }
    },
    {
      "type": "timeseries",
      "title": "Requests per minute, by result",
      "description": "Requests that reached a model, by how they ended. 2xx served = answered; failed = the answer broke off; aborted = the client stopped reading; 4xx/5xx = the model's engine refused or failed.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (status_class, outcome) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) * 60",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{status_class}} {{outcome}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: /min",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byRegexp",
              "options": "2xx served"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "4xx.*"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "orange"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byRegexp",
              "options": "5xx.*|.*failed"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 51,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 165
      }
    },
    {
      "type": "timeseries",
      "title": "Interrupted and retried requests",
      "description": "Count per bar. Interrupted: a request was cut because the connection to its machine dropped. Retried: the gateway sent a request to another copy after the first one refused it. Cut by limit: an answer exceeded the response size limit.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "interval": "1m",
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(onprem_ai_api_gateway_inference_api_tunnel_requests_interrupted_total{routing_model_id=~\"$model\"}[$__interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "interrupted"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(onprem_ai_api_gateway_replica_retries_total{}[$__interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "retried on another replica"
        },
        {
          "refId": "C",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(increase(onprem_ai_api_gateway_response_limit_trips_total{}[$__interval]))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "cut by response limit"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 10,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "sum"
          ],
          "showLegend": true,
          "sortBy": "Total",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 52,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 165
      }
    },
    {
      "type": "state-timeline",
      "title": "Built-in test requests, by model",
      "description": "The control plane sends a small test request to every model regularly. Green = answered correctly, red = failed. Gaps = no test ran (model not deployed). An empty panel means no test ran at all in the time range.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "min by (routing_model_id) (onprem_ai_control_plane_smoke_test_ok{routing_model_id=~\"$model\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "color": {
            "mode": "thresholds"
          },
          "custom": {
            "fillOpacity": 80,
            "lineWidth": 0
          },
          "mappings": [
            {
              "type": "value",
              "options": {
                "0": {
                  "text": "no",
                  "color": "red"
                },
                "1": {
                  "text": "yes",
                  "color": "green"
                }
              }
            }
          ],
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "red",
                "value": null
              },
              {
                "color": "green",
                "value": 1
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "mergeValues": true,
        "showValue": "never",
        "rowHeight": 0.85,
        "legend": {
          "showLegend": false
        },
        "tooltip": {
          "mode": "single"
        }
      },
      "id": 53,
      "gridPos": {
        "h": 9,
        "w": 10,
        "x": 0,
        "y": 174
      }
    },
    {
      "type": "timeseries",
      "title": "Test request response time, by model",
      "description": "How long the built-in test request took. A steady baseline that shows slowdowns even when no client sends traffic.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "max by (routing_model_id) (onprem_ai_control_plane_smoke_test_latency_seconds{routing_model_id=~\"$model\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "s",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 54,
      "gridPos": {
        "h": 9,
        "w": 7,
        "x": 10,
        "y": 174
      }
    },
    {
      "type": "timeseries",
      "title": "How the replica was chosen",
      "description": "Requests per minute by how the gateway picked a model copy. llm_d_router = the normal choice, aware of load and cached prompts. random = normal for request types the router does not score. random_fallback = the router failed and a random copy answered: answers still arrive, but less evenly spread.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (replica_selection) (rate(onprem_ai_api_gateway_requests_total{routing_model_id=~\"$model\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\", replica_selection!=\"\"}[$__rate_interval])) * 60",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{replica_selection}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: /min",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "random_fallback"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "red"
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "llm_d_router"
            },
            "properties": [
              {
                "id": "color",
                "value": {
                  "mode": "fixed",
                  "fixedColor": "green"
                }
              }
            ]
          }
        ]
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 55,
      "gridPos": {
        "h": 9,
        "w": 7,
        "x": 17,
        "y": 174
      }
    },
    {
      "type": "row",
      "title": "GPUs: load, memory, heat and power",
      "collapsed": false,
      "panels": [],
      "id": 56,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 194
      }
    },
    {
      "type": "table",
      "title": "Every GPU, now (scroll inside the table for more)",
      "description": "One line per graphics card with its current values. Click a column header to sort; use the filter icon to narrow to one machine. Memory is reserved by a model when it starts, so a full card is normal.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_utilization_percent{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_vram_used_bytes{inference_node_id=~\"$node\"} / onprem_ai_gpu_vram_total_bytes{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "C",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_vram_total_bytes{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "D",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_temperature_celsius{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        },
        {
          "refId": "E",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_power_usage_watts{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": false,
          "instant": true,
          "format": "table"
        }
      ],
      "transformations": [
        {
          "id": "merge",
          "options": {}
        },
        {
          "id": "organize",
          "options": {
            "renameByName": {
              "Value #A": "Utilization",
              "Value #B": "Memory used",
              "Value #C": "Memory total",
              "Value #D": "Temperature",
              "Value #E": "Power",
              "display_name": "Machine",
              "slot": "Slot",
              "model_name": "GPU model"
            },
            "excludeByName": {
              "Time": true
            }
          }
        },
        {
          "id": "filterFieldsByName",
          "options": {
            "include": {
              "names": [
                "Machine",
                "Slot",
                "GPU model",
                "Utilization",
                "Memory used",
                "Memory total",
                "Temperature",
                "Power"
              ]
            }
          }
        },
        {
          "id": "sortBy",
          "options": {
            "sort": [
              {
                "field": "Utilization",
                "desc": true
              }
            ]
          }
        }
      ],
      "fieldConfig": {
        "defaults": {
          "custom": {
            "filterable": true,
            "align": "auto",
            "minWidth": 90
          },
          "noValue": "–"
        },
        "overrides": [
          {
            "matcher": {
              "id": "byName",
              "options": "Utilization"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percent"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 100
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "blue",
                      "value": null
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Memory used"
            },
            "properties": [
              {
                "id": "unit",
                "value": "percentunit"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 0
              },
              {
                "id": "max",
                "value": 1
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "blue",
                      "value": null
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Memory total"
            },
            "properties": [
              {
                "id": "unit",
                "value": "bytes"
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Temperature"
            },
            "properties": [
              {
                "id": "unit",
                "value": "celsius"
              },
              {
                "id": "custom.cellOptions",
                "value": {
                  "type": "gauge",
                  "mode": "basic",
                  "valueDisplayMode": "text"
                }
              },
              {
                "id": "min",
                "value": 30
              },
              {
                "id": "max",
                "value": 95
              },
              {
                "id": "thresholds",
                "value": {
                  "mode": "absolute",
                  "steps": [
                    {
                      "color": "green",
                      "value": null
                    },
                    {
                      "color": "yellow",
                      "value": 80
                    },
                    {
                      "color": "red",
                      "value": 90
                    }
                  ]
                }
              }
            ]
          },
          {
            "matcher": {
              "id": "byName",
              "options": "Power"
            },
            "properties": [
              {
                "id": "unit",
                "value": "watt"
              }
            ]
          }
        ]
      },
      "options": {
        "showHeader": true,
        "cellHeight": "sm"
      },
      "id": 57,
      "gridPos": {
        "h": 11,
        "w": 24,
        "x": 0,
        "y": 195
      }
    },
    {
      "type": "timeseries",
      "title": "GPU utilization, per GPU",
      "description": "Compute load of each card. A model spread over several GPUs loads them together; one idle card among busy ones is unused capacity. A single request can already drive a card to 100%.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_utilization_percent{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}} · {{slot}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 100
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 58,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 206
      }
    },
    {
      "type": "timeseries",
      "title": "Free GPU memory, per machine",
      "description": "GPU memory not occupied on each machine, all its cards together: the room left for another model on that machine.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (inference_node_id) (onprem_ai_gpu_vram_total_bytes{inference_node_id=~\"$node\"} - onprem_ai_gpu_vram_used_bytes{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 59,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 206
      }
    },
    {
      "type": "timeseries",
      "title": "GPU compute by model",
      "description": "How many GPUs' worth of compute each model uses: 1.0 = one card fully busy. Compare with the number of GPUs the model holds to see whether it has headroom.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_inference_service_replica_gpu_sm_utilization_percent{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}) / 100",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: GPUs",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 60,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 215
      }
    },
    {
      "type": "timeseries",
      "title": "GPU memory traffic by model",
      "description": "How hard each model drives the GPUs' memory, again in GPUs' worth (1.0 = one card's memory bus fully busy). Generating text is limited by this more often than by compute: when it is near the model's GPU count, the model is at its limit.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_inference_service_replica_gpu_memory_bandwidth_utilization_percent{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}) / 100",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "suffix: GPUs",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 61,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 215
      }
    },
    {
      "type": "timeseries",
      "title": "GPU memory by model",
      "description": "Which model occupies how much GPU memory, measured from the models' own processes (stacked). 'other processes' is memory held by software the platform did not start.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum by (routing_model_id) (onprem_ai_inference_service_replica_gpu_vram_used_bytes{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{routing_model_id}}"
        },
        {
          "refId": "B",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(onprem_ai_gpu_vram_used_other_bytes{inference_node_id=~\"$node\"})",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "other processes"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "bytes",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 62,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 215
      }
    },
    {
      "type": "timeseries",
      "title": "GPU temperature, per GPU",
      "description": "Core temperature of each card. Cards slow themselves down when they get too hot; a card much hotter than its neighbours points to an airflow problem.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "label_replace((onprem_ai_gpu_temperature_celsius{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"slot\", \"$1\", \"pci_bus_id\", \"0+:(.*)\")",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}} · {{slot}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "celsius",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear",
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 80
              },
              {
                "color": "red",
                "value": 90
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 63,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 224
      }
    },
    {
      "type": "timeseries",
      "title": "GPU power draw, per machine",
      "description": "Power all GPUs of one machine draw together (stacked: the top edge is the whole fleet). GPUs only. The energy and cost for the time range are in the usage section above.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (inference_node_id) (onprem_ai_gpu_power_usage_watts{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "watt",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 64,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 224
      }
    },
    {
      "type": "timeseries",
      "title": "Output tokens per watt-hour of GPU energy",
      "description": "Efficiency of the whole fleet at each moment: generated tokens divided by the energy all GPUs used, idle cards included. Near zero when the GPUs run idle or work on something that does not pass the gateway.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "sum(rate(onprem_ai_api_gateway_tokens_total{token_type=\"output\", api_gateway_key_name=~\"$key\", api_gateway_key_name!~\"$hide_tests\"}[$__rate_interval])) * 3600 / sum(onprem_ai_gpu_power_usage_watts)",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "tokens per Wh"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 20,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean"
          ],
          "showLegend": true,
          "sortBy": "Mean",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 65,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 224
      }
    },
    {
      "type": "row",
      "title": "GPU health: hardware faults (everything here should be empty or zero)",
      "collapsed": true,
      "panels": [
        {
          "type": "table",
          "title": "GPU faults in the time range",
          "description": "Fault counters per card. Red numbers need attention: an uncorrected memory error, memory rows awaiting or failing repair, or a fault code (Xid, NVIDIA's error number). 'Slowed down' = the card reduced its speed at some point in the range because of heat or a power limit. Corrected errors and occasional PCIe replays (resent data on the card's slot connection) are tolerable when rare.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((sum by (inference_node_id, gpu_uuid) (increase(onprem_ai_gpu_ecc_uncorrected_volatile_errors_total{inference_node_id=~\"$node\"}[$__range]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            },
            {
              "refId": "B",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((sum by (inference_node_id, gpu_uuid) (increase(onprem_ai_gpu_ecc_corrected_volatile_errors_total{inference_node_id=~\"$node\"}[$__range]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            },
            {
              "refId": "C",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((max by (inference_node_id, gpu_uuid) (onprem_ai_gpu_row_remapping_pending{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            },
            {
              "refId": "D",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((max by (inference_node_id, gpu_uuid) (onprem_ai_gpu_row_remapping_failure{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            },
            {
              "refId": "E",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((max by (inference_node_id, gpu_uuid) (max_over_time(onprem_ai_gpu_xid_error_code{inference_node_id=~\"$node\"}[$__range]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            },
            {
              "refId": "F",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((sum by (inference_node_id, gpu_uuid) (increase(onprem_ai_gpu_pcie_replay_total{inference_node_id=~\"$node\"}[$__range]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            },
            {
              "refId": "G",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((max by (inference_node_id, gpu_uuid) (max_over_time(((floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 4) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 8) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 32) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 64) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 128) % 2) > bool 0)[$__range:1m]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": false,
              "instant": true,
              "format": "table"
            }
          ],
          "transformations": [
            {
              "id": "merge",
              "options": {}
            },
            {
              "id": "organize",
              "options": {
                "renameByName": {
                  "Value #A": "Uncorrected",
                  "Value #B": "Corrected",
                  "Value #C": "Rows to repair",
                  "Value #D": "Repair failed",
                  "Value #E": "Fault code",
                  "Value #F": "PCIe replays",
                  "Value #G": "Slowed down",
                  "display_name": "Machine",
                  "gpu": "GPU"
                },
                "excludeByName": {
                  "Time": true
                }
              }
            },
            {
              "id": "filterFieldsByName",
              "options": {
                "include": {
                  "names": [
                    "Machine",
                    "GPU",
                    "Uncorrected",
                    "Corrected",
                    "Rows to repair",
                    "Repair failed",
                    "Fault code",
                    "PCIe replays",
                    "Slowed down"
                  ]
                }
              }
            },
            {
              "id": "sortBy",
              "options": {
                "sort": [
                  {
                    "field": "Uncorrected",
                    "desc": true
                  }
                ]
              }
            }
          ],
          "fieldConfig": {
            "defaults": {
              "custom": {
                "filterable": true,
                "align": "auto",
                "minWidth": 90
              },
              "noValue": "–"
            },
            "overrides": [
              {
                "matcher": {
                  "id": "byName",
                  "options": "Uncorrected"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  },
                  {
                    "id": "thresholds",
                    "value": {
                      "mode": "absolute",
                      "steps": [
                        {
                          "color": "text",
                          "value": null
                        },
                        {
                          "color": "red",
                          "value": 1
                        }
                      ]
                    }
                  },
                  {
                    "id": "custom.cellOptions",
                    "value": {
                      "type": "color-text"
                    }
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Corrected"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Rows to repair"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  },
                  {
                    "id": "thresholds",
                    "value": {
                      "mode": "absolute",
                      "steps": [
                        {
                          "color": "text",
                          "value": null
                        },
                        {
                          "color": "red",
                          "value": 1
                        }
                      ]
                    }
                  },
                  {
                    "id": "custom.cellOptions",
                    "value": {
                      "type": "color-text"
                    }
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Repair failed"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  },
                  {
                    "id": "thresholds",
                    "value": {
                      "mode": "absolute",
                      "steps": [
                        {
                          "color": "text",
                          "value": null
                        },
                        {
                          "color": "red",
                          "value": 1
                        }
                      ]
                    }
                  },
                  {
                    "id": "custom.cellOptions",
                    "value": {
                      "type": "color-text"
                    }
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Fault code"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  },
                  {
                    "id": "thresholds",
                    "value": {
                      "mode": "absolute",
                      "steps": [
                        {
                          "color": "text",
                          "value": null
                        },
                        {
                          "color": "red",
                          "value": 1
                        }
                      ]
                    }
                  },
                  {
                    "id": "custom.cellOptions",
                    "value": {
                      "type": "color-text"
                    }
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "PCIe replays"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  }
                ]
              },
              {
                "matcher": {
                  "id": "byName",
                  "options": "Slowed down"
                },
                "properties": [
                  {
                    "id": "unit",
                    "value": "short"
                  },
                  {
                    "id": "mappings",
                    "value": [
                      {
                        "type": "value",
                        "options": {
                          "0": {
                            "text": "no"
                          },
                          "1": {
                            "text": "yes",
                            "color": "orange"
                          }
                        }
                      }
                    ]
                  },
                  {
                    "id": "custom.cellOptions",
                    "value": {
                      "type": "color-text"
                    }
                  }
                ]
              }
            ]
          },
          "options": {
            "showHeader": true,
            "cellHeight": "sm"
          },
          "id": 67,
          "gridPos": {
            "h": 10,
            "w": 24,
            "x": 0,
            "y": 245
          }
        },
        {
          "type": "state-timeline",
          "title": "GPU health monitoring running, per machine",
          "description": "Whether the machine's GPU health monitor delivers data. Red = the fault table above is blind for this machine.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "min by (display_name) (onprem_ai_control_plane_inference_node_gpu_health_monitoring_running{inference_node_id=~\"$node\"})",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{display_name}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "fillOpacity": 80,
                "lineWidth": 0
              },
              "mappings": [
                {
                  "type": "value",
                  "options": {
                    "0": {
                      "text": "no",
                      "color": "red"
                    },
                    "1": {
                      "text": "yes",
                      "color": "green"
                    }
                  }
                }
              ],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "red",
                    "value": null
                  },
                  {
                    "color": "green",
                    "value": 1
                  }
                ]
              }
            },
            "overrides": []
          },
          "options": {
            "mergeValues": true,
            "showValue": "never",
            "rowHeight": 0.85,
            "legend": {
              "showLegend": false
            },
            "tooltip": {
              "mode": "single"
            }
          },
          "id": 68,
          "gridPos": {
            "h": 8,
            "w": 8,
            "x": 0,
            "y": 255
          }
        },
        {
          "type": "state-timeline",
          "title": "GPUs slowed down (throttled), per machine",
          "description": "Green = all cards of the machine run at full speed. Red = at least one card reduced its speed, because of heat or a power limit. A power limit under full load is common on dense servers; heat is the one to act on (see temperatures).",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "(1 - max by (inference_node_id) ((floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 4) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 8) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 32) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 64) % 2 + floor(onprem_ai_gpu_throttle_reasons_bitmask{inference_node_id=~\"$node\"} / 128) % 2) > bool 0)) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{display_name}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "color": {
                "mode": "thresholds"
              },
              "custom": {
                "fillOpacity": 80,
                "lineWidth": 0
              },
              "mappings": [
                {
                  "type": "value",
                  "options": {
                    "0": {
                      "text": "no",
                      "color": "red"
                    },
                    "1": {
                      "text": "yes",
                      "color": "green"
                    }
                  }
                }
              ],
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "red",
                    "value": null
                  },
                  {
                    "color": "green",
                    "value": 1
                  }
                ]
              }
            },
            "overrides": []
          },
          "options": {
            "mergeValues": true,
            "showValue": "never",
            "rowHeight": 0.85,
            "legend": {
              "showLegend": false
            },
            "tooltip": {
              "mode": "single"
            }
          },
          "id": 69,
          "gridPos": {
            "h": 8,
            "w": 8,
            "x": 8,
            "y": 255
          }
        },
        {
          "type": "timeseries",
          "title": "GPU memory chip temperature, per GPU",
          "description": "Temperature of the memory chips, which run hotter than the core on some cards. Only cards that report it.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "label_replace((onprem_ai_gpu_memory_temperature_celsius{inference_node_id=~\"$node\"} > 0) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m]))), \"gpu\", \"$1\", \"gpu_uuid\", \"GPU-(.{8}).*\")",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{display_name}} · {{gpu}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "celsius",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 0,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear",
                "thresholdsStyle": {
                  "mode": "dashed"
                }
              },
              "color": {
                "mode": "palette-classic"
              },
              "thresholds": {
                "mode": "absolute",
                "steps": [
                  {
                    "color": "green",
                    "value": null
                  },
                  {
                    "color": "yellow",
                    "value": 95
                  },
                  {
                    "color": "red",
                    "value": 105
                  }
                ]
              }
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "mean",
                "max"
              ],
              "showLegend": true,
              "sortBy": "Max",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 70,
          "gridPos": {
            "h": 8,
            "w": 8,
            "x": 16,
            "y": 255
          }
        },
        {
          "type": "timeseries",
          "title": "NVLink errors",
          "description": "Errors on the direct links between GPUs, per machine, count per bar. Only cards with NVLink report them. Rising numbers warn of a failing link before it drops.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "interval": "1m",
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "(sum by (inference_node_id) (increase({__name__=~\"onprem_ai_gpu_nvlink_crc_flit_errors_total|onprem_ai_gpu_nvlink_crc_data_errors_total|onprem_ai_gpu_nvlink_replay_errors_total|onprem_ai_gpu_nvlink_recovery_errors_total\", inference_node_id=~\"$node\"}[$__interval]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{display_name}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "short",
              "custom": {
                "drawStyle": "bars",
                "lineWidth": 1,
                "fillOpacity": 10,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "sum"
              ],
              "showLegend": true,
              "sortBy": "Total",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 71,
          "gridPos": {
            "h": 7,
            "w": 12,
            "x": 0,
            "y": 263
          }
        },
        {
          "type": "timeseries",
          "title": "NVLink links active, per machine",
          "description": "Number of working direct links between the GPUs of each machine. It should be a flat line; a step down is a link that failed.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "(sum by (inference_node_id) (onprem_ai_gpu_nvlink_active_links{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{display_name}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "short",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 0,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "lastNotNull"
              ],
              "showLegend": true,
              "sortBy": "Last *",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 72,
          "gridPos": {
            "h": 7,
            "w": 12,
            "x": 12,
            "y": 263
          }
        }
      ],
      "id": 66,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 244
      }
    },
    {
      "type": "row",
      "title": "Machines: the servers the GPUs sit in",
      "collapsed": false,
      "panels": [],
      "id": 73,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 290
      }
    },
    {
      "type": "timeseries",
      "title": "CPU utilization, per machine",
      "description": "Processor load of each server. Preparing prompts, networking and data loading run on the CPU; a busy CPU can hold back idle GPUs.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(onprem_ai_inference_node_cpu_utilization_percent{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percent",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 100
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 74,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 0,
        "y": 291
      }
    },
    {
      "type": "timeseries",
      "title": "Main memory used, per machine",
      "description": "Share of each server's RAM in use (not GPU memory).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(onprem_ai_inference_node_memory_used_bytes{inference_node_id=~\"$node\"} / onprem_ai_inference_node_memory_total_bytes{inference_node_id=~\"$node\"}) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear",
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.85
              },
              {
                "color": "red",
                "value": 0.95
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "mean",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 75,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 8,
        "y": 291
      }
    },
    {
      "type": "timeseries",
      "title": "Disk space used, per machine and disk",
      "description": "Model files are large: a full disk stops deployments and downloads. Above 80% plan a cleanup; above 90% act now.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(onprem_ai_inference_node_filesystem_used_bytes{inference_node_id=~\"$node\"} / (onprem_ai_inference_node_filesystem_total_bytes{inference_node_id=~\"$node\"} > 20e9)) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}} {{device}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "percentunit",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear",
            "thresholdsStyle": {
              "mode": "dashed"
            }
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0,
          "max": 1,
          "thresholds": {
            "mode": "absolute",
            "steps": [
              {
                "color": "green",
                "value": null
              },
              {
                "color": "yellow",
                "value": 0.8
              },
              {
                "color": "red",
                "value": 0.9
              }
            ]
          }
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "lastNotNull"
          ],
          "showLegend": true,
          "sortBy": "Last *",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 76,
      "gridPos": {
        "h": 9,
        "w": 8,
        "x": 16,
        "y": 291
      }
    },
    {
      "type": "timeseries",
      "title": "Error and warning log lines, per machine",
      "description": "How many problems each machine's platform software logs, count per bar; the legend total is the count in the time range. A sudden rise points to the machine to look at first.",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "interval": "1m",
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (inference_node_id, level) (increase(onprem_ai_inference_node_log_records_total{inference_node_id=~\"$node\", level=~\"(?i)error|warn.*|critical|fatal\"}[$__interval]))) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}} {{level}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "bars",
            "lineWidth": 1,
            "fillOpacity": 40,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "normal",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "sum"
          ],
          "showLegend": true,
          "sortBy": "Total",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 77,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 0,
        "y": 300
      }
    },
    {
      "type": "timeseries",
      "title": "Reports waiting to reach the control plane",
      "description": "Events a machine has not delivered yet (model events, update notices, error reports). Should return to zero quickly; a number that only grows means the reporting is stuck (see 'Report delay' at the top).",
      "datasource": {
        "type": "prometheus",
        "uid": "${datasource}"
      },
      "targets": [
        {
          "refId": "A",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "expr": "(sum by (inference_node_id) (onprem_ai_inference_node_event_stream_undelivered_events{inference_node_id=~\"$node\"})) * on(inference_node_id) group_left(display_name) topk by (inference_node_id) (1, group by (inference_node_id, display_name) (last_over_time(onprem_ai_control_plane_inference_node_connected[15m])))",
          "editorMode": "code",
          "range": true,
          "instant": false,
          "legendFormat": "{{display_name}}"
        }
      ],
      "fieldConfig": {
        "defaults": {
          "unit": "short",
          "custom": {
            "drawStyle": "line",
            "lineWidth": 1,
            "fillOpacity": 0,
            "showPoints": "never",
            "spanNulls": false,
            "stacking": {
              "mode": "none",
              "group": "A"
            },
            "lineInterpolation": "linear"
          },
          "color": {
            "mode": "palette-classic"
          },
          "min": 0
        },
        "overrides": []
      },
      "options": {
        "legend": {
          "displayMode": "table",
          "placement": "bottom",
          "calcs": [
            "lastNotNull",
            "max"
          ],
          "showLegend": true,
          "sortBy": "Max",
          "sortDesc": true
        },
        "tooltip": {
          "mode": "multi",
          "sort": "desc"
        }
      },
      "id": 78,
      "gridPos": {
        "h": 9,
        "w": 12,
        "x": 12,
        "y": 300
      }
    },
    {
      "type": "row",
      "title": "Model containers: what each model copy uses on its server (CPU, RAM, network, disk)",
      "collapsed": true,
      "panels": [
        {
          "type": "timeseries",
          "title": "CPU cores used, by model",
          "description": "Processor cores each model's containers keep busy (1.0 = one core fully used).",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id, container_name) (rate(onprem_ai_inference_service_replica_container_cpu_usage_seconds_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__rate_interval]))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} · {{container_name}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "suffix: cores",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 40,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "normal",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "mean",
                "max"
              ],
              "showLegend": true,
              "sortBy": "Max",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 80,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 0,
            "y": 330
          }
        },
        {
          "type": "timeseries",
          "title": "Main memory used, by model",
          "description": "RAM (not GPU memory) each model's containers hold. Dashed: the configured limit, where one is set; a container that reaches it is stopped by the system.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id, container_name) (onprem_ai_inference_service_replica_container_memory_used_bytes{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} · {{container_name}}"
            },
            {
              "refId": "B",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id, container_name) (onprem_ai_inference_service_replica_container_memory_limit_bytes{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} · {{container_name}} limit"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "bytes",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 0,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": [
              {
                "matcher": {
                  "id": "byRegexp",
                  "options": ".* limit"
                },
                "properties": [
                  {
                    "id": "custom.lineStyle",
                    "value": {
                      "fill": "dash",
                      "dash": [
                        6,
                        6
                      ]
                    }
                  },
                  {
                    "id": "color",
                    "value": {
                      "mode": "fixed",
                      "fixedColor": "text"
                    }
                  }
                ]
              }
            ]
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "mean",
                "max"
              ],
              "showLegend": true,
              "sortBy": "Max",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 81,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 8,
            "y": 330
          }
        },
        {
          "type": "timeseries",
          "title": "Out-of-memory stops, by model",
          "description": "Times the system stopped a model's container because it used more memory than allowed, count per bar. Each one interrupts the requests that copy was answering.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "interval": "1m",
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id) (increase(onprem_ai_inference_service_replica_container_oom_kills_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__interval]))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "short",
              "custom": {
                "drawStyle": "bars",
                "lineWidth": 1,
                "fillOpacity": 10,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "sum"
              ],
              "showLegend": true,
              "sortBy": "Total",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 82,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 16,
            "y": 330
          }
        },
        {
          "type": "timeseries",
          "title": "Network traffic, by model",
          "description": "Bytes per second in (requests, model downloads) and out (answers) of each model's containers.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id) (rate(onprem_ai_inference_service_replica_container_network_receive_bytes_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__rate_interval]))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} in"
            },
            {
              "refId": "B",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id) (rate(onprem_ai_inference_service_replica_container_network_transmit_bytes_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__rate_interval]))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} out"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "Bps",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 0,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "mean",
                "max"
              ],
              "showLegend": true,
              "sortBy": "Max",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 83,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 0,
            "y": 339
          }
        },
        {
          "type": "timeseries",
          "title": "Disk traffic, by model",
          "description": "Bytes per second each model's containers read and write. Heavy reading while a model starts is its files loading.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id) (rate(onprem_ai_inference_service_replica_container_disk_read_bytes_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__rate_interval]))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} read"
            },
            {
              "refId": "B",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "sum by (routing_model_id) (rate(onprem_ai_inference_service_replica_container_disk_written_bytes_total{routing_model_id=~\"$model\", inference_node_id=~\"$node\"}[$__rate_interval]))",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}} written"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "Bps",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 0,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "mean",
                "max"
              ],
              "showLegend": true,
              "sortBy": "Max",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 84,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 8,
            "y": 339
          }
        },
        {
          "type": "timeseries",
          "title": "Health check response time, by model",
          "description": "How long each model copy takes to answer the machine's own 'are you alive' check. Rising values mean the engine is overloaded or stuck.",
          "datasource": {
            "type": "prometheus",
            "uid": "${datasource}"
          },
          "targets": [
            {
              "refId": "A",
              "datasource": {
                "type": "prometheus",
                "uid": "${datasource}"
              },
              "expr": "max by (routing_model_id) (onprem_ai_inference_service_replica_health_check_duration_seconds{routing_model_id=~\"$model\", inference_node_id=~\"$node\"})",
              "editorMode": "code",
              "range": true,
              "instant": false,
              "legendFormat": "{{routing_model_id}}"
            }
          ],
          "fieldConfig": {
            "defaults": {
              "unit": "s",
              "custom": {
                "drawStyle": "line",
                "lineWidth": 1,
                "fillOpacity": 0,
                "showPoints": "never",
                "spanNulls": false,
                "stacking": {
                  "mode": "none",
                  "group": "A"
                },
                "lineInterpolation": "linear"
              },
              "color": {
                "mode": "palette-classic"
              },
              "min": 0
            },
            "overrides": []
          },
          "options": {
            "legend": {
              "displayMode": "table",
              "placement": "bottom",
              "calcs": [
                "mean",
                "max"
              ],
              "showLegend": true,
              "sortBy": "Max",
              "sortDesc": true
            },
            "tooltip": {
              "mode": "multi",
              "sort": "desc"
            }
          },
          "id": 85,
          "gridPos": {
            "h": 9,
            "w": 8,
            "x": 16,
            "y": 339
          }
        }
      ],
      "id": 79,
      "gridPos": {
        "h": 1,
        "w": 24,
        "x": 0,
        "y": 329
      }
    }
  ]
}
