From ca9cef198021e232e7fcb9042f5408edfb8a7953 Mon Sep 17 00:00:00 2001 From: Vincent SELLIER <vincent.sellier@softwareheritage.org> Date: Thu, 16 Mar 2023 15:35:15 +0100 Subject: [PATCH] graphq: Configure the statsd properties to have the metrics in prometheus Related to swh/infra/sysadm-environment#4804 --- swh/templates/graphql/deployment.yaml | 4 ++++ swh/tests/graphql_deployment_test.yaml | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/swh/templates/graphql/deployment.yaml b/swh/templates/graphql/deployment.yaml index 1f109d695..9bf1cfcb1 100644 --- a/swh/templates/graphql/deployment.yaml +++ b/swh/templates/graphql/deployment.yaml @@ -45,6 +45,10 @@ spec: initialDelaySeconds: 10 periodSeconds: 5 env: + - name: STATSD_HOST + value: {{ $.Values.statsdExternalHost | default "prometheus-statsd-exporter" }} + - name: STATSD_PORT + value: {{ $.Values.statsdPort | default "9125" | quote }} - name: PORT value: "5013" - name: LOG_LEVEL diff --git a/swh/tests/graphql_deployment_test.yaml b/swh/tests/graphql_deployment_test.yaml index 7c32616af..ffbc14b6a 100644 --- a/swh/tests/graphql_deployment_test.yaml +++ b/swh/tests/graphql_deployment_test.yaml @@ -29,6 +29,12 @@ tests: - equal: path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "LOG_LEVEL")].value value: "INFO" + - equal: + path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "STATSD_HOST")].value + value: prometheus-statsd-exporter + - equal: + path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "STATSD_PORT")].value + value: "9125" - isNull: path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "THREADS")] - isNull: @@ -83,7 +89,7 @@ tests: path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "SWH_SENTRY_DSN")].valueFrom.secretKeyRef.key value: graphql-sentry-dsn - - it: Graphql sentry default configuration + - it: Graphql sentry overridden configuration templates: - graphql/deployment.yaml set: @@ -107,3 +113,20 @@ tests: - equal: path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "SWH_SENTRY_DSN")].valueFrom.secretKeyRef.key value: my-key + + - it: Graphql statsd overridden configuration + templates: + - graphql/deployment.yaml + set: + graphql.enabled: true + swh_graphql_image: image + swh_graphql_image_version: version + statsdExternalHost: my-statsd-host + statsdPort: 9999 + asserts: + - equal: + path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "STATSD_HOST")].value + value: my-statsd-host + - equal: + path: spec.template.spec.containers[?(@.name == "graphql")].env[?(@.name == "STATSD_PORT")].value + value: "9999" -- GitLab