diff --git a/Makefile b/Makefile index 41763ab..59174c0 100644 --- a/Makefile +++ b/Makefile @@ -83,3 +83,8 @@ clean: docker-compose-down ## Cleans local build artifacts tar -xzf .cache/prometheus.tar.gz -C .cache mv .cache/prometheus-$(PROMETHEUS_VERSION).$(PROMETHEUS_DIST)-$(PROMETHEUS_ARCH) .cache/prometheus rm -rf .cache/*.tar.gz + +# current date in UTC in ISO 8601 format (RFC 3339) with Z as timezone that works on both linux and macos +.PHONY: current-date +current-date: + date -u +"%Y-%m-%dT%H:%M:%SZ" \ No newline at end of file diff --git a/pkg/db/seeds.go b/pkg/db/seeds.go index b75c431..3b5958f 100644 --- a/pkg/db/seeds.go +++ b/pkg/db/seeds.go @@ -85,22 +85,22 @@ var DefaultQueries = []Query{ var renderedQueries = []RenderedQuery{ { Query: Query{ - Name: "appcat_postgresql_vshn_standalone", - Description: "Number of VSHN managed standalone postgres instances", + Name: "appcat_postgresql_by_vshn", + Description: "Number of VSHN managed postgres instances", Unit: "Instances", }, ProductName: "postgres", - ServiceName: "postgresql-standalone", + ServiceName: "appcat-postgresql", Template: appcatVSHNTemplate, }, { Query: Query{ - Name: "appcat_redis_vshn_standalone", - Description: "Number of VSHN managed standalone redis instances", + Name: "appcat_redis_by_vshn", + Description: "Number of VSHN managed redis instances", Unit: "Instances", }, ProductName: "redis", - ServiceName: "redis-standalone", + ServiceName: "appcat-redis", Template: appcatVSHNTemplate, }, } diff --git a/pkg/db/seeds/appcat_vshn.promql.tmpl b/pkg/db/seeds/appcat_vshn.promql.tmpl index 3f860f4..a3b7e82 100644 --- a/pkg/db/seeds/appcat_vshn.promql.tmpl +++ b/pkg/db/seeds/appcat_vshn.promql.tmpl @@ -1,3 +1,4 @@ +sum by (label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace,tenant_id) ( # Sum values over one hour and get mean sum_over_time( # Udpate label product: $product:$provider:$tenant_id:$claim_namespace:$architecture @@ -16,8 +17,8 @@ sum_over_time( label_replace( # Copy label appuio.io/organization to label tenant_id label_replace( - # Fetch all namespaces with label appcat.vshn.io/servicename="{{.ServiceName}}" - kube_namespace_labels{label_appuio_io_organization=~".+", label_appcat_vshn_io_servicename="{{.ServiceName}}"}, + # Fetch all namespaces with label appcat.vshn.io/billing-name="{{.ServiceName}}" + kube_namespace_labels{label_appuio_io_organization=~".+", label_appcat_vshn_io_billing_name="{{.ServiceName}}"} * on (namespace) group_right(label_appuio_io_organization,label_appcat_vshn_io_claim_namespace,label_appcat_vshn_io_sla,product,provider,architecture, category, claim_namespace, tenant_id) kube_pod_info{created_by_kind!="Job"}, "tenant_id", "$1", "label_appuio_io_organization", @@ -61,4 +62,4 @@ sum_over_time( "claim_namespace", "architecture" )[59m:1m] -)/60 +)/60 ) \ No newline at end of file