From fd07319a2160af58647556ef7ee377f1212be71d Mon Sep 17 00:00:00 2001 From: Khue Duong Date: Thu, 30 Oct 2025 15:20:50 +1100 Subject: [PATCH] fix: add OTEL environment variables to helm chart and addDEFAULT_LOGGING_CONFIG_DICT --- charts/gitops/templates/deployment.yml | 27 ++++++++++++++++++++++++++ gitops_server/main.py | 1 + 2 files changed, 28 insertions(+) diff --git a/charts/gitops/templates/deployment.yml b/charts/gitops/templates/deployment.yml index cda4714..2e90073 100644 --- a/charts/gitops/templates/deployment.yml +++ b/charts/gitops/templates/deployment.yml @@ -70,6 +70,33 @@ spec: secretKeyRef: name: {{ .Release.Name }}-secret key: GITHUB_WEBHOOK_KEY + - name: NODE_IP + valueFrom: + fieldRef: + fieldPath: status.hostIP + - name: OTEL_EXPORTER_OTLP_ENDPOINT + value: "http://$(NODE_IP):4317" + - name: OTEL_PYTHON_LOG_CORRELATION + value: "True" + - name: OTEL_PYTHON_LOGGING_AUTO_INSTRUMENTATION_ENABLED + value: "True" + - name: OTEL_LOGS_EXPORTER + value: "otlp" + - name: OTEL_METRICS_EXPORTER + value: "none" + - name: OTEL_TRACES_EXPORTER + value: "otlp" + - name: OTEL_SERVICE_NAME + value: "gitops" + - name: OTEL_EXPORTER_OTLP_TIMEOUT + value: "1" + - name: OTEL_RESOURCE_ATTRIBUTES: + value: "cluster={{.Values.cluster}}" + # We want to limit the length of the attributes so that we don't store too much + - name: OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT + value: "512" + - name: OTEL_PYTHON_EXCLUDED_URLS + value: "pingz,livez,readyz,metrics,robots.txt,favicon.ico" volumeMounts: - name: git-crypt-key mountPath: "/etc/gitops" diff --git a/gitops_server/main.py b/gitops_server/main.py index 341391e..faebb3c 100644 --- a/gitops_server/main.py +++ b/gitops_server/main.py @@ -15,6 +15,7 @@ from gitops_server.app import app from gitops_server.workers import DeployQueueWorker +LOGGING = DEFAULT_LOGGING_CONFIG_DICT manually_instrument_logging() manually_instrument_fastapi()