From 8b6ab35b7834bf1dd2db9b230ab2c172d9bb5b81 Mon Sep 17 00:00:00 2001 From: "lukasz.widera@vshn.ch" Date: Tue, 25 Jun 2024 09:59:22 +0200 Subject: [PATCH 1/3] initial work --- component/class/defaults.yml | 2 +- component/component/cloud_billing.jsonnet | 59 +++++++++++++++++++ .../cloud_billing/20_cloudscale_exporter.yaml | 2 +- .../cloud_billing/30_cloudscale_alerts.yaml | 32 ++++++++++ .../cloud_billing/20_cloudscale_exporter.yaml | 2 +- .../cloud_billing/30_cloudscale_alerts.yaml | 32 ++++++++++ .../10_exoscale_dbaas_exporter.yaml | 2 +- .../20_exoscale_dbaas_alerts.yaml | 32 ++++++++++ .../20_exoscale_object_storage_exporter.yaml | 2 +- .../30_exoscale_object_storage_alerts.yaml | 32 ++++++++++ .../10_exoscale_dbaas_exporter.yaml | 2 +- .../20_exoscale_dbaas_alerts.yaml | 32 ++++++++++ .../20_exoscale_object_storage_exporter.yaml | 2 +- .../30_exoscale_object_storage_alerts.yaml | 32 ++++++++++ 14 files changed, 258 insertions(+), 7 deletions(-) create mode 100644 component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml create mode 100644 component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml diff --git a/component/class/defaults.yml b/component/class/defaults.yml index f2618b145..dda7851af 100644 --- a/component/class/defaults.yml +++ b/component/class/defaults.yml @@ -69,7 +69,7 @@ parameters: collector: registry: ghcr.io repository: vshn/billing-collector-cloudservices - tag: v3.2.0 + tag: addMetrics =_crd_version: ${appcat:images:appcat:tag} diff --git a/component/component/cloud_billing.jsonnet b/component/component/cloud_billing.jsonnet index b4f0ed62d..76783b3d7 100644 --- a/component/component/cloud_billing.jsonnet +++ b/component/component/cloud_billing.jsonnet @@ -161,6 +161,62 @@ local config(name, extraConfig) = kube.ConfigMap(name) { }, } + extraConfig; + +local alertOdoo = { + alert: 'HighOdooHTTPFailureRate', + expr: ||| + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + |||, + 'for': '1m', + labels: { + severity: 'critical', + syn_team: 'schedar', + }, + annotations: { + summary: 'High rate of Odoo HTTP failures detected', + description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) has increased significantly in the last minute.', + }, +}; + + +local alertProvider = { + alert: 'HighOdooHTTPFailureRate', + expr: ||| + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + |||, + 'for': '1m', + labels: { + severity: 'critical', + syn_team: 'schedar', + }, + annotations: { + summary: 'High rate of Odoo HTTP failures detected', + description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute.', + }, +}; + +local alertRule = { + apiVersion: 'monitoring.coreos.com/v1', + kind: 'PrometheusRule', + metadata: { + labels: {}, + name: 'cloudservices-billing', + namespace: params.namespace, + }, + spec: { + groups+: [ + { + name: 'odoo_http_failures', + rules: [ + alertOdoo, + alertProvider, + ], + }, + ], + }, +}; + + ({ local odoo = params.odoo, assert odoo.oauth != null : 'odoo.oauth must be set.', @@ -191,6 +247,7 @@ local config(name, extraConfig) = kube.ConfigMap(name) { '10_exoscale_dbaas_role_binding': sa.rb, '10_exoscale_dbaas_configmap': cm, '10_exoscale_dbaas_exporter': deployment(name, [ 'exoscale', 'dbaas' ], name + '-env'), + '20_exoscale_dbaas_alerts': alertRule, } else {}) + (if paramsCloud.exoscale.enabled && paramsCloud.exoscale.objectStorage.enabled then { @@ -217,6 +274,7 @@ local config(name, extraConfig) = kube.ConfigMap(name) { '10_exoscale_object_storage_rolebinding': sa.rb, '10_exoscale_object_storage_configmap': cm, '20_exoscale_object_storage_exporter': deployment(name, [ 'exoscale', 'objectstorage' ], name + '-env'), + '30_exoscale_object_storage_alerts': alertRule, } else {}) + @@ -244,4 +302,5 @@ local config(name, extraConfig) = kube.ConfigMap(name) { '10_cloudscale_rolebinding': sa.rb, '10_cloudscale_configmap': cm, '20_cloudscale_exporter': deployment(name, [ 'cloudscale', 'objectstorage' ], name + '-env'), + '30_cloudscale_alerts': alertRule, } else {}) diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml index d6ff0dbc4..20f853717 100644 --- a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml +++ b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml @@ -43,7 +43,7 @@ spec: name: cloudscale-env - secretRef: name: credentials-cloudscale - image: ghcr.io/vshn/billing-collector-cloudservices:v3.2.0 + image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics imagePullPolicy: IfNotPresent name: exporter ports: [] diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml new file mode 100644 index 000000000..2bcdca62d --- /dev/null +++ b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml @@ -0,0 +1,32 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {} + name: cloudservices-billing + namespace: syn-appcat +spec: + groups: + - name: odoo_http_failures + rules: + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml index d6ff0dbc4..20f853717 100644 --- a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml +++ b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml @@ -43,7 +43,7 @@ spec: name: cloudscale-env - secretRef: name: credentials-cloudscale - image: ghcr.io/vshn/billing-collector-cloudservices:v3.2.0 + image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics imagePullPolicy: IfNotPresent name: exporter ports: [] diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml new file mode 100644 index 000000000..2bcdca62d --- /dev/null +++ b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml @@ -0,0 +1,32 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {} + name: cloudservices-billing + namespace: syn-appcat +spec: + groups: + - name: odoo_http_failures + rules: + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml index 9edbc7aa1..95b4f8517 100644 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml @@ -43,7 +43,7 @@ spec: name: exoscale-dbaas-env - secretRef: name: credentials-exoscale-dbaas - image: ghcr.io/vshn/billing-collector-cloudservices:v3.2.0 + image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics imagePullPolicy: IfNotPresent name: exporter ports: [] diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml new file mode 100644 index 000000000..2bcdca62d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml @@ -0,0 +1,32 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {} + name: cloudservices-billing + namespace: syn-appcat +spec: + groups: + - name: odoo_http_failures + rules: + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml index 6ee2d3e96..4ab0fe268 100644 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml @@ -43,7 +43,7 @@ spec: name: exoscale-objectstorage-env - secretRef: name: credentials-exoscale-objectstorage - image: ghcr.io/vshn/billing-collector-cloudservices:v3.2.0 + image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics imagePullPolicy: IfNotPresent name: exporter ports: [] diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml new file mode 100644 index 000000000..2bcdca62d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml @@ -0,0 +1,32 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {} + name: cloudservices-billing + namespace: syn-appcat +spec: + groups: + - name: odoo_http_failures + rules: + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml index 9edbc7aa1..95b4f8517 100644 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml @@ -43,7 +43,7 @@ spec: name: exoscale-dbaas-env - secretRef: name: credentials-exoscale-dbaas - image: ghcr.io/vshn/billing-collector-cloudservices:v3.2.0 + image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics imagePullPolicy: IfNotPresent name: exporter ports: [] diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml new file mode 100644 index 000000000..2bcdca62d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml @@ -0,0 +1,32 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {} + name: cloudservices-billing + namespace: syn-appcat +spec: + groups: + - name: odoo_http_failures + rules: + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml index 6ee2d3e96..4ab0fe268 100644 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml @@ -43,7 +43,7 @@ spec: name: exoscale-objectstorage-env - secretRef: name: credentials-exoscale-objectstorage - image: ghcr.io/vshn/billing-collector-cloudservices:v3.2.0 + image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics imagePullPolicy: IfNotPresent name: exporter ports: [] diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml new file mode 100644 index 000000000..2bcdca62d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml @@ -0,0 +1,32 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PrometheusRule +metadata: + labels: {} + name: cloudservices-billing + namespace: syn-appcat +spec: + groups: + - name: odoo_http_failures + rules: + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar + - alert: HighOdooHTTPFailureRate + annotations: + description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) + has increased significantly in the last minute. + summary: High rate of Odoo HTTP failures detected + expr: | + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + for: 1m + labels: + severity: critical + syn_team: schedar From 2ef5d2e8dd51b348a6b3455f510a729599a4647e Mon Sep 17 00:00:00 2001 From: "lukasz.widera@vshn.ch" Date: Tue, 25 Jun 2024 11:54:44 +0200 Subject: [PATCH 2/3] adding pod monitor --- component/component/cloud_billing.jsonnet | 103 ++++++++++++------ .../40_cloudscale_podmonitor.yaml | 22 ++++ .../40_cloudscale_podmonitor.yaml | 22 ++++ .../30_exoscale_dbaas_podmonitor.yaml | 22 ++++ ...40_exoscale_object_storage_podmonitor.yaml | 22 ++++ .../30_exoscale_dbaas_podmonitor.yaml | 22 ++++ ...40_exoscale_object_storage_podmonitor.yaml | 22 ++++ 7 files changed, 199 insertions(+), 36 deletions(-) create mode 100644 component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml create mode 100644 component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml diff --git a/component/component/cloud_billing.jsonnet b/component/component/cloud_billing.jsonnet index 76783b3d7..b9fcde85c 100644 --- a/component/component/cloud_billing.jsonnet +++ b/component/component/cloud_billing.jsonnet @@ -161,40 +161,6 @@ local config(name, extraConfig) = kube.ConfigMap(name) { }, } + extraConfig; - -local alertOdoo = { - alert: 'HighOdooHTTPFailureRate', - expr: ||| - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 - |||, - 'for': '1m', - labels: { - severity: 'critical', - syn_team: 'schedar', - }, - annotations: { - summary: 'High rate of Odoo HTTP failures detected', - description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) has increased significantly in the last minute.', - }, -}; - - -local alertProvider = { - alert: 'HighOdooHTTPFailureRate', - expr: ||| - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 - |||, - 'for': '1m', - labels: { - severity: 'critical', - syn_team: 'schedar', - }, - annotations: { - summary: 'High rate of Odoo HTTP failures detected', - description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute.', - }, -}; - local alertRule = { apiVersion: 'monitoring.coreos.com/v1', kind: 'PrometheusRule', @@ -208,14 +174,76 @@ local alertRule = { { name: 'odoo_http_failures', rules: [ - alertOdoo, - alertProvider, + { + alert: 'HighOdooHTTPFailureRate', + expr: ||| + increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + |||, + 'for': '1m', + labels: { + severity: 'critical', + syn_team: 'schedar', + }, + annotations: { + summary: 'High rate of Odoo HTTP failures detected', + description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_odoo_failed_total`) has increased significantly in the last minute.', + }, + }, + { + alert: 'HighOdooHTTPFailureRate', + expr: ||| + increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + |||, + 'for': '1m', + labels: { + severity: 'critical', + syn_team: 'schedar', + }, + annotations: { + summary: 'High rate of Odoo HTTP failures detected', + description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute.', + }, + }, ], }, ], }, }; +local podMonitor = { + apiVersion: 'monitoring.coreos.com/v1', + kind: 'PodMonitor', + metadata: { + labels: null, + name: 'postgresql-podmonitor', + namespace: params.namespace, + }, + spec: { + namespaceSelector: { + matchNames: [ + params.namespace, + ], + }, + podMetricsEndpoints: [ + { + metricRelabelings: [ + { + action: 'keep', + regex: '(billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total)', + sourceLabels: [ + '__name__', + ], + }, + ], + port: 2112, + }, + ], + selector: { + matchLabels+: labels, + }, + }, +}; + ({ local odoo = params.odoo, @@ -248,6 +276,7 @@ local alertRule = { '10_exoscale_dbaas_configmap': cm, '10_exoscale_dbaas_exporter': deployment(name, [ 'exoscale', 'dbaas' ], name + '-env'), '20_exoscale_dbaas_alerts': alertRule, + '30_exoscale_dbaas_podmonitor': podMonitor, } else {}) + (if paramsCloud.exoscale.enabled && paramsCloud.exoscale.objectStorage.enabled then { @@ -275,6 +304,7 @@ local alertRule = { '10_exoscale_object_storage_configmap': cm, '20_exoscale_object_storage_exporter': deployment(name, [ 'exoscale', 'objectstorage' ], name + '-env'), '30_exoscale_object_storage_alerts': alertRule, + '40_exoscale_object_storage_podmonitor': podMonitor, } else {}) + @@ -303,4 +333,5 @@ local alertRule = { '10_cloudscale_configmap': cm, '20_cloudscale_exporter': deployment(name, [ 'cloudscale', 'objectstorage' ], name + '-env'), '30_cloudscale_alerts': alertRule, + '40_cloudscale_podmonitor': podMonitor, } else {}) diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml new file mode 100644 index 000000000..06105702d --- /dev/null +++ b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: null + name: postgresql-podmonitor + namespace: syn-appcat +spec: + namespaceSelector: + matchNames: + - syn-appcat + podMetricsEndpoints: + - metricRelabelings: + - action: keep + regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) + sourceLabels: + - __name__ + port: 2112 + selector: + matchLabels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml new file mode 100644 index 000000000..06105702d --- /dev/null +++ b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: null + name: postgresql-podmonitor + namespace: syn-appcat +spec: + namespaceSelector: + matchNames: + - syn-appcat + podMetricsEndpoints: + - metricRelabelings: + - action: keep + regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) + sourceLabels: + - __name__ + port: 2112 + selector: + matchLabels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml new file mode 100644 index 000000000..06105702d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: null + name: postgresql-podmonitor + namespace: syn-appcat +spec: + namespaceSelector: + matchNames: + - syn-appcat + podMetricsEndpoints: + - metricRelabelings: + - action: keep + regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) + sourceLabels: + - __name__ + port: 2112 + selector: + matchLabels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml new file mode 100644 index 000000000..06105702d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: null + name: postgresql-podmonitor + namespace: syn-appcat +spec: + namespaceSelector: + matchNames: + - syn-appcat + podMetricsEndpoints: + - metricRelabelings: + - action: keep + regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) + sourceLabels: + - __name__ + port: 2112 + selector: + matchLabels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml new file mode 100644 index 000000000..06105702d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: null + name: postgresql-podmonitor + namespace: syn-appcat +spec: + namespaceSelector: + matchNames: + - syn-appcat + podMetricsEndpoints: + - metricRelabelings: + - action: keep + regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) + sourceLabels: + - __name__ + port: 2112 + selector: + matchLabels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml new file mode 100644 index 000000000..06105702d --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml @@ -0,0 +1,22 @@ +apiVersion: monitoring.coreos.com/v1 +kind: PodMonitor +metadata: + labels: null + name: postgresql-podmonitor + namespace: syn-appcat +spec: + namespaceSelector: + matchNames: + - syn-appcat + podMetricsEndpoints: + - metricRelabelings: + - action: keep + regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) + sourceLabels: + - __name__ + port: 2112 + selector: + matchLabels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices From 090eb5d58a1e75b81a68dc3628ae56a524f476c5 Mon Sep 17 00:00:00 2001 From: "lukasz.widera@vshn.ch" Date: Wed, 3 Jul 2024 09:38:15 +0200 Subject: [PATCH 3/3] adding support for metrics scrapes --- component/class/defaults.yml | 2 +- component/component/cloud_billing.jsonnet | 89 ++++++++++++------- .../cloud_billing/20_cloudscale_exporter.yaml | 16 +++- .../cloud_billing/30_cloudscale_alerts.yaml | 15 ++-- .../40_cloudscale_podmonitor.yaml | 22 ----- .../40_cloudscale_servicemonitor.yaml | 16 ++++ .../cloud_billing/20_cloudscale_exporter.yaml | 16 +++- .../cloud_billing/30_cloudscale_alerts.yaml | 15 ++-- .../40_cloudscale_podmonitor.yaml | 22 ----- .../40_cloudscale_servicemonitor.yaml | 16 ++++ .../10_exoscale_dbaas_exporter.yaml | 16 +++- .../20_exoscale_dbaas_alerts.yaml | 15 ++-- .../20_exoscale_object_storage_exporter.yaml | 16 +++- .../30_exoscale_dbaas_podmonitor.yaml | 22 ----- .../30_exoscale_dbaas_servicemonitor.yaml | 16 ++++ .../30_exoscale_object_storage_alerts.yaml | 15 ++-- ...40_exoscale_object_storage_podmonitor.yaml | 22 ----- ...xoscale_object_storage_servicemonitor.yaml | 16 ++++ .../10_exoscale_dbaas_exporter.yaml | 16 +++- .../20_exoscale_dbaas_alerts.yaml | 15 ++-- .../20_exoscale_object_storage_exporter.yaml | 16 +++- .../30_exoscale_dbaas_podmonitor.yaml | 22 ----- .../30_exoscale_dbaas_servicemonitor.yaml | 16 ++++ .../30_exoscale_object_storage_alerts.yaml | 15 ++-- ...40_exoscale_object_storage_podmonitor.yaml | 22 ----- ...xoscale_object_storage_servicemonitor.yaml | 16 ++++ 26 files changed, 300 insertions(+), 205 deletions(-) delete mode 100644 component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml create mode 100644 component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml delete mode 100644 component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml create mode 100644 component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml delete mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml delete mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml delete mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml delete mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml create mode 100644 component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml diff --git a/component/class/defaults.yml b/component/class/defaults.yml index dda7851af..76924c3e6 100644 --- a/component/class/defaults.yml +++ b/component/class/defaults.yml @@ -69,7 +69,7 @@ parameters: collector: registry: ghcr.io repository: vshn/billing-collector-cloudservices - tag: addMetrics + tag: v3.4.0 =_crd_version: ${appcat:images:appcat:tag} diff --git a/component/component/cloud_billing.jsonnet b/component/component/cloud_billing.jsonnet index b9fcde85c..961388187 100644 --- a/component/component/cloud_billing.jsonnet +++ b/component/component/cloud_billing.jsonnet @@ -115,7 +115,7 @@ local serviceAccount(name, clusterRole) = { local deployment(name, args, config) = kube.Deployment(name) { metadata+: { - labels+: labels, + labels+: labels { 'automated-billing': 'true' }, namespace: params.namespace, }, spec+: { @@ -127,6 +127,18 @@ local deployment(name, args, config) = imagePullPolicy: 'IfNotPresent', image: collectorImage, args: args, + // add resource limits + // during my local tests it consumes arround 50% of requests{} values + resources: { + limits: { + cpu: '250m', + memory: '256Mi', + }, + requests: { + cpu: '100m', + memory: '128Mi', + }, + }, envFrom: [ { configMapRef: { @@ -139,6 +151,12 @@ local deployment(name, args, config) = }, }, ], + ports: [ + { + containerPort: 2112, + protocol: 'TCP', + }, + ], }, }, }, @@ -146,6 +164,30 @@ local deployment(name, args, config) = }, }; + +local service = { + apiVersion: 'v1', + kind: 'Service', + metadata: { + labels: labels { 'automated-billing': 'true' }, + name: 'automated-billing', + namespace: params.namespace, + }, + spec: { + ports: [ + { + name: 'metrics', + port: 2112, + protocol: 'TCP', + targetPort: 2112, + }, + ], + selector: { + 'automated-billing': 'true', + }, + }, +}; + local config(name, extraConfig) = kube.ConfigMap(name) { metadata: { name: name, @@ -165,7 +207,7 @@ local alertRule = { apiVersion: 'monitoring.coreos.com/v1', kind: 'PrometheusRule', metadata: { - labels: {}, + labels: labels { 'automated-billing': 'true' }, name: 'cloudservices-billing', namespace: params.namespace, }, @@ -177,7 +219,7 @@ local alertRule = { { alert: 'HighOdooHTTPFailureRate', expr: ||| - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 |||, 'for': '1m', labels: { @@ -190,9 +232,9 @@ local alertRule = { }, }, { - alert: 'HighOdooHTTPFailureRate', + alert: 'HighProviderHTTPFailureRate', expr: ||| - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 |||, 'for': '1m', labels: { @@ -200,7 +242,7 @@ local alertRule = { syn_team: 'schedar', }, annotations: { - summary: 'High rate of Odoo HTTP failures detected', + summary: "High rate of Automated-billing collector's providers HTTP failures detected", description: 'The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute.', }, }, @@ -210,36 +252,23 @@ local alertRule = { }, }; -local podMonitor = { + +local serviceMonitor = { apiVersion: 'monitoring.coreos.com/v1', - kind: 'PodMonitor', + kind: 'ServiceMonitor', metadata: { - labels: null, - name: 'postgresql-podmonitor', + labels: labels { 'automated-billing': 'true' }, + name: 'cloudservices-servicemonitor', namespace: params.namespace, }, spec: { - namespaceSelector: { - matchNames: [ - params.namespace, - ], - }, - podMetricsEndpoints: [ + endpoints: [ { - metricRelabelings: [ - { - action: 'keep', - regex: '(billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total)', - sourceLabels: [ - '__name__', - ], - }, - ], - port: 2112, + port: 'metrics', }, ], selector: { - matchLabels+: labels, + matchLabels+: { 'automated-billing': 'true' }, }, }, }; @@ -276,7 +305,7 @@ local podMonitor = { '10_exoscale_dbaas_configmap': cm, '10_exoscale_dbaas_exporter': deployment(name, [ 'exoscale', 'dbaas' ], name + '-env'), '20_exoscale_dbaas_alerts': alertRule, - '30_exoscale_dbaas_podmonitor': podMonitor, + '30_exoscale_dbaas_servicemonitor': serviceMonitor, } else {}) + (if paramsCloud.exoscale.enabled && paramsCloud.exoscale.objectStorage.enabled then { @@ -304,7 +333,7 @@ local podMonitor = { '10_exoscale_object_storage_configmap': cm, '20_exoscale_object_storage_exporter': deployment(name, [ 'exoscale', 'objectstorage' ], name + '-env'), '30_exoscale_object_storage_alerts': alertRule, - '40_exoscale_object_storage_podmonitor': podMonitor, + '40_exoscale_object_storage_servicemonitor': serviceMonitor, } else {}) + @@ -333,5 +362,5 @@ local podMonitor = { '10_cloudscale_configmap': cm, '20_cloudscale_exporter': deployment(name, [ 'cloudscale', 'objectstorage' ], name + '-env'), '30_cloudscale_alerts': alertRule, - '40_cloudscale_podmonitor': podMonitor, + '40_cloudscale_servicemonitor': serviceMonitor, } else {}) diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml index 20f853717..61d659082 100644 --- a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml +++ b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml @@ -6,6 +6,7 @@ metadata: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudscale name: cloudscale namespace: syn-appcat @@ -18,6 +19,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudscale strategy: rollingUpdate: @@ -31,6 +33,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudscale spec: containers: @@ -43,10 +46,19 @@ spec: name: cloudscale-env - secretRef: name: credentials-cloudscale - image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics + image: ghcr.io/vshn/billing-collector-cloudservices:v3.4.0 imagePullPolicy: IfNotPresent name: exporter - ports: [] + ports: + - containerPort: 2112 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi stdin: false tty: false volumeMounts: [] diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml index 2bcdca62d..44b3d182e 100644 --- a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml +++ b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml @@ -1,7 +1,11 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - labels: {} + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudservices-billing namespace: syn-appcat spec: @@ -14,18 +18,19 @@ spec: has increased significantly in the last minute. summary: High rate of Odoo HTTP failures detected expr: | - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 for: 1m labels: severity: critical syn_team: schedar - - alert: HighOdooHTTPFailureRate + - alert: HighProviderHTTPFailureRate annotations: description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute. - summary: High rate of Odoo HTTP failures detected + summary: High rate of Automated-billing collector's providers HTTP failures + detected expr: | - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 for: 1m labels: severity: critical diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml deleted file mode 100644 index 06105702d..000000000 --- a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - labels: null - name: postgresql-podmonitor - namespace: syn-appcat -spec: - namespaceSelector: - matchNames: - - syn-appcat - podMetricsEndpoints: - - metricRelabelings: - - action: keep - regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) - sourceLabels: - - __name__ - port: 2112 - selector: - matchLabels: - app.kubernetes.io/component: billing-collector-cloudservices - app.kubernetes.io/managed-by: commodore - app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml new file mode 100644 index 000000000..276131365 --- /dev/null +++ b/component/tests/golden/cloudscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' + name: cloudservices-servicemonitor + namespace: syn-appcat +spec: + endpoints: + - port: metrics + selector: + matchLabels: + automated-billing: 'true' diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml index 20f853717..61d659082 100644 --- a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml +++ b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_cloudscale_exporter.yaml @@ -6,6 +6,7 @@ metadata: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudscale name: cloudscale namespace: syn-appcat @@ -18,6 +19,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudscale strategy: rollingUpdate: @@ -31,6 +33,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudscale spec: containers: @@ -43,10 +46,19 @@ spec: name: cloudscale-env - secretRef: name: credentials-cloudscale - image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics + image: ghcr.io/vshn/billing-collector-cloudservices:v3.4.0 imagePullPolicy: IfNotPresent name: exporter - ports: [] + ports: + - containerPort: 2112 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi stdin: false tty: false volumeMounts: [] diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml index 2bcdca62d..44b3d182e 100644 --- a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml +++ b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_cloudscale_alerts.yaml @@ -1,7 +1,11 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - labels: {} + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudservices-billing namespace: syn-appcat spec: @@ -14,18 +18,19 @@ spec: has increased significantly in the last minute. summary: High rate of Odoo HTTP failures detected expr: | - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 for: 1m labels: severity: critical syn_team: schedar - - alert: HighOdooHTTPFailureRate + - alert: HighProviderHTTPFailureRate annotations: description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute. - summary: High rate of Odoo HTTP failures detected + summary: High rate of Automated-billing collector's providers HTTP failures + detected expr: | - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 for: 1m labels: severity: critical diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml deleted file mode 100644 index 06105702d..000000000 --- a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_podmonitor.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - labels: null - name: postgresql-podmonitor - namespace: syn-appcat -spec: - namespaceSelector: - matchNames: - - syn-appcat - podMetricsEndpoints: - - metricRelabelings: - - action: keep - regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) - sourceLabels: - - __name__ - port: 2112 - selector: - matchLabels: - app.kubernetes.io/component: billing-collector-cloudservices - app.kubernetes.io/managed-by: commodore - app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml new file mode 100644 index 000000000..276131365 --- /dev/null +++ b/component/tests/golden/cloudscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_cloudscale_servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' + name: cloudservices-servicemonitor + namespace: syn-appcat +spec: + endpoints: + - port: metrics + selector: + matchLabels: + automated-billing: 'true' diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml index 95b4f8517..bd0e276fd 100644 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml @@ -6,6 +6,7 @@ metadata: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-dbaas name: exoscale-dbaas namespace: syn-appcat @@ -18,6 +19,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-dbaas strategy: rollingUpdate: @@ -31,6 +33,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-dbaas spec: containers: @@ -43,10 +46,19 @@ spec: name: exoscale-dbaas-env - secretRef: name: credentials-exoscale-dbaas - image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics + image: ghcr.io/vshn/billing-collector-cloudservices:v3.4.0 imagePullPolicy: IfNotPresent name: exporter - ports: [] + ports: + - containerPort: 2112 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi stdin: false tty: false volumeMounts: [] diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml index 2bcdca62d..44b3d182e 100644 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml @@ -1,7 +1,11 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - labels: {} + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudservices-billing namespace: syn-appcat spec: @@ -14,18 +18,19 @@ spec: has increased significantly in the last minute. summary: High rate of Odoo HTTP failures detected expr: | - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 for: 1m labels: severity: critical syn_team: schedar - - alert: HighOdooHTTPFailureRate + - alert: HighProviderHTTPFailureRate annotations: description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute. - summary: High rate of Odoo HTTP failures detected + summary: High rate of Automated-billing collector's providers HTTP failures + detected expr: | - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 for: 1m labels: severity: critical diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml index 4ab0fe268..2abed815a 100644 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml @@ -6,6 +6,7 @@ metadata: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-objectstorage name: exoscale-objectstorage namespace: syn-appcat @@ -18,6 +19,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-objectstorage strategy: rollingUpdate: @@ -31,6 +33,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-objectstorage spec: containers: @@ -43,10 +46,19 @@ spec: name: exoscale-objectstorage-env - secretRef: name: credentials-exoscale-objectstorage - image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics + image: ghcr.io/vshn/billing-collector-cloudservices:v3.4.0 imagePullPolicy: IfNotPresent name: exporter - ports: [] + ports: + - containerPort: 2112 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi stdin: false tty: false volumeMounts: [] diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml deleted file mode 100644 index 06105702d..000000000 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - labels: null - name: postgresql-podmonitor - namespace: syn-appcat -spec: - namespaceSelector: - matchNames: - - syn-appcat - podMetricsEndpoints: - - metricRelabelings: - - action: keep - regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) - sourceLabels: - - __name__ - port: 2112 - selector: - matchLabels: - app.kubernetes.io/component: billing-collector-cloudservices - app.kubernetes.io/managed-by: commodore - app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml new file mode 100644 index 000000000..276131365 --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' + name: cloudservices-servicemonitor + namespace: syn-appcat +spec: + endpoints: + - port: metrics + selector: + matchLabels: + automated-billing: 'true' diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml index 2bcdca62d..44b3d182e 100644 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml @@ -1,7 +1,11 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - labels: {} + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudservices-billing namespace: syn-appcat spec: @@ -14,18 +18,19 @@ spec: has increased significantly in the last minute. summary: High rate of Odoo HTTP failures detected expr: | - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 for: 1m labels: severity: critical syn_team: schedar - - alert: HighOdooHTTPFailureRate + - alert: HighProviderHTTPFailureRate annotations: description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute. - summary: High rate of Odoo HTTP failures detected + summary: High rate of Automated-billing collector's providers HTTP failures + detected expr: | - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 for: 1m labels: severity: critical diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml deleted file mode 100644 index 06105702d..000000000 --- a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - labels: null - name: postgresql-podmonitor - namespace: syn-appcat -spec: - namespaceSelector: - matchNames: - - syn-appcat - podMetricsEndpoints: - - metricRelabelings: - - action: keep - regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) - sourceLabels: - - __name__ - port: 2112 - selector: - matchLabels: - app.kubernetes.io/component: billing-collector-cloudservices - app.kubernetes.io/managed-by: commodore - app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml new file mode 100644 index 000000000..276131365 --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-cloud/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' + name: cloudservices-servicemonitor + namespace: syn-appcat +spec: + endpoints: + - port: metrics + selector: + matchLabels: + automated-billing: 'true' diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml index 95b4f8517..bd0e276fd 100644 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/10_exoscale_dbaas_exporter.yaml @@ -6,6 +6,7 @@ metadata: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-dbaas name: exoscale-dbaas namespace: syn-appcat @@ -18,6 +19,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-dbaas strategy: rollingUpdate: @@ -31,6 +33,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-dbaas spec: containers: @@ -43,10 +46,19 @@ spec: name: exoscale-dbaas-env - secretRef: name: credentials-exoscale-dbaas - image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics + image: ghcr.io/vshn/billing-collector-cloudservices:v3.4.0 imagePullPolicy: IfNotPresent name: exporter - ports: [] + ports: + - containerPort: 2112 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi stdin: false tty: false volumeMounts: [] diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml index 2bcdca62d..44b3d182e 100644 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_dbaas_alerts.yaml @@ -1,7 +1,11 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - labels: {} + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudservices-billing namespace: syn-appcat spec: @@ -14,18 +18,19 @@ spec: has increased significantly in the last minute. summary: High rate of Odoo HTTP failures detected expr: | - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 for: 1m labels: severity: critical syn_team: schedar - - alert: HighOdooHTTPFailureRate + - alert: HighProviderHTTPFailureRate annotations: description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute. - summary: High rate of Odoo HTTP failures detected + summary: High rate of Automated-billing collector's providers HTTP failures + detected expr: | - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 for: 1m labels: severity: critical diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml index 4ab0fe268..2abed815a 100644 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/20_exoscale_object_storage_exporter.yaml @@ -6,6 +6,7 @@ metadata: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-objectstorage name: exoscale-objectstorage namespace: syn-appcat @@ -18,6 +19,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-objectstorage strategy: rollingUpdate: @@ -31,6 +33,7 @@ spec: app.kubernetes.io/component: billing-collector-cloudservices app.kubernetes.io/managed-by: commodore app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: exoscale-objectstorage spec: containers: @@ -43,10 +46,19 @@ spec: name: exoscale-objectstorage-env - secretRef: name: credentials-exoscale-objectstorage - image: ghcr.io/vshn/billing-collector-cloudservices:addMetrics + image: ghcr.io/vshn/billing-collector-cloudservices:v3.4.0 imagePullPolicy: IfNotPresent name: exporter - ports: [] + ports: + - containerPort: 2112 + protocol: TCP + resources: + limits: + cpu: 250m + memory: 256Mi + requests: + cpu: 100m + memory: 128Mi stdin: false tty: false volumeMounts: [] diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml deleted file mode 100644 index 06105702d..000000000 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_podmonitor.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - labels: null - name: postgresql-podmonitor - namespace: syn-appcat -spec: - namespaceSelector: - matchNames: - - syn-appcat - podMetricsEndpoints: - - metricRelabelings: - - action: keep - regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) - sourceLabels: - - __name__ - port: 2112 - selector: - matchLabels: - app.kubernetes.io/component: billing-collector-cloudservices - app.kubernetes.io/managed-by: commodore - app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml new file mode 100644 index 000000000..276131365 --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_dbaas_servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' + name: cloudservices-servicemonitor + namespace: syn-appcat +spec: + endpoints: + - port: metrics + selector: + matchLabels: + automated-billing: 'true' diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml index 2bcdca62d..44b3d182e 100644 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/30_exoscale_object_storage_alerts.yaml @@ -1,7 +1,11 @@ apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: - labels: {} + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' name: cloudservices-billing namespace: syn-appcat spec: @@ -14,18 +18,19 @@ spec: has increased significantly in the last minute. summary: High rate of Odoo HTTP failures detected expr: | - increase(billing_cloud_collector_http_requests_odoo_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_odoo_failed_total != 0 for: 1m labels: severity: critical syn_team: schedar - - alert: HighOdooHTTPFailureRate + - alert: HighProviderHTTPFailureRate annotations: description: The rate of failed Odoo HTTP requests (`billing_cloud_collector_http_requests_provider_failed_total`) has increased significantly in the last minute. - summary: High rate of Odoo HTTP failures detected + summary: High rate of Automated-billing collector's providers HTTP failures + detected expr: | - increase(billing_cloud_collector_http_requests_provider_failed_total[1m]) > 0 + billing_cloud_collector_http_requests_provider_failed_total != 0 for: 1m labels: severity: critical diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml deleted file mode 100644 index 06105702d..000000000 --- a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_podmonitor.yaml +++ /dev/null @@ -1,22 +0,0 @@ -apiVersion: monitoring.coreos.com/v1 -kind: PodMonitor -metadata: - labels: null - name: postgresql-podmonitor - namespace: syn-appcat -spec: - namespaceSelector: - matchNames: - - syn-appcat - podMetricsEndpoints: - - metricRelabelings: - - action: keep - regex: (billing_cloud_collector_http_requests_odoo_failed_total|billing_cloud_collector_http_requests_odoo_succeeded_total|billing_cloud_collector_http_requests_provider_failed_total|billing_cloud_collector_http_requests_provider_succeeded_total) - sourceLabels: - - __name__ - port: 2112 - selector: - matchLabels: - app.kubernetes.io/component: billing-collector-cloudservices - app.kubernetes.io/managed-by: commodore - app.kubernetes.io/name: billing-collector-cloudservices diff --git a/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml new file mode 100644 index 000000000..276131365 --- /dev/null +++ b/component/tests/golden/exoscale-metrics-collector-managed/appcat/appcat/cloud_billing/40_exoscale_object_storage_servicemonitor.yaml @@ -0,0 +1,16 @@ +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + app.kubernetes.io/component: billing-collector-cloudservices + app.kubernetes.io/managed-by: commodore + app.kubernetes.io/name: billing-collector-cloudservices + automated-billing: 'true' + name: cloudservices-servicemonitor + namespace: syn-appcat +spec: + endpoints: + - port: metrics + selector: + matchLabels: + automated-billing: 'true'