diff --git a/charts/coprocessor-sql-exporter/Chart.yaml b/charts/coprocessor-sql-exporter/Chart.yaml new file mode 100644 index 0000000000..e7edaefe5e --- /dev/null +++ b/charts/coprocessor-sql-exporter/Chart.yaml @@ -0,0 +1,10 @@ +apiVersion: v2 +name: fhevm-sql-exporter +description: A Helm chart for Kubernetes +type: application +version: 1.0.0 +appVersion: "1.16.0" +dependencies: + - name: prometheus-sql-exporter + repository: oci://ghcr.io/prometheus-community/charts + version: 0.4.0 diff --git a/charts/coprocessor-sql-exporter/config/config.yml b/charts/coprocessor-sql-exporter/config/config.yml new file mode 100644 index 0000000000..94b3ebec2b --- /dev/null +++ b/charts/coprocessor-sql-exporter/config/config.yml @@ -0,0 +1,85 @@ +# This configuration can be tested with https://github.com/justwatchcom/sql_exporter +# Configuration reference: https://github.com/justwatchcom/sql_exporter/blob/master/config.yml.dist +jobs: + - name: "coprocessor-database" + interval: '30s' + connections: + - 'postgres://{{DATABASE_USERNAME}}:{{DATABASE_PASSWORD}}@{{DATABASE_ENDPOINT}}/{{DATABASE_NAME}}' + startup_sql: + - 'SET lock_timeout = 1000' + - 'SET idle_in_transaction_session_timeout = 100' + queries: + - name: "allowed_handles_txn_sent" + help: "Number of allowed handles transactions sent" + labels: + - "status" + values: + - "count" + query: | + SELECT 'txn_sent' AS status, count(*)::float + FROM allowed_handles + WHERE txn_is_sent = true + UNION ALL + SELECT 'txn_unsent' AS status, count(*)::float + FROM allowed_handles + WHERE txn_is_sent = false; + - name: "ciphertext_txn_sent" + help: "Number of ciphertext transactions sent" + labels: + - "status" + values: + - "count" + query: | + SELECT 'txn_sent' AS status, count(*)::float + FROM ciphertext_digest + WHERE txn_is_sent = true + UNION ALL + SELECT 'txn_unsent' AS status, count(*)::float + FROM ciphertext_digest + WHERE txn_is_sent = false; + - name: "computations_completion" + help: "Number of computations done" + labels: + - "status" + values: + - "count" + query: | + SELECT 'completed' AS status, COUNT(*)::float + FROM computations + WHERE is_completed = true + UNION ALL + SELECT 'uncompleted', COUNT(*)::float + FROM computations + WHERE is_completed = false; + - name: "pbs_completion" + help: "Number of PBS done" + labels: + - "status" + values: + - "count" + query: | + SELECT 'completed' AS status, COUNT(*)::float + FROM pbs_computations + WHERE is_completed = true + UNION ALL + SELECT 'uncompleted', COUNT(*)::float + FROM pbs_computations + WHERE is_completed = false; + - name: "ciphertexts" + help: "Number of ciphertexts in ciphertexts table" + labels: + - "status" + values: + - "count" + query: | + SELECT COUNT(*)::float + FROM ciphertexts; + - name: "zkproof" + help: "Number of remaining ZK-Proof to process" + labels: + - "status" + values: + - "count" + query: | + SELECT COUNT(*)::float + FROM verify_proofs; \ No newline at end of file diff --git a/charts/coprocessor-sql-exporter/templates/configmap.yaml b/charts/coprocessor-sql-exporter/templates/configmap.yaml new file mode 100644 index 0000000000..6bea14325e --- /dev/null +++ b/charts/coprocessor-sql-exporter/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: coprocessor-sql-exporter-config +data: + config: |- +{{ .Files.Get "config/config.yml" | indent 4 }} diff --git a/charts/coprocessor-sql-exporter/values.yaml b/charts/coprocessor-sql-exporter/values.yaml new file mode 100644 index 0000000000..ce637214b0 --- /dev/null +++ b/charts/coprocessor-sql-exporter/values.yaml @@ -0,0 +1,38 @@ +prometheus-sql-exporter: + replicaCount: 1 + + image: + repository: ghcr.io/justwatchcom/sql_exporter + tag: "v0.9" + + serviceMonitor: + enabled: true + interval: 30s + + extraEnvs: + - name: DATABASE_ENDPOINT + valueFrom: + secretKeyRef: + name: database-credentials + key: endpoint + - name: DATABASE_USERNAME + valueFrom: + secretKeyRef: + name: database-credentials + key: username + - name: DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: database-credentials + key: password + - name: DATABASE_NAME + value: "coprocessor" + extraVolumes: + - name: custom-config + configMap: + name: coprocessor-sql-exporter-config + extraVolumeMounts: + - name: custom-config + mountPath: /custom-config.yml + subPath: config + configFilePath: "/custom-config.yml"