-
Notifications
You must be signed in to change notification settings - Fork 1
/
appuio_cloud_loadbalancer.promql
44 lines (44 loc) · 1.21 KB
/
appuio_cloud_loadbalancer.promql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# Sum values over one hour.
sum_over_time(
# Add the final product label by joining the base product with the cluster ID, the tenant, and the namespace.
label_join(
# Add the category label by joining the cluster ID and the namespace.
label_join(
# Add the base product identifier.
label_replace(
# Get number of services of type load balancer
sum by(cluster_id, namespace) (kube_service_spec_type{type="LoadBalancer"})
*
# Join the namespace label to get the tenant
on(cluster_id, namespace)
group_left(tenant_id)
(
bottomk(1,
min by (cluster_id, namespace, tenant_id) (
label_replace(
kube_namespace_labels{label_appuio_io_organization=~".+"},
"tenant_id",
"$1",
"label_appuio_io_organization", "(.*)"
)
)
) by(cluster_id, namespace)
),
"product",
"appuio_cloud_loadbalancer",
"product",
".*"
),
"category",
":",
"cluster_id",
"namespace"
),
"product",
":",
"product",
"cluster_id",
"tenant_id",
"namespace"
)[59m:1m]
)