Skip to content

Commit

Permalink
Merge pull request #454 from vshn/cloud-query-billing
Browse files Browse the repository at this point in the history
Fix cloud billing query
  • Loading branch information
zugao authored Aug 29, 2024
2 parents 715fb51 + d78f954 commit 3350d26
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 39 deletions.
2 changes: 1 addition & 1 deletion Makefile.vars.mk
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ KUBENT_IMAGE ?= ghcr.io/doitintl/kube-no-trouble:latest
KUBENT_DOCKER ?= $(DOCKER_CMD) $(DOCKER_ARGS) $(root_volume) --entrypoint=/app/kubent $(KUBENT_IMAGE)

instance ?= defaults
test_instances = tests/defaults.yml tests/exoscale.yml tests/cloudscale.yml tests/openshift.yml tests/vshn.yml tests/apiserver.yml tests/controllers.yml tests/minio.yml tests/cloudscale-metrics-collector-cloud.yml cloudscale-metrics-collector-managed.yml tests/exoscale-metrics-collector-cloud.yml tests/component/exoscale-metrics-collector-managed.yml
test_instances = tests/defaults.yml tests/billing.yaml tests/exoscale.yml tests/cloudscale.yml tests/openshift.yml tests/vshn.yml tests/apiserver.yml tests/controllers.yml tests/minio.yml tests/cloudscale-metrics-collector-cloud.yml cloudscale-metrics-collector-managed.yml tests/exoscale-metrics-collector-cloud.yml tests/component/exoscale-metrics-collector-managed.yml

YAMLLINT_ARGS ?= --no-warnings
YAMLLINT_CONFIG ?= .yamllint.yml
Expand Down
4 changes: 2 additions & 2 deletions component/billing.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,8 @@ local generateCloudAndManaged = function(name)
// For postgresql we have a missmatch between the label and the name in our definition.
local queryName = if name == 'postgres' then name + 'ql' else name;

local managedQuery = 'appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s"}';
local cloudQuery = managedQuery + ' * on(label_appuio_io_organization) group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, "label_appuio_io_organization", "$1", "organization", "(.*)")';
local managedQuery = 'appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name!="APPUiO"}';
local cloudQuery = 'appcat:metering{label_appuio_io_billing_name="appcat-' + queryName + '",label_appcat_vshn_io_sla="%s", tenant_name="APPUiO"} * on(label_appuio_io_organization) group_left(sales_order) label_replace(appuio_control_organization_info{namespace="appuio-control-api-production"}, "label_appuio_io_organization", "$1", "organization", "(.*)")';

local permutations = [
{
Expand Down
Loading

0 comments on commit 3350d26

Please sign in to comment.