From bcfe6ec42ebb487db879ad9be3301295207aadf0 Mon Sep 17 00:00:00 2001 From: sgayangi Date: Fri, 1 Mar 2024 15:55:13 +0530 Subject: [PATCH] Add Prometheus support to ratelimiter --- .../ratelimiter/ratelimiter-deployment.yaml | 16 +++++++++++++++- helm-charts/values.yaml | 12 ++++++++++++ helm-charts/values.yaml.template | 13 +++++++++++++ 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/helm-charts/templates/data-plane/ratelimiter/ratelimiter-deployment.yaml b/helm-charts/templates/data-plane/ratelimiter/ratelimiter-deployment.yaml index 7f15be10f6..5821cb0c13 100644 --- a/helm-charts/templates/data-plane/ratelimiter/ratelimiter-deployment.yaml +++ b/helm-charts/templates/data-plane/ratelimiter/ratelimiter-deployment.yaml @@ -35,6 +35,14 @@ spec: automountServiceAccountToken: false serviceAccountName: {{ .Values.wso2.apk.auth.serviceAccountName }} containers: + {{if and .Values.wso2.apk.metrics.enabled .Values.wso2.apk.metrics.statsd.enabled }} + - name: statsd + image: {{ .Values.wso2.apk.metrics.statsd.image.repository }}:{{ .Values.wso2.apk.metrics.statsd.image.tag }} + imagePullPolicy: {{ .Values.wso2.apk.metrics.statsd.imagePullPolicy }} + ports: + - name: statsd-metrics + containerPort: 9102 + {{ end }} - name: ratelimiter image: {{ .Values.wso2.apk.dp.ratelimiter.deployment.image }} imagePullPolicy: {{ .Values.wso2.apk.dp.ratelimiter.deployment.imagePullPolicy }} @@ -52,7 +60,13 @@ spec: - name: PORT value: "8090" - name: USE_STATSD - value: "false" + value: "{{ and .Values.wso2.apk.metrics.enabled .Values.wso2.apk.metrics.statsd.enabled }}" + {{if and .Values.wso2.apk.metrics.enabled .Values.wso2.apk.metrics.statsd.enabled }} + - name: STATSD_HOST + value: "0.0.0.0" + - name: STATSD_PORT + value: "9125" + {{- end}} - name: LOG_LEVEL value: "DEBUG" - name: LIMIT_RESPONSE_HEADERS_ENABLED diff --git a/helm-charts/values.yaml b/helm-charts/values.yaml index efa7dfdb10..878f52adf4 100644 --- a/helm-charts/values.yaml +++ b/helm-charts/values.yaml @@ -246,6 +246,18 @@ wso2: enabled: false # configDSBalHost: 0.0.0.0 # idpDSBalHost: 0.0.0.0 + # statsd: + # enabled: true + # image: + # repository: prom/statsd-exporter + # tag: v0.26.0 + # imagePullPolicy: IfNotPresent + # resources: + # limits: + # memory: 128Mi + # requests: + # cpu: 0.1 + # memory: 64Mi idp: enabled: true diff --git a/helm-charts/values.yaml.template b/helm-charts/values.yaml.template index aa0b5cde6d..7110476bd8 100644 --- a/helm-charts/values.yaml.template +++ b/helm-charts/values.yaml.template @@ -594,6 +594,19 @@ wso2: # configDSBalHost: 0.0.0.0 # -- Configure the host for exposing the idp ds ballerina metrics. # idpDSBalHost: 0.0.0.0 + # -- Statsd is required to expose metrics from ratelimiter + # statsd: + # enabled: true + # image: + # repository: prom/statsd-exporter + # tag: v0.26.0 + # imagePullPolicy: IfNotPresent + # resources: + # limits: + # memory: 128Mi + # requests: + # cpu: 0.1 + # memory: 64Mi idp: # -- Enable Non production identity server