-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add queries for APPUiO Managed billing
- Loading branch information
Aline Abler
committed
Aug 22, 2023
1 parent
fd1d44e
commit d89c741
Showing
6 changed files
with
113 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
pkg/db/seeds/appuio_managed_openshift_clusters_legacy.promql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Calculates number of clusters per cluster, but only for clusters with old billing | ||
# Yes, this is always 1 | ||
# Structure of resulting product label "query:cloud:tenant:cluster:sla" | ||
|
||
# Max values over one hour. | ||
max_over_time( | ||
# Add the final product label by joining the base product with the cluster ID, the tenant, and the service class. | ||
label_join( | ||
label_join( | ||
label_replace( | ||
# Add the base product identifier. | ||
label_replace( | ||
max by(cluster_id, vshn_service_level, tenant_id, cloud_provider) ( | ||
appuio_managed_info{vshn_service_level=~"(zero|standard|professional|premium)"} | ||
), | ||
"product", | ||
"appuio_managed_openshift_clusters", | ||
"", | ||
".*" | ||
), | ||
"class", | ||
"$0", | ||
"vshn_service_level", | ||
"(.*)" | ||
), | ||
"product", | ||
":", | ||
"product", | ||
"cloud_provider", | ||
"tenant_id", | ||
"cluster_id", | ||
"class" | ||
), | ||
"category", | ||
":", | ||
"tenant_id", | ||
"cluster_id" | ||
)[58m:1m] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
pkg/db/seeds/promtest/appuio_managed_openshift_clusters_legacy.jsonnet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
local c = import 'common.libsonnet'; | ||
|
||
local query = importstr '../appuio_managed_openshift_clusters_legacy.promql'; | ||
|
||
local commonLabels = { | ||
cluster_id: 'c-managed-openshift', | ||
}; | ||
|
||
local infoLabels = commonLabels { | ||
tenant_id: 't-managed-openshift', | ||
vshn_service_level: 'standard', | ||
cloud_provider: 'cloudscale', | ||
}; | ||
|
||
local baseSeries = { | ||
appuioInfoLabel: c.series('appuio_managed_info', infoLabels, '1x120'), | ||
appuioInfoLabel2: c.series('appuio_managed_info', infoLabels { | ||
vshn_service_level: 'best_effort', | ||
}, '1x120'), | ||
}; | ||
|
||
local baseCalculatedLabels = infoLabels { | ||
class: super.vshn_service_level, | ||
category: super.tenant_id + ':' + super.cluster_id, | ||
}; | ||
|
||
{ | ||
tests: [ | ||
c.test( | ||
'one cluster', | ||
baseSeries, | ||
query, | ||
[ | ||
{ | ||
labels: c.formatLabels(baseCalculatedLabels { | ||
product: 'appuio_managed_openshift_clusters:cloudscale:t-managed-openshift:c-managed-openshift:standard', | ||
}), | ||
value: 1, | ||
}, | ||
] | ||
), | ||
|
||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters