Skip to content

fix(helm): disable tracing when otel.tracing.enabled is false - #109

Open
lbarrosby wants to merge 1 commit into
kagent-dev:mainfrom
lbarrosby:helm-drop-unread-env
Open

lbarrosby wants to merge 1 commit into
kagent-dev:mainfrom
lbarrosby:helm-drop-unread-env

Conversation

@lbarrosby

Copy link
Copy Markdown
Contributor

Fixes #92.

otel.tracing.enabled was rendered as OTEL_TRACING_ENABLED, which nothing reads. The server only switches tracing off on OTEL_SDK_DISABLED (internal/telemetry/config.go), so on a default install (enabled: false, endpoint http://host.docker.internal:4317) SetupOTelSDK still built a gRPC exporter for that host. Inside a cluster it does not resolve, and the pod logs traces export: ... name resolver error timeouts, the same lines as in #27. Just dropping the endpoint would not help either: with no endpoint the server falls back to the pretty-printed stdout exporter.

Changes in the chart:

  • OTEL_SDK_DISABLED is now not otel.tracing.enabled. OTEL_EXPORTER_OTLP_ENDPOINT and OTEL_EXPORTER_OTLP_TRACES_INSECURE are only set when tracing is on.
  • Removed the env vars the issue lists as unread, and their values: OTEL_EXPORTER_OTLP_TRACES_TIMEOUT / otel.tracing.exporter.otlp.timeout (both exporters are built with WithTimeout(30s), which wins over the env var), PROMETHEUS_USERNAME/PROMETHEUS_PASSWORD (no Prometheus tool sends auth, and the password was a plain value), GRAFANA_URL/GRAFANA_API_KEY (no Grafana provider), KAGENT_NAMESPACE.
  • README and DEVELOPMENT.md no longer list GRAFANA_URL/GRAFANA_API_KEY as supported settings.

Wiring Prometheus basic auth from a Secret would be a feature of its own, so I went with the "remove" option for those. tools.loglevel is left as is for the reason given in #100.

Tests: three new cases in helm/kagent-tools/tests/deployment_test.yaml (SDK disabled by default with no exporter endpoint, SDK enabled with the configured endpoint, none of the dropped vars rendered). On main all three fail; with this change make helm-test passes 26/26.

AI disclosure: written with the help of Claude Code, reviewed and tested by me.

The chart passed otel.tracing.enabled as OTEL_TRACING_ENABLED, which the
server never reads; it reads OTEL_SDK_DISABLED. With the default values
tracing stayed on and the gRPC exporter kept dialing
host.docker.internal:4317, logging export timeouts. Set OTEL_SDK_DISABLED
from the value and only pass the exporter settings when tracing is on.

Also drop the env vars nothing reads: OTEL_EXPORTER_OTLP_TRACES_TIMEOUT
(the exporter timeout is fixed in code), PROMETHEUS_USERNAME,
PROMETHEUS_PASSWORD, GRAFANA_URL, GRAFANA_API_KEY and KAGENT_NAMESPACE,
with their values and README entries.

Fixes kagent-dev#92

Signed-off-by: Lucas Barros <lucasbarros.kam@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Helm chart sets env vars the server never reads

1 participant