From b7e377c57e780f70b4a2d4ca31212eaa8b73c47c Mon Sep 17 00:00:00 2001 From: David Martin Date: Fri, 29 Sep 2023 10:21:27 +0100 Subject: [PATCH] checkpoint --- README.md | 17 + .../examples/dashboards/gatewayclasses.json | 27 +- .../examples/dashboards/gatewayclasses.yaml | 2 +- config/examples/dashboards/gateways.json | 1332 ++++++++++++++ config/examples/dashboards/gateways.yaml | 2 +- config/examples/dashboards/httproutes.json | 1621 +++++++---------- config/examples/dashboards/httproutes.yaml | 10 + hack/local_dev.sh | 68 + src/dashboards/README.md | 142 -- src/dashboards/gatewayclasses.jsonnet | 24 +- src/dashboards/gateways.jsonnet | 359 +++- src/dashboards/httproutes.jsonnet | 291 +++ src/dashboards/lib/gwapi/gwapi.libsonnet | 68 +- 13 files changed, 2820 insertions(+), 1143 deletions(-) create mode 100644 config/examples/dashboards/httproutes.yaml create mode 100755 hack/local_dev.sh delete mode 100644 src/dashboards/README.md create mode 100644 src/dashboards/httproutes.jsonnet diff --git a/README.md b/README.md index a8e243e..a379af4 100644 --- a/README.md +++ b/README.md @@ -412,6 +412,23 @@ gatewayapi_udproute_parent_info{name="",namespace="",p gatewayapi_udproute_status_parent_info{name="",namespace="",parent_group="",parent_kind="",parent_name="",parent_namespace=""} ``` +## Local dashboard development + +Dashboards are written in jsonnet, and use the [grafonnet library](https://github.com/grafana/grafonnet). +Resulting dashboard json files are checked in. +To generate dashboards, run `make generate-dashboards`. + +Local development can be done using a combination of automatic jsonnet execution +and using the [grafana-operator](https://github.com/grafana-operator/grafana-operator) +to automatically update dashboards in Grafana. This allows for a relatviely fast +development loop where you can change a dashboard jsonnet file, save it, then +see the changes automically in a browser. + +To set up the local development environment, run the following: +```shell +./hack/local_dev.sh +``` + ## Contributing Contributions are welcome in the form of bugs, feature requests & pull requests. diff --git a/config/examples/dashboards/gatewayclasses.json b/config/examples/dashboards/gatewayclasses.json index 1813422..25f71d3 100644 --- a/config/examples/dashboards/gatewayclasses.json +++ b/config/examples/dashboards/gatewayclasses.json @@ -304,17 +304,6 @@ ], "title": "Supported Features (by GatewayClass)", "transformations": [ - { - "id": "reduce", - "options": { - "includeTimeField": false, - "labelsToFields": true, - "mode": "seriesToRows", - "reducers": [ - "last" - ] - } - }, { "id": "filterFieldsByName", "options": { @@ -371,6 +360,22 @@ "name": "datasource", "query": "prometheus", "type": "datasource" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "GatewayClass", + "multi": true, + "name": "gatewayclass", + "query": { + "query": "label_values(gatewayapi_gatewayclass_info, name)", + "refId": "StandardVariableQuery" + }, + "regex": "", + "type": "query" } ] }, diff --git a/config/examples/dashboards/gatewayclasses.yaml b/config/examples/dashboards/gatewayclasses.yaml index f194f92..722bf2b 100644 --- a/config/examples/dashboards/gatewayclasses.yaml +++ b/config/examples/dashboards/gatewayclasses.yaml @@ -7,4 +7,4 @@ spec: matchLabels: dashboards: "grafana" json: > - {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"Gateway Classes","type":"row"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of GatewayClasses across all clusters","gridPos":{"h":3,"w":2,"x":0,"y":1},"id":2,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gatewayclass_info)","instant":true}],"title":"Total","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total GatewayClasses with an Accepted state of True","gridPos":{"h":3,"w":2,"x":2,"y":1},"id":3,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gatewayclass_status{type=\"Accepted\"} > 0)","instant":true}],"title":"Accepted","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":1},"id":4,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gatewayclass_created","format":"table","instant":true,"range":false}],"title":"GatewayClasses","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","Value"]}}},{"id":"calculateField","options":{"alias":"Created At","binary":{"left":"Value","operator":"*","reducer":"sum","right":"1000"},"mode":"binary","reduce":{"reducer":"sum"},"replaceFields":false}},{"id":"organize","options":{"excludeByName":{"Value":true,"customresource_kind":true},"indexByName":{},"renameByName":{"Value":"Created","customresource_kind":"Kind","customresource_version":"Version","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"links","value":[{"title":"Gateway Details","url":"/d/gatewayapigateways/gateway-api-state-gateways?var-gateway=${__value.text}"}]},{"id":"custom.displayMode","value":"color-text"}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":1},"id":5,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_info","format":"table","instant":true,"range":false}],"title":"Gateways (by GatewayClass)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["gatewayclass_name","name","namespace"]}}},{"id":"organize","options":{"excludeByName":{"Value":false,"customresource_kind":true},"indexByName":{"Value":3,"gatewayclass_name":2,"name":0,"namespace":1},"renameByName":{"Value":"# Instances","customresource_kind":"Kind","customresource_version":"Version","gatewayclass_name":"GatewayClass","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"name"},"properties":[{"id":"custom.width","value":333}]}]},"gridPos":{"h":6,"w":20,"x":4,"y":7},"id":6,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gatewayclass_status_supported_features{name=\"$gatewayclass\"}","format":"table","instant":true,"range":false}],"title":"Supported Features (by GatewayClass)","transformations":[{"id":"reduce","options":{"includeTimeField":false,"labelsToFields":true,"mode":"seriesToRows","reducers":["last"]}},{"id":"filterFieldsByName","options":{"include":{"names":["features","name"]}}},{"id":"groupBy","options":{"fields":{"features":{"aggregations":["allValues"],"operation":"aggregate"},"name":{"aggregations":[],"operation":"groupby"}}}},{"id":"organize","options":{"excludeByName":{},"indexByName":{},"renameByName":{"features (allValues)":"Features","name":"GatewayClass"}}}],"type":"table"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / GatewayClasses","uid":"gatewayapigatewayclass"} + {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"Gateway Classes","type":"row"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of GatewayClasses across all clusters","gridPos":{"h":3,"w":2,"x":0,"y":1},"id":2,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gatewayclass_info)","instant":true}],"title":"Total","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total GatewayClasses with an Accepted state of True","gridPos":{"h":3,"w":2,"x":2,"y":1},"id":3,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gatewayclass_status{type=\"Accepted\"} > 0)","instant":true}],"title":"Accepted","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":1},"id":4,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gatewayclass_created","format":"table","instant":true,"range":false}],"title":"GatewayClasses","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","Value"]}}},{"id":"calculateField","options":{"alias":"Created At","binary":{"left":"Value","operator":"*","reducer":"sum","right":"1000"},"mode":"binary","reduce":{"reducer":"sum"},"replaceFields":false}},{"id":"organize","options":{"excludeByName":{"Value":true,"customresource_kind":true},"indexByName":{},"renameByName":{"Value":"Created","customresource_kind":"Kind","customresource_version":"Version","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"links","value":[{"title":"Gateway Details","url":"/d/gatewayapigateways/gateway-api-state-gateways?var-gateway=${__value.text}"}]},{"id":"custom.displayMode","value":"color-text"}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":1},"id":5,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_info","format":"table","instant":true,"range":false}],"title":"Gateways (by GatewayClass)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["gatewayclass_name","name","namespace"]}}},{"id":"organize","options":{"excludeByName":{"Value":false,"customresource_kind":true},"indexByName":{"Value":3,"gatewayclass_name":2,"name":0,"namespace":1},"renameByName":{"Value":"# Instances","customresource_kind":"Kind","customresource_version":"Version","gatewayclass_name":"GatewayClass","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"name"},"properties":[{"id":"custom.width","value":333}]}]},"gridPos":{"h":6,"w":20,"x":4,"y":7},"id":6,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gatewayclass_status_supported_features{name=\"$gatewayclass\"}","format":"table","instant":true,"range":false}],"title":"Supported Features (by GatewayClass)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["features","name"]}}},{"id":"groupBy","options":{"fields":{"features":{"aggregations":["allValues"],"operation":"aggregate"},"name":{"aggregations":[],"operation":"groupby"}}}},{"id":"organize","options":{"excludeByName":{},"indexByName":{},"renameByName":{"features (allValues)":"Features","name":"GatewayClass"}}}],"type":"table"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"},{"datasource":{"type":"prometheus","uid":"${datasource}"},"includeAll":true,"label":"GatewayClass","multi":true,"name":"gatewayclass","query":{"query":"label_values(gatewayapi_gatewayclass_info, name)","refId":"StandardVariableQuery"},"regex":"","type":"query"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / GatewayClasses","uid":"gatewayapigatewayclass"} diff --git a/config/examples/dashboards/gateways.json b/config/examples/dashboards/gateways.json index 78803fc..2d7db41 100644 --- a/config/examples/dashboards/gateways.json +++ b/config/examples/dashboards/gateways.json @@ -24,6 +24,1322 @@ "id": 1, "title": "Gateways", "type": "row" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "description": "Total number of Gateways across all namespaces", + "gridPos": { + "h": 3, + "w": 2, + "x": 0, + "y": 1 + }, + "id": 2, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_gateway_info{name=~\"$gateway\"})", + "instant": true + } + ], + "title": "Total", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "description": "Number of Gateways not in an Accepted and Programmed state", + "gridPos": { + "h": 3, + "w": 2, + "x": 2, + "y": 1 + }, + "id": 3, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count((gatewayapi_gateway_status{name=~\"$gateway\",type=\"Accepted\"} == 0) or (gatewayapi_gateway_status{name=~\"$gateway\",type=\"Programmed\"} == 0)) or vector(0)", + "instant": true + } + ], + "title": "Unhealthy", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "108" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Version" + }, + "properties": [ + { + "id": "custom.width", + "value": "98" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "125" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 1 + }, + "id": 4, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_gateway_created{name=~\"$gateway\"} * on(name, namespace, instance) group_right gatewayapi_gateway_info{name=~\"$gateway\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "Gateways", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "gatewayclass_name", + "name", + "namespace", + "Value" + ] + } + } + }, + { + "id": "calculateField", + "options": { + "alias": "Created At", + "binary": { + "left": "Value", + "operator": "*", + "reducer": "sum", + "right": "1000" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + }, + "replaceFields": false + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": true, + "customresource_kind": true + }, + "indexByName": { }, + "renameByName": { + "Value": "Created", + "customresource_kind": "Kind", + "customresource_version": "Version", + "gatewayclass_name": "GatewayClass", + "name": "Name", + "namespace": "Namespace" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "108" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Version" + }, + "properties": [ + { + "id": "custom.width", + "value": "94" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Listener Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "112" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hostname" + }, + "properties": [ + { + "id": "custom.width", + "value": "163" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Port" + }, + "properties": [ + { + "id": "custom.width", + "value": "59" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Protocol" + }, + "properties": [ + { + "id": "custom.width", + "value": "77" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "91" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 14, + "y": 1 + }, + "id": 5, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_gateway_listener_info{name=~\"$gateway\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "Gateway Listeners", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "hostname", + "listener_name", + "name", + "namespace", + "port", + "protocol", + "tls_mode", + "Value" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": true + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "description": "Total Gateways with an Accepted state of True", + "gridPos": { + "h": 3, + "w": 2, + "x": 0, + "y": 4 + }, + "id": 6, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_gateway_status{name=~\"$gateway\",type=\"Accepted\"} > 0)", + "instant": true + } + ], + "title": "Accepted", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "description": "Total Gateways with a Programmed state of True", + "gridPos": { + "h": 3, + "w": 2, + "x": 2, + "y": 4 + }, + "id": 7, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_gateway_status{name=~\"$gateway\",type=\"Programmed\"} > 0)", + "instant": true + } + ], + "title": "Programmed", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "description": "Total number of listeners across all Gateways", + "gridPos": { + "h": 3, + "w": 2, + "x": 0, + "y": 7 + }, + "id": 8, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_gateway_listener_info{name=~\"$gateway\"})", + "instant": true + } + ], + "title": "Listeners", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "description": "Total number of attached routes across all listeners", + "gridPos": { + "h": 3, + "w": 2, + "x": 2, + "y": 7 + }, + "id": 9, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "sum(gatewayapi_gateway_status_listener_attached_routes{name=~\"$gateway\"})", + "instant": true + } + ], + "title": "Att. Routes", + "type": "stat" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "108" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Version" + }, + "properties": [ + { + "id": "custom.width", + "value": "94" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Listener Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "119" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hostname" + }, + "properties": [ + { + "id": "custom.width", + "value": "163" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Port" + }, + "properties": [ + { + "id": "custom.width", + "value": "59" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Protocol" + }, + "properties": [ + { + "id": "custom.width", + "value": "104" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "136" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 7 + }, + "id": 10, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_gateway_status_address_info{name=~\"$gateway\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "Gateway Status Addresses", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "name", + "namespace", + "type", + "value" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": true + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode", + "type": "Address Type", + "value": "Address Value" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "113" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Version" + }, + "properties": [ + { + "id": "custom.width", + "value": "88" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "167" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Listener Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "167" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "# Attached Routes" + }, + "properties": [ + { + "id": "custom.width", + "value": "137" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 14, + "y": 7 + }, + "id": 11, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_gateway_status_listener_attached_routes{name=~\"$gateway\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "Gateway Listener Status - Attached Routes", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "listener_name", + "name", + "namespace", + "Value" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": false + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "# Attached Routes", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-text" + }, + { + "id": "links", + "value": [ + { + "title": "HTTPRoute Details", + "url": "/d/gatewayapihttproutes/gateway-api-state-httproutes?var-httproute=${__value.text}" + } + ] + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 13 + }, + "id": 12, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_httproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "HTTPRoutes (by Gateway)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "name", + "namespace", + "parent_name" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": false + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "# Attached Routes", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "", + "parent_name": "Gateway", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-text" + }, + { + "id": "links", + "value": [ + { + "title": "GRPCRoute Details", + "url": "/d/gatewayapigrpcroutes/gateway-api-state-grpcroutes?var-grpcroute=${__value.text}" + } + ] + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 14, + "y": 13 + }, + "id": 13, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_grpcroute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "GRPCRoutes (by Gateway)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "name", + "namespace", + "parent_name" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": false + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "# Attached Routes", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "", + "parent_name": "Gateway", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-text" + }, + { + "id": "links", + "value": [ + { + "title": "TLSRoute Details", + "url": "/d/gatewayapitlsroutes/gateway-api-state-tlsroutes?var-tlsroute=${__value.text}" + } + ] + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 19 + }, + "id": 14, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_tlsroute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "TLSRoutes (by Gateway)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "name", + "namespace", + "parent_name" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": false + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "# Attached Routes", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "", + "parent_name": "Gateway", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-text" + }, + { + "id": "links", + "value": [ + { + "title": "TCPRoute Details", + "url": "/d/gatewayapitcproutes/gateway-api-state-tcproutes?var-tcproute=${__value.text}" + } + ] + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 14, + "y": 19 + }, + "id": 15, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_tcproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "TCPRoutes (by Gateway)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "name", + "namespace", + "parent_name" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": false + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "# Attached Routes", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "", + "parent_name": "Gateway", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" + }, + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.displayMode", + "value": "color-text" + }, + { + "id": "links", + "value": [ + { + "title": "UDPRoute Details", + "url": "/d/gatewayapiudproutes/gateway-api-state-udproutes?var-udproute=${__value.text}" + } + ] + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 25 + }, + "id": 16, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_udproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}", + "format": "table", + "instant": true, + "range": false + } + ], + "title": "UDPRoutes (by Gateway)", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "name", + "namespace", + "parent_name" + ] + } + } + }, + { + "id": "organize", + "options": { + "excludeByName": { + "Value": false + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "# Attached Routes", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "", + "parent_name": "Gateway", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode" + } + } + } + ], + "type": "table" } ], "schemaVersion": 36, @@ -39,6 +1355,22 @@ "name": "datasource", "query": "prometheus", "type": "datasource" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "Gateway", + "multi": true, + "name": "gateway", + "query": { + "query": "label_values(gatewayapi_gateway_info, name)", + "refId": "StandardVariableQuery" + }, + "regex": "/(.*)/", + "type": "query" } ] }, diff --git a/config/examples/dashboards/gateways.yaml b/config/examples/dashboards/gateways.yaml index a6e2131..0a9880b 100644 --- a/config/examples/dashboards/gateways.yaml +++ b/config/examples/dashboards/gateways.yaml @@ -7,4 +7,4 @@ spec: matchLabels: dashboards: "grafana" json: > - {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"Gateways","type":"row"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / Gateways","uid":"gatewayapigateways"} + {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"Gateways","type":"row"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of Gateways across all namespaces","gridPos":{"h":3,"w":2,"x":0,"y":1},"id":2,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gateway_info{name=~\"$gateway\"})","instant":true}],"title":"Total","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Number of Gateways not in an Accepted and Programmed state","gridPos":{"h":3,"w":2,"x":2,"y":1},"id":3,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count((gatewayapi_gateway_status{name=~\"$gateway\",type=\"Accepted\"} == 0) or (gatewayapi_gateway_status{name=~\"$gateway\",type=\"Programmed\"} == 0)) or vector(0)","instant":true}],"title":"Unhealthy","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]},{"matcher":{"id":"byName","options":"Kind"},"properties":[{"id":"custom.width","value":"108"}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":"98"}]},{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.width","value":"125"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":1},"id":4,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_created{name=~\"$gateway\"} * on(name, namespace, instance) group_right gatewayapi_gateway_info{name=~\"$gateway\"}","format":"table","instant":true,"range":false}],"title":"Gateways","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","gatewayclass_name","name","namespace","Value"]}}},{"id":"calculateField","options":{"alias":"Created At","binary":{"left":"Value","operator":"*","reducer":"sum","right":"1000"},"mode":"binary","reduce":{"reducer":"sum"},"replaceFields":false}},{"id":"organize","options":{"excludeByName":{"Value":true,"customresource_kind":true},"indexByName":{},"renameByName":{"Value":"Created","customresource_kind":"Kind","customresource_version":"Version","gatewayclass_name":"GatewayClass","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]},{"matcher":{"id":"byName","options":"Kind"},"properties":[{"id":"custom.width","value":"108"}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":"94"}]},{"matcher":{"id":"byName","options":"Listener Name"},"properties":[{"id":"custom.width","value":"112"}]},{"matcher":{"id":"byName","options":"Hostname"},"properties":[{"id":"custom.width","value":"163"}]},{"matcher":{"id":"byName","options":"Port"},"properties":[{"id":"custom.width","value":"59"}]},{"matcher":{"id":"byName","options":"Protocol"},"properties":[{"id":"custom.width","value":"77"}]},{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.width","value":"91"}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":1},"id":5,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_listener_info{name=~\"$gateway\"}","format":"table","instant":true,"range":false}],"title":"Gateway Listeners","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","hostname","listener_name","name","namespace","port","protocol","tls_mode","Value"]}}},{"id":"organize","options":{"excludeByName":{"Value":true},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total Gateways with an Accepted state of True","gridPos":{"h":3,"w":2,"x":0,"y":4},"id":6,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gateway_status{name=~\"$gateway\",type=\"Accepted\"} > 0)","instant":true}],"title":"Accepted","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total Gateways with a Programmed state of True","gridPos":{"h":3,"w":2,"x":2,"y":4},"id":7,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gateway_status{name=~\"$gateway\",type=\"Programmed\"} > 0)","instant":true}],"title":"Programmed","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of listeners across all Gateways","gridPos":{"h":3,"w":2,"x":0,"y":7},"id":8,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_gateway_listener_info{name=~\"$gateway\"})","instant":true}],"title":"Listeners","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of attached routes across all listeners","gridPos":{"h":3,"w":2,"x":2,"y":7},"id":9,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"sum(gatewayapi_gateway_status_listener_attached_routes{name=~\"$gateway\"})","instant":true}],"title":"Att. Routes","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]},{"matcher":{"id":"byName","options":"Kind"},"properties":[{"id":"custom.width","value":"108"}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":"94"}]},{"matcher":{"id":"byName","options":"Listener Name"},"properties":[{"id":"custom.width","value":"119"}]},{"matcher":{"id":"byName","options":"Hostname"},"properties":[{"id":"custom.width","value":"163"}]},{"matcher":{"id":"byName","options":"Port"},"properties":[{"id":"custom.width","value":"59"}]},{"matcher":{"id":"byName","options":"Protocol"},"properties":[{"id":"custom.width","value":"104"}]},{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.width","value":"136"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":7},"id":10,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_status_address_info{name=~\"$gateway\"}","format":"table","instant":true,"range":false}],"title":"Gateway Status Addresses","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","namespace","type","value"]}}},{"id":"organize","options":{"excludeByName":{"Value":true},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode","type":"Address Type","value":"Address Value"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]},{"matcher":{"id":"byName","options":"Kind"},"properties":[{"id":"custom.width","value":"113"}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":"88"}]},{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.width","value":"167"}]},{"matcher":{"id":"byName","options":"Listener Name"},"properties":[{"id":"custom.width","value":"167"}]},{"matcher":{"id":"byName","options":"# Attached Routes"},"properties":[{"id":"custom.width","value":"137"}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":7},"id":11,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_gateway_status_listener_attached_routes{name=~\"$gateway\"}","format":"table","instant":true,"range":false}],"title":"Gateway Listener Status - Attached Routes","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","listener_name","name","namespace","Value"]}}},{"id":"organize","options":{"excludeByName":{"Value":false},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"# Attached Routes","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.displayMode","value":"color-text"},{"id":"links","value":[{"title":"HTTPRoute Details","url":"/d/gatewayapihttproutes/gateway-api-state-httproutes?var-httproute=${__value.text}"}]}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":13},"id":12,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_httproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}","format":"table","instant":true,"range":false}],"title":"HTTPRoutes (by Gateway)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["name","namespace","parent_name"]}}},{"id":"organize","options":{"excludeByName":{"Value":false},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"# Attached Routes","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"","parent_name":"Gateway","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.displayMode","value":"color-text"},{"id":"links","value":[{"title":"GRPCRoute Details","url":"/d/gatewayapigrpcroutes/gateway-api-state-grpcroutes?var-grpcroute=${__value.text}"}]}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":13},"id":13,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_grpcroute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}","format":"table","instant":true,"range":false}],"title":"GRPCRoutes (by Gateway)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["name","namespace","parent_name"]}}},{"id":"organize","options":{"excludeByName":{"Value":false},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"# Attached Routes","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"","parent_name":"Gateway","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.displayMode","value":"color-text"},{"id":"links","value":[{"title":"TLSRoute Details","url":"/d/gatewayapitlsroutes/gateway-api-state-tlsroutes?var-tlsroute=${__value.text}"}]}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":19},"id":14,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_tlsroute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}","format":"table","instant":true,"range":false}],"title":"TLSRoutes (by Gateway)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["name","namespace","parent_name"]}}},{"id":"organize","options":{"excludeByName":{"Value":false},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"# Attached Routes","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"","parent_name":"Gateway","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.displayMode","value":"color-text"},{"id":"links","value":[{"title":"TCPRoute Details","url":"/d/gatewayapitcproutes/gateway-api-state-tcproutes?var-tcproute=${__value.text}"}]}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":19},"id":15,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_tcproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}","format":"table","instant":true,"range":false}],"title":"TCPRoutes (by Gateway)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["name","namespace","parent_name"]}}},{"id":"organize","options":{"excludeByName":{"Value":false},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"# Attached Routes","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"","parent_name":"Gateway","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.displayMode","value":"color-text"},{"id":"links","value":[{"title":"UDPRoute Details","url":"/d/gatewayapiudproutes/gateway-api-state-udproutes?var-udproute=${__value.text}"}]}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":25},"id":16,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_udproute_parent_info{parent_kind=\"Gateway\",parent_name=~\"${gateway}\"}","format":"table","instant":true,"range":false}],"title":"UDPRoutes (by Gateway)","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["name","namespace","parent_name"]}}},{"id":"organize","options":{"excludeByName":{"Value":false},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"# Attached Routes","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"","parent_name":"Gateway","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode"}}}],"type":"table"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"},{"datasource":{"type":"prometheus","uid":"${datasource}"},"includeAll":true,"label":"Gateway","multi":true,"name":"gateway","query":{"query":"label_values(gatewayapi_gateway_info, name)","refId":"StandardVariableQuery"},"regex":"/(.*)/","type":"query"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / Gateways","uid":"gatewayapigateways"} diff --git a/config/examples/dashboards/httproutes.json b/config/examples/dashboards/httproutes.json index 5104ded..1661645 100644 --- a/config/examples/dashboards/httproutes.json +++ b/config/examples/dashboards/httproutes.json @@ -1,1004 +1,679 @@ { - "__inputs": [], - "__elements": [], - "__requires": [ - { - "type": "grafana", - "id": "grafana", - "name": "Grafana", - "version": "8.5.5" - }, - { - "type": "datasource", - "id": "prometheus", - "name": "Prometheus", - "version": "1.0.0" - }, - { - "type": "panel", - "id": "stat", - "name": "Stat", - "version": "" - }, - { - "type": "panel", - "id": "table", - "name": "Table", - "version": "" - } - ], - "annotations": { - "list": [ + "editable": false, + "links": [ { - "builtIn": 1, - "datasource": { - "type": "grafana", - "uid": "-- Grafana --" - }, - "enable": true, - "hide": true, - "iconColor": "rgba(0, 211, 255, 1)", - "name": "Annotations & Alerts", - "target": { - "limit": 100, - "matchAny": false, - "tags": [], - "type": "dashboard" - }, - "type": "dashboard" - }, - {} - ] - }, - "editable": true, - "fiscalYearStartMonth": 0, - "graphTooltip": 0, - "id": null, - "iteration": 1692886893094, - "links": [ - { - "asDropdown": false, - "icon": "dashboard", - "includeVars": true, - "keepTime": true, - "tags": [ - "gateway-api-state" - ], - "targetBlank": false, - "title": "Gateway Dashboards", - "tooltip": "", - "type": "dashboards", - "url": "" - } - ], - "liveNow": false, - "panels": [ - { - "collapsed": false, - "gridPos": { - "h": 1, - "w": 24, - "x": 0, - "y": 0 - }, - "id": 18, - "panels": [], - "title": "HTTPRoutes", - "type": "row" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total number of HTTPRoutes across all namespaces", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 0, - "y": 1 - }, - "id": 27, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" + "asDropdown": false, + "includeVars": true, + "keepTime": true, + "tags": [ + "gateway-api-state" + ], + "targetBlank": false, + "title": "Gateway Dashboards", + "type": "dashboards" + } + ], + "panels": [ + { + "gridPos": { + "h": 1, + "w": 24, + "x": 0, + "y": 0 + }, + "id": 1, + "title": "HTTPRoutes", + "type": "row" }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { + { + "datasource": { "type": "prometheus", "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_httproute_created{name=~\"${httproute}\"})", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Total", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total number of parents (e.g. Gateways) targeted by HTTPRoutes", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] - }, - "gridPos": { - "h": 3, - "w": 2, - "x": 2, - "y": 1 - }, - "id": 28, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" + }, + "description": "Total number of HTTPRoutes across all namespaces", + "gridPos": { + "h": 3, + "w": 2, + "x": 0, + "y": 1 + }, + "id": 2, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_httproute_created{name=~\"${httproute}\"})", + "instant": true + } + ], + "title": "Total", + "type": "stat" }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { + { + "datasource": { "type": "prometheus", "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_httproute_parent_info{name=~\"${httproute}\"})", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Tar. Parents", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 1 - }, - "id": 3, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true + }, + "description": "Total number of parents (e.g. Gateways) targeted by HTTPRoutes", + "gridPos": { + "h": 3, + "w": 2, + "x": 2, + "y": 1 + }, + "id": 3, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_httproute_parent_info{name=~\"${httproute}\"})", + "instant": true + } + ], + "title": "Tar. Parents", + "type": "stat" }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { + { + "datasource": { "type": "prometheus", "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_httproute_created{name=~\"${httproute}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "HTTPRoutes", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "name", - "namespace", - "Value" - ] + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 1 + }, + "id": 4, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_httproute_created{name=~\"${httproute}\"}", + "format": "table", + "instant": true, + "range": false } - } - }, - { - "id": "calculateField", - "options": { - "alias": "Created At", - "binary": { - "left": "Value", - "operator": "*", - "reducer": "sum", - "right": "1000" + ], + "title": "HTTPRoutes", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "name", + "namespace", + "Value" + ] + } + } }, - "mode": "binary", - "reduce": { - "reducer": "sum" + { + "id": "calculateField", + "options": { + "alias": "Created At", + "binary": { + "left": "Value", + "operator": "*", + "reducer": "sum", + "right": "1000" + }, + "mode": "binary", + "reduce": { + "reducer": "sum" + }, + "replaceFields": false + } }, - "replaceFields": false - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": true - }, - "indexByName": {}, - "renameByName": { - "Value": "Created", - "customresource_kind": "Kind", - "customresource_version": "Version", - "name": "Name", - "namespace": "Namespace" + { + "id": "organize", + "options": { + "excludeByName": { + "Value": true + }, + "indexByName": { }, + "renameByName": { + "Value": "Created", + "customresource_kind": "Kind", + "customresource_version": "Version", + "name": "Name", + "namespace": "Namespace" + } + } } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 108 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Version" - }, - "properties": [ - { - "id": "custom.width", - "value": 85 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Listener Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 119 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Hostname" - }, - "properties": [ - { - "id": "custom.width", - "value": 163 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Port" - }, - "properties": [ - { - "id": "custom.width", - "value": 59 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Protocol" - }, - "properties": [ - { - "id": "custom.width", - "value": 104 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 98 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Parent Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 103 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Parent Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 118 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Namespace" - }, - "properties": [ - { - "id": "custom.width", - "value": 124 - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 14, - "y": 1 + ], + "type": "table" }, - "id": 11, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { + { + "datasource": { "type": "prometheus", "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_httproute_parent_info{name=~\"${httproute}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "HTTPRoute *targeted* Parent References", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "name", - "namespace", - "parent_kind", - "parent_name", - "parent_namespace" - ] + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "108" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Version" + }, + "properties": [ + { + "id": "custom.width", + "value": "85" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Listener Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "119" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hostname" + }, + "properties": [ + { + "id": "custom.width", + "value": "163" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Port" + }, + "properties": [ + { + "id": "custom.width", + "value": "59" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Protocol" + }, + "properties": [ + { + "id": "custom.width", + "value": "104" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "98" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Parent Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "103" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Parent Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "118" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Namespace" + }, + "properties": [ + { + "id": "custom.width", + "value": "124" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 14, + "y": 1 + }, + "id": 5, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_httproute_parent_info{name=~\"${httproute}\"}", + "format": "table", + "instant": true, + "range": false } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": true + ], + "title": "HTTPRoute *targeted* Parent References", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "name", + "namespace", + "parent_kind", + "parent_name", + "parent_namespace" + ] + } + } }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 - }, - "renameByName": { - "Value": "", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "Parent Kind", - "parent_name": "Parent Name", - "parent_namespace": "Parent Namespace", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode", - "type": "Address Type", - "value": "Address Value" + { + "id": "organize", + "options": { + "excludeByName": { + "Value": true + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "Parent Kind", + "parent_name": "Parent Name", + "parent_namespace": "Parent Namespace", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode", + "type": "Address Type", + "value": "Address Value" + } + } } - } - } - ], - "type": "table" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "Total number of parents (e.g. Gateways) attached to HTTPRoutes", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - } - }, - "overrides": [] + ], + "type": "table" }, - "gridPos": { - "h": 3, - "w": 2, - "x": 0, - "y": 4 - }, - "id": 29, - "options": { - "colorMode": "value", - "graphMode": "area", - "justifyMode": "auto", - "orientation": "auto", - "reduceOptions": { - "calcs": [ - "lastNotNull" - ], - "fields": "", - "values": false - }, - "textMode": "auto" - }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { + { + "datasource": { "type": "prometheus", "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "count(gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"})", - "instant": true, - "range": false, - "refId": "A" - } - ], - "title": "Att. Parents", - "type": "stat" - }, - { - "datasource": { - "type": "prometheus", - "uid": "$datasource" - }, - "description": "", - "fieldConfig": { - "defaults": { - "color": { - "mode": "thresholds" - }, - "custom": { - "align": "auto", - "displayMode": "auto", - "inspect": false - }, - "mappings": [], - "thresholds": { - "mode": "absolute", - "steps": [ - { - "color": "green", - "value": null - }, - { - "color": "red", - "value": 80 - } - ] - }, - "unit": "none" - }, - "overrides": [ - { - "matcher": { - "id": "byName", - "options": "Created At" - }, - "properties": [ - { - "id": "unit", - "value": "dateTimeAsIso" - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 108 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Version" - }, - "properties": [ - { - "id": "custom.width", - "value": 85 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Listener Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 119 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Hostname" - }, - "properties": [ - { - "id": "custom.width", - "value": 163 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Port" - }, - "properties": [ - { - "id": "custom.width", - "value": 59 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Protocol" - }, - "properties": [ - { - "id": "custom.width", - "value": 104 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 98 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Parent Kind" - }, - "properties": [ - { - "id": "custom.width", - "value": 103 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Parent Name" - }, - "properties": [ - { - "id": "custom.width", - "value": 118 - } - ] - }, - { - "matcher": { - "id": "byName", - "options": "Namespace" - }, - "properties": [ - { - "id": "custom.width", - "value": 124 - } - ] - } - ] - }, - "gridPos": { - "h": 6, - "w": 10, - "x": 4, - "y": 7 - }, - "id": 12, - "options": { - "footer": { - "fields": "", - "reducer": [ - "sum" - ], - "show": false - }, - "showHeader": true, - "sortBy": [] + }, + "description": "Total number of parents (e.g. Gateways) attached to HTTPRoutes", + "gridPos": { + "h": 3, + "w": 2, + "x": 0, + "y": 4 + }, + "id": 6, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "count(gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"})", + "instant": true + } + ], + "title": "Att. Parents", + "type": "stat" }, - "pluginVersion": "8.5.5", - "targets": [ - { - "datasource": { + { + "datasource": { "type": "prometheus", "uid": "$datasource" - }, - "editorMode": "code", - "exemplar": false, - "expr": "gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"}", - "format": "table", - "instant": true, - "legendFormat": "", - "range": false, - "refId": "A" - } - ], - "title": "HTTPRoute *attached* Parent References", - "transformations": [ - { - "id": "filterFieldsByName", - "options": { - "include": { - "names": [ - "customresource_version", - "name", - "namespace", - "parent_kind", - "parent_name", - "parent_namespace" - ] + }, + "fieldConfig": { + "overrides": [ + { + "matcher": { + "id": "byName", + "options": "Created At" + }, + "properties": [ + { + "id": "unit", + "value": "dateTimeAsIso" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "108" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Version" + }, + "properties": [ + { + "id": "custom.width", + "value": "85" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Listener Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "119" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Hostname" + }, + "properties": [ + { + "id": "custom.width", + "value": "163" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Port" + }, + "properties": [ + { + "id": "custom.width", + "value": "59" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Protocol" + }, + "properties": [ + { + "id": "custom.width", + "value": "104" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "98" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Parent Kind" + }, + "properties": [ + { + "id": "custom.width", + "value": "103" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Parent Name" + }, + "properties": [ + { + "id": "custom.width", + "value": "118" + } + ] + }, + { + "matcher": { + "id": "byName", + "options": "Namespace" + }, + "properties": [ + { + "id": "custom.width", + "value": "124" + } + ] + } + ] + }, + "gridPos": { + "h": 6, + "w": 10, + "x": 4, + "y": 7 + }, + "id": 7, + "pluginVersion": "v10.0.0", + "targets": [ + { + "datasource": { + "type": "prometheus", + "uid": "$datasource" + }, + "expr": "gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"}", + "format": "table", + "instant": true, + "range": false } - } - }, - { - "id": "organize", - "options": { - "excludeByName": { - "Value": true - }, - "indexByName": { - "Value": 9, - "customresource_kind": 0, - "customresource_version": 1, - "hostname": 5, - "listener_name": 4, - "name": 2, - "namespace": 3, - "port": 6, - "protocol": 7, - "tls_mode": 8 + ], + "title": "HTTPRoute *attached* Parent References", + "transformations": [ + { + "id": "filterFieldsByName", + "options": { + "include": { + "names": [ + "customresource_version", + "name", + "namespace", + "parent_kind", + "parent_name", + "parent_namespace" + ] + } + } }, - "renameByName": { - "Value": "", - "customresource_kind": "Kind", - "customresource_version": "Version", - "hostname": "Hostname", - "listener_name": "Listener Name", - "name": "Name", - "namespace": "Namespace", - "parent_kind": "Parent Kind", - "parent_name": "Parent Name", - "parent_namespace": "Parent Namespace", - "port": "Port", - "prometheus": "", - "protocol": "Protocol", - "tls_mode": "TLS Mode", - "type": "Address Type", - "value": "Address Value" + { + "id": "organize", + "options": { + "excludeByName": { + "Value": true + }, + "indexByName": { + "Value": 9, + "customresource_kind": 0, + "customresource_version": 1, + "hostname": 5, + "listener_name": 4, + "name": 2, + "namespace": 3, + "port": 6, + "protocol": 7, + "tls_mode": 8 + }, + "renameByName": { + "Value": "", + "customresource_kind": "Kind", + "customresource_version": "Version", + "hostname": "Hostname", + "listener_name": "Listener Name", + "name": "Name", + "namespace": "Namespace", + "parent_kind": "Parent Kind", + "parent_name": "Parent Name", + "parent_namespace": "Parent Namespace", + "port": "Port", + "prometheus": "", + "protocol": "Protocol", + "tls_mode": "TLS Mode", + "type": "Address Type", + "value": "Address Value" + } + } } - } - } - ], - "type": "table" - } - ], - "schemaVersion": 36, - "style": "dark", - "tags": [ - "gateway-api", - "gateway-api-state" - ], - "templating": { - "list": [ - { - "current": { - "selected": false, - "text": "prometheus", - "value": "prometheus" - }, - "hide": 0, - "includeAll": false, - "label": "Data Source", - "multi": false, - "name": "datasource", - "options": [], - "query": "prometheus", - "refresh": 1, - "regex": "", - "skipUrlSync": false, - "type": "datasource" - }, - { - "current": {}, - "datasource": { - "type": "prometheus", - "uid": "${datasource}" - }, - "definition": "label_values(gatewayapi_httproute_created, name)", - "hide": 0, - "includeAll": true, - "label": "HTTPRoute", - "multi": true, - "name": "httproute", - "options": [], - "query": { - "query": "label_values(gatewayapi_httproute_created, name)", - "refId": "StandardVariableQuery" - }, - "refresh": 1, - "regex": "/(.*)/", - "skipUrlSync": false, - "sort": 1, - "type": "query" + ], + "type": "table" } - ] - }, - "time": { - "from": "now-1h", - "to": "now" - }, - "timepicker": {}, - "timezone": "", - "title": "Gateway API State / HTTPRoutes", - "uid": "gatewayapihttproutes", - "version": 3, - "weekStart": "" -} \ No newline at end of file + ], + "schemaVersion": 36, + "style": "dark", + "tags": [ + "gateway-api", + "gateway-api-state" + ], + "templating": { + "list": [ + { + "label": "Data Source", + "name": "datasource", + "query": "prometheus", + "type": "datasource" + }, + { + "datasource": { + "type": "prometheus", + "uid": "${datasource}" + }, + "includeAll": true, + "label": "HTTPRoute", + "multi": true, + "name": "httproute", + "query": { + "query": "label_values(gatewayapi_httproute_created, name)", + "refId": "StandardVariableQuery" + }, + "regex": "/(.*)/", + "type": "query" + } + ] + }, + "time": { + "from": "now-1h", + "to": "now" + }, + "timezone": "utc", + "title": "Gateway API State / HTTPRoutes", + "uid": "gatewayapihttproutes" +} diff --git a/config/examples/dashboards/httproutes.yaml b/config/examples/dashboards/httproutes.yaml new file mode 100644 index 0000000..1fb79c7 --- /dev/null +++ b/config/examples/dashboards/httproutes.yaml @@ -0,0 +1,10 @@ +apiVersion: grafana.integreatly.org/v1beta1 +kind: GrafanaDashboard +metadata: + name: httproutes +spec: + instanceSelector: + matchLabels: + dashboards: "grafana" + json: > + {"editable":false,"links":[{"asDropdown":false,"includeVars":true,"keepTime":true,"tags":["gateway-api-state"],"targetBlank":false,"title":"Gateway Dashboards","type":"dashboards"}],"panels":[{"gridPos":{"h":1,"w":24,"x":0,"y":0},"id":1,"title":"HTTPRoutes","type":"row"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of HTTPRoutes across all namespaces","gridPos":{"h":3,"w":2,"x":0,"y":1},"id":2,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_httproute_created{name=~\"${httproute}\"})","instant":true}],"title":"Total","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of parents (e.g. Gateways) targeted by HTTPRoutes","gridPos":{"h":3,"w":2,"x":2,"y":1},"id":3,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_httproute_parent_info{name=~\"${httproute}\"})","instant":true}],"title":"Tar. Parents","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":1},"id":4,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_httproute_created{name=~\"${httproute}\"}","format":"table","instant":true,"range":false}],"title":"HTTPRoutes","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","namespace","Value"]}}},{"id":"calculateField","options":{"alias":"Created At","binary":{"left":"Value","operator":"*","reducer":"sum","right":"1000"},"mode":"binary","reduce":{"reducer":"sum"},"replaceFields":false}},{"id":"organize","options":{"excludeByName":{"Value":true},"indexByName":{},"renameByName":{"Value":"Created","customresource_kind":"Kind","customresource_version":"Version","name":"Name","namespace":"Namespace"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]},{"matcher":{"id":"byName","options":"Kind"},"properties":[{"id":"custom.width","value":"108"}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":"85"}]},{"matcher":{"id":"byName","options":"Listener Name"},"properties":[{"id":"custom.width","value":"119"}]},{"matcher":{"id":"byName","options":"Hostname"},"properties":[{"id":"custom.width","value":"163"}]},{"matcher":{"id":"byName","options":"Port"},"properties":[{"id":"custom.width","value":"59"}]},{"matcher":{"id":"byName","options":"Protocol"},"properties":[{"id":"custom.width","value":"104"}]},{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.width","value":"98"}]},{"matcher":{"id":"byName","options":"Parent Kind"},"properties":[{"id":"custom.width","value":"103"}]},{"matcher":{"id":"byName","options":"Parent Name"},"properties":[{"id":"custom.width","value":"118"}]},{"matcher":{"id":"byName","options":"Namespace"},"properties":[{"id":"custom.width","value":"124"}]}]},"gridPos":{"h":6,"w":10,"x":14,"y":1},"id":5,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_httproute_parent_info{name=~\"${httproute}\"}","format":"table","instant":true,"range":false}],"title":"HTTPRoute *targeted* Parent References","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","namespace","parent_kind","parent_name","parent_namespace"]}}},{"id":"organize","options":{"excludeByName":{"Value":true},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"Parent Kind","parent_name":"Parent Name","parent_namespace":"Parent Namespace","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode","type":"Address Type","value":"Address Value"}}}],"type":"table"},{"datasource":{"type":"prometheus","uid":"$datasource"},"description":"Total number of parents (e.g. Gateways) attached to HTTPRoutes","gridPos":{"h":3,"w":2,"x":0,"y":4},"id":6,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"count(gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"})","instant":true}],"title":"Att. Parents","type":"stat"},{"datasource":{"type":"prometheus","uid":"$datasource"},"fieldConfig":{"overrides":[{"matcher":{"id":"byName","options":"Created At"},"properties":[{"id":"unit","value":"dateTimeAsIso"}]},{"matcher":{"id":"byName","options":"Kind"},"properties":[{"id":"custom.width","value":"108"}]},{"matcher":{"id":"byName","options":"Version"},"properties":[{"id":"custom.width","value":"85"}]},{"matcher":{"id":"byName","options":"Listener Name"},"properties":[{"id":"custom.width","value":"119"}]},{"matcher":{"id":"byName","options":"Hostname"},"properties":[{"id":"custom.width","value":"163"}]},{"matcher":{"id":"byName","options":"Port"},"properties":[{"id":"custom.width","value":"59"}]},{"matcher":{"id":"byName","options":"Protocol"},"properties":[{"id":"custom.width","value":"104"}]},{"matcher":{"id":"byName","options":"Name"},"properties":[{"id":"custom.width","value":"98"}]},{"matcher":{"id":"byName","options":"Parent Kind"},"properties":[{"id":"custom.width","value":"103"}]},{"matcher":{"id":"byName","options":"Parent Name"},"properties":[{"id":"custom.width","value":"118"}]},{"matcher":{"id":"byName","options":"Namespace"},"properties":[{"id":"custom.width","value":"124"}]}]},"gridPos":{"h":6,"w":10,"x":4,"y":7},"id":7,"pluginVersion":"v10.0.0","targets":[{"datasource":{"type":"prometheus","uid":"$datasource"},"expr":"gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"}","format":"table","instant":true,"range":false}],"title":"HTTPRoute *attached* Parent References","transformations":[{"id":"filterFieldsByName","options":{"include":{"names":["customresource_version","name","namespace","parent_kind","parent_name","parent_namespace"]}}},{"id":"organize","options":{"excludeByName":{"Value":true},"indexByName":{"Value":9,"customresource_kind":0,"customresource_version":1,"hostname":5,"listener_name":4,"name":2,"namespace":3,"port":6,"protocol":7,"tls_mode":8},"renameByName":{"Value":"","customresource_kind":"Kind","customresource_version":"Version","hostname":"Hostname","listener_name":"Listener Name","name":"Name","namespace":"Namespace","parent_kind":"Parent Kind","parent_name":"Parent Name","parent_namespace":"Parent Namespace","port":"Port","prometheus":"","protocol":"Protocol","tls_mode":"TLS Mode","type":"Address Type","value":"Address Value"}}}],"type":"table"}],"schemaVersion":36,"style":"dark","tags":["gateway-api","gateway-api-state"],"templating":{"list":[{"label":"Data Source","name":"datasource","query":"prometheus","type":"datasource"},{"datasource":{"type":"prometheus","uid":"${datasource}"},"includeAll":true,"label":"HTTPRoute","multi":true,"name":"httproute","query":{"query":"label_values(gatewayapi_httproute_created, name)","refId":"StandardVariableQuery"},"regex":"/(.*)/","type":"query"}]},"time":{"from":"now-1h","to":"now"},"timezone":"utc","title":"Gateway API State / HTTPRoutes","uid":"gatewayapihttproutes"} diff --git a/hack/local_dev.sh b/hack/local_dev.sh new file mode 100755 index 0000000..ebecb40 --- /dev/null +++ b/hack/local_dev.sh @@ -0,0 +1,68 @@ +#!/bin/bash + +set -e + +echo "Creating kind cluster" +kind create cluster + +echo "Setting up monitoring stack" +kubectl create -f ./config/gateway-api/crd/standard/ +kubectl create -f ./config/examples/enterprise/all.yaml +kubectl replace --subresource=status -f ./config/examples/enterprise/all.yaml +kubectl apply --server-side -f ./config/examples/kube-prometheus/bundle_crd.yaml +kubectl apply -f ./config/examples/kube-prometheus/bundle.yaml + +echo "Installing grafana-operator" +helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.4.1 + +kubectl apply -f - < /dev/null & + +echo -e "\n\nOpen Grafana at http://localhost:3000 to see dashboards. (user/pass admin/admin)\n\n" + +make apply-latest-dashboard-crs + +echo -e "\nStarting to watch for jsonnet changes in src/dasbhoards\n\n" + +fswatch -r src/dashboards/ | xargs -n 1 -I {} make apply-latest-dashboard-crs diff --git a/src/dashboards/README.md b/src/dashboards/README.md deleted file mode 100644 index 62f0473..0000000 --- a/src/dashboards/README.md +++ /dev/null @@ -1,142 +0,0 @@ -```shell -kind create cluster -helm upgrade -i grafana-operator oci://ghcr.io/grafana-operator/helm-charts/grafana-operator --version v5.4.1 - -kubectl apply -f - < /dev/null & - -kubectl apply -f - < - { - "id": null, - "title": "Simple Dashboard", - "tags": [], - "style": "dark", - "timezone": "browser", - "editable": true, - "hideControls": false, - "graphTooltip": 1, - "panels": [], - "time": { - "from": "now-6h", - "to": "now" - }, - "timepicker": { - "time_options": [], - "refresh_intervals": [] - }, - "templating": { - "list": [] - }, - "annotations": { - "list": [] - }, - "refresh": "5s", - "schemaVersion": 17, - "version": 0, - "links": [] - } -EOF -``` diff --git a/src/dashboards/gatewayclasses.jsonnet b/src/dashboards/gatewayclasses.jsonnet index 9df4309..a0838ca 100644 --- a/src/dashboards/gatewayclasses.jsonnet +++ b/src/dashboards/gatewayclasses.jsonnet @@ -1,7 +1,20 @@ local g = import 'lib/g.libsonnet'; local gwapi = import 'lib/gwapi/gwapi.libsonnet'; -gwapi.dashboard('GatewayClasses', 'gatewayapigatewayclass') +gwapi.dashboard('GatewayClasses', 'gatewayapigatewayclass', [ + g.dashboard.variable.query.new( + 'gatewayclass', + { + query: 'label_values(gatewayapi_gatewayclass_info, name)', + refId: 'StandardVariableQuery', + }, + ) + + g.dashboard.variable.query.withRegex('') + + g.dashboard.variable.query.withDatasource('prometheus', '${datasource}') + + g.dashboard.variable.query.selectionOptions.withIncludeAll(true) + + g.dashboard.variable.query.selectionOptions.withMulti(true) + + g.dashboard.variable.query.generalOptions.withLabel('GatewayClass'), +]) + g.dashboard.withPanels([ gwapi.row('Gateway Classes', 1, 24, 0, 0), gwapi.stat('Total', 3, 2, 0, 1, 'Total number of GatewayClasses across all clusters', 'count(gatewayapi_gatewayclass_info)'), @@ -113,15 +126,6 @@ gwapi.dashboard('GatewayClasses', 'gatewayapigatewayclass') ), ]) + g.panel.table.queryOptions.withTransformations([ - g.panel.table.transformation.withId('reduce') - + g.panel.table.transformation.withOptions({ - includeTimeField: false, - labelsToFields: true, - mode: 'seriesToRows', - reducers: [ - 'last', - ], - }), g.panel.table.transformation.withId('filterFieldsByName') + g.panel.table.transformation.withOptions({ include: { diff --git a/src/dashboards/gateways.jsonnet b/src/dashboards/gateways.jsonnet index 4b52957..4e51270 100644 --- a/src/dashboards/gateways.jsonnet +++ b/src/dashboards/gateways.jsonnet @@ -1,8 +1,361 @@ local g = import 'lib/g.libsonnet'; local gwapi = import 'lib/gwapi/gwapi.libsonnet'; -gwapi.dashboard('Gateways', 'gatewayapigateways') -+ g.dashboard.withPanels([ - gwapi.row('Gateways', 1, 24, 0, 0) +gwapi.dashboard('Gateways', 'gatewayapigateways', [ + g.dashboard.variable.query.new( + 'gateway', + { + query: 'label_values(gatewayapi_gateway_info, name)', + refId: 'StandardVariableQuery', + }, + ) + + g.dashboard.variable.query.withRegex('/(.*)/') + + g.dashboard.variable.query.withDatasource('prometheus', '${datasource}') + + g.dashboard.variable.query.selectionOptions.withIncludeAll(true) + + g.dashboard.variable.query.selectionOptions.withMulti(true) + + g.dashboard.variable.query.generalOptions.withLabel('Gateway'), ]) ++ g.dashboard.withPanels([ + gwapi.row('Gateways', 1, 24, 0, 0), + gwapi.stat('Total', 3, 2, 0, 1, 'Total number of Gateways across all namespaces', 'count(gatewayapi_gateway_info{name=~"$gateway"})'), + gwapi.stat('Unhealthy', 3, 2, 2, 1, 'Number of Gateways not in an Accepted and Programmed state', 'count((gatewayapi_gateway_status{name=~"$gateway",type="Accepted"} == 0) or (gatewayapi_gateway_status{name=~"$gateway",type="Programmed"} == 0)) or vector(0)'), + gwapi.table('Gateways', 6, 10, 4, 1, 'gatewayapi_gateway_created{name=~"$gateway"} * on(name, namespace, instance) group_right gatewayapi_gateway_info{name=~"$gateway"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + g.panel.table.fieldOverride.byName.new('Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '108' + ), + g.panel.table.fieldOverride.byName.new('Version') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '98' + ), + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '125' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'gatewayclass_name', + 'name', + 'namespace', + 'Value', + ], + }, + }), + g.panel.table.transformation.withId('calculateField') + + g.panel.table.transformation.withOptions({ + alias: 'Created At', + binary: { + left: 'Value', + operator: '*', + reducer: 'sum', + right: '1000', + }, + mode: 'binary', + reduce: { + reducer: 'sum', + }, + replaceFields: false, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: true, + customresource_kind: true, + }, + indexByName: {}, + renameByName: { + Value: 'Created', + customresource_kind: 'Kind', + customresource_version: 'Version', + gatewayclass_name: 'GatewayClass', + name: 'Name', + namespace: 'Namespace', + }, + }), + ]), + gwapi.table('Gateway Listeners', 6, 10, 14, 1, 'gatewayapi_gateway_listener_info{name=~"$gateway"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + g.panel.table.fieldOverride.byName.new('Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '108' + ), + g.panel.table.fieldOverride.byName.new('Version') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '94' + ), + g.panel.table.fieldOverride.byName.new('Listener Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '112' + ), + g.panel.table.fieldOverride.byName.new('Hostname') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '163' + ), + g.panel.table.fieldOverride.byName.new('Port') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '59' + ), + g.panel.table.fieldOverride.byName.new('Protocol') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '77' + ), + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '91' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'hostname', + 'listener_name', + 'name', + 'namespace', + 'port', + 'protocol', + 'tls_mode', + 'Value', + ], + }, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: true, + }, + indexByName: { + Value: 9, + customresource_kind: 0, + customresource_version: 1, + hostname: 5, + listener_name: 4, + name: 2, + namespace: 3, + port: 6, + protocol: 7, + tls_mode: 8, + }, + renameByName: { + Value: '', + customresource_kind: 'Kind', + customresource_version: 'Version', + hostname: 'Hostname', + listener_name: 'Listener Name', + name: 'Name', + namespace: 'Namespace', + port: 'Port', + prometheus: '', + protocol: 'Protocol', + tls_mode: 'TLS Mode', + }, + }), + ]), + gwapi.stat('Accepted', 3, 2, 0, 4, 'Total Gateways with an Accepted state of True', 'count(gatewayapi_gateway_status{name=~"$gateway",type="Accepted"} > 0)'), + gwapi.stat('Programmed', 3, 2, 2, 4, 'Total Gateways with a Programmed state of True', 'count(gatewayapi_gateway_status{name=~"$gateway",type="Programmed"} > 0)'), + gwapi.stat('Listeners', 3, 2, 0, 7, 'Total number of listeners across all Gateways', 'count(gatewayapi_gateway_listener_info{name=~"$gateway"})'), + gwapi.stat('Att. Routes', 3, 2, 2, 7, 'Total number of attached routes across all listeners', 'sum(gatewayapi_gateway_status_listener_attached_routes{name=~"$gateway"})'), + gwapi.table('Gateway Status Addresses', 6, 10, 4, 7, 'gatewayapi_gateway_status_address_info{name=~"$gateway"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + g.panel.table.fieldOverride.byName.new('Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '108' + ), + g.panel.table.fieldOverride.byName.new('Version') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '94' + ), + g.panel.table.fieldOverride.byName.new('Listener Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '119' + ), + g.panel.table.fieldOverride.byName.new('Hostname') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '163' + ), + g.panel.table.fieldOverride.byName.new('Port') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '59' + ), + g.panel.table.fieldOverride.byName.new('Protocol') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '104' + ), + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '136' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'name', + 'namespace', + 'type', + 'value', + ], + }, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: true, + }, + indexByName: { + Value: 9, + customresource_kind: 0, + customresource_version: 1, + hostname: 5, + listener_name: 4, + name: 2, + namespace: 3, + port: 6, + protocol: 7, + tls_mode: 8, + }, + renameByName: { + Value: '', + customresource_kind: 'Kind', + customresource_version: 'Version', + hostname: 'Hostname', + listener_name: 'Listener Name', + name: 'Name', + namespace: 'Namespace', + port: 'Port', + prometheus: '', + protocol: 'Protocol', + tls_mode: 'TLS Mode', + type: 'Address Type', + value: 'Address Value', + }, + }), + ]), + gwapi.table('Gateway Listener Status - Attached Routes', 6, 10, 14, 7, 'gatewayapi_gateway_status_listener_attached_routes{name=~"$gateway"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + g.panel.table.fieldOverride.byName.new('Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '113' + ), + g.panel.table.fieldOverride.byName.new('Version') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '88' + ), + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '167' + ), + g.panel.table.fieldOverride.byName.new('Listener Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '167' + ), + g.panel.table.fieldOverride.byName.new('# Attached Routes') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '137' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'listener_name', + 'name', + 'namespace', + 'Value', + ], + }, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: false, + }, + indexByName: { + Value: 9, + customresource_kind: 0, + customresource_version: 1, + hostname: 5, + listener_name: 4, + name: 2, + namespace: 3, + port: 6, + protocol: 7, + tls_mode: 8, + }, + renameByName: { + Value: '# Attached Routes', + customresource_kind: 'Kind', + customresource_version: 'Version', + hostname: 'Hostname', + listener_name: 'Listener Name', + name: 'Name', + namespace: 'Namespace', + port: 'Port', + prometheus: '', + protocol: 'Protocol', + tls_mode: 'TLS Mode', + }, + }), + ]), + gwapi.tableRouteByGateway('HTTPRoutes (by Gateway)', 6, 10, 4, 13, 'gatewayapi_httproute_parent_info{parent_kind="Gateway",parent_name=~"${gateway}"}', 'HTTPRoute Details', '/d/gatewayapihttproutes/gateway-api-state-httproutes?var-httproute=${__value.text}'), + gwapi.tableRouteByGateway('GRPCRoutes (by Gateway)', 6, 10, 14, 13, 'gatewayapi_grpcroute_parent_info{parent_kind="Gateway",parent_name=~"${gateway}"}', 'GRPCRoute Details', '/d/gatewayapigrpcroutes/gateway-api-state-grpcroutes?var-grpcroute=${__value.text}'), + gwapi.tableRouteByGateway('TLSRoutes (by Gateway)', 6, 10, 4, 19, 'gatewayapi_tlsroute_parent_info{parent_kind="Gateway",parent_name=~"${gateway}"}', 'TLSRoute Details', '/d/gatewayapitlsroutes/gateway-api-state-tlsroutes?var-tlsroute=${__value.text}'), + gwapi.tableRouteByGateway('TCPRoutes (by Gateway)', 6, 10, 14, 19, 'gatewayapi_tcproute_parent_info{parent_kind="Gateway",parent_name=~"${gateway}"}', 'TCPRoute Details', '/d/gatewayapitcproutes/gateway-api-state-tcproutes?var-tcproute=${__value.text}'), + gwapi.tableRouteByGateway('UDPRoutes (by Gateway)', 6, 10, 4, 25, 'gatewayapi_udproute_parent_info{parent_kind="Gateway",parent_name=~"${gateway}"}', 'UDPRoute Details', '/d/gatewayapiudproutes/gateway-api-state-udproutes?var-udproute=${__value.text}'), + +]) diff --git a/src/dashboards/httproutes.jsonnet b/src/dashboards/httproutes.jsonnet new file mode 100644 index 0000000..a7d38b2 --- /dev/null +++ b/src/dashboards/httproutes.jsonnet @@ -0,0 +1,291 @@ +local g = import 'lib/g.libsonnet'; +local gwapi = import 'lib/gwapi/gwapi.libsonnet'; + +gwapi.dashboard('HTTPRoutes', 'gatewayapihttproutes', [ + g.dashboard.variable.query.new( + 'httproute', + { + query: 'label_values(gatewayapi_httproute_created, name)', + refId: 'StandardVariableQuery', + }, + ) + + g.dashboard.variable.query.withRegex('/(.*)/') + + g.dashboard.variable.query.withDatasource('prometheus', '${datasource}') + + g.dashboard.variable.query.selectionOptions.withIncludeAll(true) + + g.dashboard.variable.query.selectionOptions.withMulti(true) + + g.dashboard.variable.query.generalOptions.withLabel('HTTPRoute'), +]) ++ g.dashboard.withPanels([ + gwapi.row('HTTPRoutes', 1, 24, 0, 0), + gwapi.stat('Total', 3, 2, 0, 1, 'Total number of HTTPRoutes across all namespaces', 'count(gatewayapi_httproute_created{name=~"${httproute}"})'), + gwapi.stat('Tar. Parents', 3, 2, 2, 1, 'Total number of parents (e.g. Gateways) targeted by HTTPRoutes', 'count(gatewayapi_httproute_parent_info{name=~"${httproute}"})'), + gwapi.table('HTTPRoutes', 6, 10, 4, 1, 'gatewayapi_httproute_created{name=~"${httproute}"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'name', + 'namespace', + 'Value', + ], + }, + }), + g.panel.table.transformation.withId('calculateField') + + g.panel.table.transformation.withOptions({ + alias: 'Created At', + binary: { + left: 'Value', + operator: '*', + reducer: 'sum', + right: '1000', + }, + mode: 'binary', + reduce: { + reducer: 'sum', + }, + replaceFields: false, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: true, + }, + indexByName: {}, + renameByName: { + Value: 'Created', + customresource_kind: 'Kind', + customresource_version: 'Version', + name: 'Name', + namespace: 'Namespace', + }, + }), + ]), + gwapi.table('HTTPRoute *targeted* Parent References', 6, 10, 14, 1, 'gatewayapi_httproute_parent_info{name=~"${httproute}"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + g.panel.table.fieldOverride.byName.new('Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '108' + ), + g.panel.table.fieldOverride.byName.new('Version') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '85' + ), + g.panel.table.fieldOverride.byName.new('Listener Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '119' + ), + g.panel.table.fieldOverride.byName.new('Hostname') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '163' + ), + g.panel.table.fieldOverride.byName.new('Port') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '59' + ), + g.panel.table.fieldOverride.byName.new('Protocol') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '104' + ), + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '98' + ), + g.panel.table.fieldOverride.byName.new('Parent Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '103' + ), + g.panel.table.fieldOverride.byName.new('Parent Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '118' + ), + g.panel.table.fieldOverride.byName.new('Namespace') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '124' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'name', + 'namespace', + 'parent_kind', + 'parent_name', + 'parent_namespace', + ], + }, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: true, + }, + indexByName: { + Value: 9, + customresource_kind: 0, + customresource_version: 1, + hostname: 5, + listener_name: 4, + name: 2, + namespace: 3, + port: 6, + protocol: 7, + tls_mode: 8, + }, + renameByName: { + Value: '', + customresource_kind: 'Kind', + customresource_version: 'Version', + hostname: 'Hostname', + listener_name: 'Listener Name', + name: 'Name', + namespace: 'Namespace', + parent_kind: 'Parent Kind', + parent_name: 'Parent Name', + parent_namespace: 'Parent Namespace', + port: 'Port', + prometheus: '', + protocol: 'Protocol', + tls_mode: 'TLS Mode', + type: 'Address Type', + value: 'Address Value', + }, + }), + ]), + gwapi.stat('Att. Parents', 3, 2, 0, 4, 'Total number of parents (e.g. Gateways) attached to HTTPRoutes', 'count(gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"})'), + gwapi.table('HTTPRoute *attached* Parent References', 6, 10, 4, 7, 'gatewayapi_httproute_status_parent_info{name=~\"${httproute}\"}') + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Created At') + + g.panel.table.fieldOverride.byName.withProperty( + 'unit', + 'dateTimeAsIso' + ), + g.panel.table.fieldOverride.byName.new('Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '108' + ), + g.panel.table.fieldOverride.byName.new('Version') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '85' + ), + g.panel.table.fieldOverride.byName.new('Listener Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '119' + ), + g.panel.table.fieldOverride.byName.new('Hostname') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '163' + ), + g.panel.table.fieldOverride.byName.new('Port') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '59' + ), + g.panel.table.fieldOverride.byName.new('Protocol') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '104' + ), + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '98' + ), + g.panel.table.fieldOverride.byName.new('Parent Kind') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '103' + ), + g.panel.table.fieldOverride.byName.new('Parent Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '118' + ), + g.panel.table.fieldOverride.byName.new('Namespace') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.width', + '124' + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'customresource_version', + 'name', + 'namespace', + 'parent_kind', + 'parent_name', + 'parent_namespace', + ], + }, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: true, + }, + indexByName: { + Value: 9, + customresource_kind: 0, + customresource_version: 1, + hostname: 5, + listener_name: 4, + name: 2, + namespace: 3, + port: 6, + protocol: 7, + tls_mode: 8, + }, + renameByName: { + Value: '', + customresource_kind: 'Kind', + customresource_version: 'Version', + hostname: 'Hostname', + listener_name: 'Listener Name', + name: 'Name', + namespace: 'Namespace', + parent_kind: 'Parent Kind', + parent_name: 'Parent Name', + parent_namespace: 'Parent Namespace', + port: 'Port', + prometheus: '', + protocol: 'Protocol', + tls_mode: 'TLS Mode', + type: 'Address Type', + value: 'Address Value', + }, + }), + ]), +]) diff --git a/src/dashboards/lib/gwapi/gwapi.libsonnet b/src/dashboards/lib/gwapi/gwapi.libsonnet index c491bf1..9a60961 100644 --- a/src/dashboards/lib/gwapi/gwapi.libsonnet +++ b/src/dashboards/lib/gwapi/gwapi.libsonnet @@ -1,7 +1,7 @@ local g = import '../g.libsonnet'; { - dashboard(title, uid): + dashboard(title, uid, variables): g.dashboard.new('Gateway API State / ' + title) + g.dashboard.withUid(uid) + g.dashboard.time.withFrom('now-1h') @@ -21,7 +21,7 @@ local g = import '../g.libsonnet'; 'prometheus', ) + g.dashboard.variable.datasource.generalOptions.withLabel('Data Source'), - ],), + ] + variables,), row(title, h, w, x, y): g.panel.row.new(title) @@ -53,4 +53,68 @@ local g = import '../g.libsonnet'; + g.query.prometheus.withRange(false) + g.query.prometheus.withFormat('table'), ]), + + tableRouteByGateway(title, h, w, x, y, expr, linkTitle, linkUrl): + self.table(title, h, w, x, y, expr) + + g.panel.table.standardOptions.withOverrides([ + g.panel.table.fieldOverride.byName.new('Name') + + g.panel.table.fieldOverride.byName.withProperty( + 'custom.displayMode', + 'color-text' + ) + + g.panel.table.fieldOverride.byName.withProperty( + 'links', + [ + { + title: linkTitle, + url: linkUrl, + }, + ] + ), + ]) + + g.panel.table.queryOptions.withTransformations([ + g.panel.table.transformation.withId('filterFieldsByName') + + g.panel.table.transformation.withOptions({ + include: { + names: [ + 'name', + 'namespace', + 'parent_name', + ], + }, + }), + g.panel.table.transformation.withId('organize') + + g.panel.table.transformation.withOptions({ + excludeByName: { + Value: false, + }, + indexByName: { + Value: 9, + customresource_kind: 0, + customresource_version: 1, + hostname: 5, + listener_name: 4, + name: 2, + namespace: 3, + port: 6, + protocol: 7, + tls_mode: 8, + }, + renameByName: { + Value: '# Attached Routes', + customresource_kind: 'Kind', + customresource_version: 'Version', + hostname: 'Hostname', + listener_name: 'Listener Name', + name: 'Name', + namespace: 'Namespace', + parent_kind: '', + parent_name: 'Gateway', + port: 'Port', + prometheus: '', + protocol: 'Protocol', + tls_mode: 'TLS Mode', + }, + }), + ]), }