Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth policy metrics #38

Merged
merged 3 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 54 additions & 1 deletion config/default/custom-resource-state.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -607,4 +607,57 @@ spec:
target_group: ["group"]
target_kind: ["kind"]
target_name: ["name"]
target_namespace: ["namespace"]
target_namespace: ["namespace"]
- groupVersionKind:
group: kuadrant.io
kind: "AuthPolicy"
version: "v1beta2"
metricNamePrefix: gatewayapi_authpolicy
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 authpolicy 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"]
174 changes: 166 additions & 8 deletions config/examples/dashboards/policies.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
{
"matcher": {
"id": "byName",
"options": "Target Kind"
"options": "Target Name"
},
"properties": [
{
Expand All @@ -100,8 +100,8 @@
"id": "links",
"value": [
{
"title": "TLSPolicy Details",
"url": "/d/gatewayapigateways/gateway-api-state-gateways?var-tlspolicy=${__value.text}"
"title": "Gateway Details",
"url": "/d/gatewayapigateways/gateway-api-state-gateways?var-gateway=${__value.text}"
}
]
}
Expand Down Expand Up @@ -231,7 +231,7 @@
{
"matcher": {
"id": "byName",
"options": "Target Kind"
"options": "Target Name"
},
"properties": [
{
Expand All @@ -242,8 +242,8 @@
"id": "links",
"value": [
{
"title": "RateLimitPolicy Details",
"url": "/d/gatewayapihttproutes/gateway-api-state-httproutes?var-ratelimitpolicy=${__value.text}"
"title": "HTTPRoute Details",
"url": "/d/gatewayapihttproutes/gateway-api-state-httproutes?var-httproute=${__value.text}"
}
]
}
Expand Down Expand Up @@ -306,6 +306,148 @@
"y": 8
},
"id": 9,
"title": "AuthPolicy",
"type": "row"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"description": "Total number of AuthPolicy across all clusters",
"gridPos": {
"h": 3,
"w": 2,
"x": 0,
"y": 9
},
"id": 10,
"pluginVersion": "v10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"expr": "count(gatewayapi_authpolicy_status{name=~\"${authpolicy}\"})",
"instant": true
}
],
"title": "Total",
"type": "stat"
},
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"description": "Total AuthPolicy with an Available state",
"gridPos": {
"h": 3,
"w": 2,
"x": 2,
"y": 9
},
"id": 11,
"pluginVersion": "v10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"expr": "count(gatewayapi_authpolicy_status{type=\"Available\", name=~\"${authpolicy}\"})",
david-martin marked this conversation as resolved.
Show resolved Hide resolved
"instant": true
}
],
"title": "Available",
"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": "HTTPRoute Details",
"url": "/d/gatewayapihttproutes/gateway-api-state-httproutes?var-httproute=${__value.text}"
}
]
}
]
}
]
},
"gridPos": {
"h": 6,
"w": 10,
"x": 4,
"y": 9
},
"id": 12,
"pluginVersion": "v10.0.0",
"targets": [
{
"datasource": {
"type": "prometheus",
"uid": "$datasource"
},
"expr": "gatewayapi_authpolicy_target_info{name=~\"${authpolicy}\"}",
"format": "table",
"instant": true,
"range": false
}
],
"title": "AuthPolicy",
"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": 10
},
"id": 13,
"title": "BackendTLSPolicy",
"type": "row"
},
Expand All @@ -321,9 +463,9 @@
"h": 6,
"w": 10,
"x": 4,
"y": 9
"y": 10
},
"id": 10,
"id": 14,
"pluginVersion": "v10.0.0",
"targets": [
{
Expand Down Expand Up @@ -411,6 +553,22 @@
"regex": "/(.*)/",
"type": "query"
},
{
"datasource": {
"type": "prometheus",
"uid": "${datasource}"
},
"includeAll": true,
"label": "AuthPolicy",
"multi": true,
"name": "authpolicy",
"query": {
"query": "label_values(gatewayapi_authpolicy_created, name)",
"refId": "StandardVariableQuery"
},
"regex": "/(.*)/",
"type": "query"
},
{
"datasource": {
"type": "prometheus",
Expand Down
Loading