Skip to content

Commit

Permalink
Add Kuadrant DNSPolicy metrics and dashboard panel
Browse files Browse the repository at this point in the history
  • Loading branch information
david-martin committed Nov 15, 2023
1 parent 8a1c230 commit 69395c1
Show file tree
Hide file tree
Showing 10 changed files with 920 additions and 58 deletions.
53 changes: 53 additions & 0 deletions config/default/custom-resource-state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,59 @@ spec:
labelsFromPath:
type: ["type"]
valueFrom: ["status"]
- groupVersionKind:
group: kuadrant.io
kind: "DNSPolicy"
version: "v1alpha1"
metricNamePrefix: gatewayapi_dnspolicy
labelsFromPath:
name:
- metadata
- name
namespace:
- metadata
- namespace
metrics:
- name: "labels"
help: "Kubernetes labels converted to Prometheus labels."
each:
type: Info
info:
path: [metadata]
labelsFromPath:
"*": [labels]
- name: "created"
help: "created timestamp"
each:
type: Gauge
gauge:
path: [metadata, creationTimestamp]
- name: "deleted"
help: "deletion timestamp"
each:
type: Gauge
gauge:
path: [metadata, deletionTimestamp]
- name: "target_info"
help: "Target references that the dnspolicy wants to be attached to"
each:
type: Info
info:
path: [spec, targetRef]
labelsFromPath:
target_group: ["group"]
target_kind: ["kind"]
target_name: ["name"]
target_namespace: ["namespace"]
- name: "status"
help: "status condition"
each:
type: Gauge
gauge:
path: [status, conditions]
labelsFromPath:
type: ["type"]
valueFrom: ["status"]
- groupVersionKind:
group: kuadrant.io
kind: "RateLimitPolicy"
Expand Down
200 changes: 179 additions & 21 deletions config/examples/dashboards/policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"h": 3,
"w": 2,
"x": 0,
"y": 1
"y": 0
},
"id": 2,
"pluginVersion": "v10.0.0",
Expand All @@ -62,7 +62,7 @@
"h": 3,
"w": 2,
"x": 2,
"y": 1
"y": 0
},
"id": 3,
"pluginVersion": "v10.0.0",
Expand Down Expand Up @@ -113,7 +113,7 @@
"h": 6,
"w": 10,
"x": 4,
"y": 1
"y": 0
},
"id": 4,
"pluginVersion": "v10.0.0",
Expand Down Expand Up @@ -164,6 +164,148 @@
"y": 2
},
"id": 5,
"title": "DNSPolicy",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"description": "Total number of DNSPolicy across all clusters",
"gridPos": {
"h": 3,
"w": 2,
"x": 0,
"y": 2
},
"id": 6,
"pluginVersion": "v10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"expr": "count(gatewayapi_dnspolicy_status{name=~\"${dnspolicy}\"})",
"instant": true
}
],
"title": "Total",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"description": "Total DNSPolicy with an Ready state",
"gridPos": {
"h": 3,
"w": 2,
"x": 2,
"y": 2
},
"id": 7,
"pluginVersion": "v10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"expr": "count(gatewayapi_dnspolicy_status{type=\"Ready\", name=~\"${dnspolicy}\"})",
"instant": true
}
],
"title": "Ready",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"fieldConfig": {
"overrides": [
{
"matcher": {
"id": "byName",
"options": "Target Name"
},
"properties": [
{
"id": "custom.displayMode",
"value": "color-text"
},
{
"id": "links",
"value": [
{
"title": "Gateway Details",
"url": "/d/gatewayapigateways/gateway-api-state-gateways?var-gateway=${__value.text}"
}
]
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 10,
"x": 4,
"y": 2
},
"id": 8,
"pluginVersion": "v10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"expr": "gatewayapi_dnspolicy_target_info{name=~\"${dnspolicy}\"}",
"format": "table",
"instant": true,
"range": false
}
],
"title": "DNSPolicy",
"transformations": [
{
"id": "filterFieldsByName",
"options": {
"include": {
"names": [
"name",
"target_kind",
"target_name"
]
}
}
},
{
"id": "organize",
"options": {
"renameByName": {
"name": "Name",
"target_kind": "Target Kind",
"target_name": "Target Name"
}
}
}
],
"type": "table"
},
{
"gridPos": {
"h": 1,
"w": 24,
"x": 0,
"y": 4
},
"id": 9,
"title": "RateLimitPolicy",
"type": "row"
},
Expand All @@ -177,9 +319,9 @@
"h": 3,
"w": 2,
"x": 0,
"y": 3
"y": 4
},
"id": 6,
"id": 10,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand All @@ -204,9 +346,9 @@
"h": 3,
"w": 2,
"x": 2,
"y": 3
"y": 4
},
"id": 7,
"id": 11,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand Down Expand Up @@ -255,9 +397,9 @@
"h": 6,
"w": 10,
"x": 4,
"y": 7
"y": 4
},
"id": 8,
"id": 12,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand Down Expand Up @@ -303,9 +445,9 @@
"h": 1,
"w": 24,
"x": 0,
"y": 8
"y": 6
},
"id": 9,
"id": 13,
"title": "AuthPolicy",
"type": "row"
},
Expand All @@ -319,9 +461,9 @@
"h": 3,
"w": 2,
"x": 0,
"y": 9
"y": 6
},
"id": 10,
"id": 14,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand All @@ -346,9 +488,9 @@
"h": 3,
"w": 2,
"x": 2,
"y": 9
"y": 6
},
"id": 11,
"id": 15,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand Down Expand Up @@ -397,9 +539,9 @@
"h": 6,
"w": 10,
"x": 4,
"y": 9
"y": 6
},
"id": 12,
"id": 16,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand Down Expand Up @@ -445,9 +587,9 @@
"h": 1,
"w": 24,
"x": 0,
"y": 10
"y": 8
},
"id": 13,
"id": 17,
"title": "BackendTLSPolicy",
"type": "row"
},
Expand All @@ -463,9 +605,9 @@
"h": 6,
"w": 10,
"x": 4,
"y": 10
"y": 8
},
"id": 14,
"id": 18,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand Down Expand Up @@ -537,6 +679,22 @@
"regex": "/(.*)/",
"type": "query"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"includeAll": true,
"label": "DNSPolicy",
"multi": true,
"name": "dnspolicy",
"query": {
"query": "label_values(gatewayapi_dnspolicy_created, name)",
"refId": "StandardVariableQuery"
},
"regex": "/(.*)/",
"type": "query"
},
{
"datasource": {
"type": "prometheus",
Expand Down
2 changes: 1 addition & 1 deletion config/examples/dashboards/policies.yaml

Large diffs are not rendered by default.

Loading

0 comments on commit 69395c1

Please sign in to comment.