feat(helm): expose OTEL headers, service name, and resource attributes#2128
Draft
nirzOps wants to merge 1 commit into
Draft
feat(helm): expose OTEL headers, service name, and resource attributes#2128nirzOps wants to merge 1 commit into
nirzOps wants to merge 1 commit into
Conversation
The Go controller already reads standard OTEL SDK env vars through `autoexport.NewSpanExporter` (headers, protocol, endpoint, insecure, timeout) and `resource.WithFromEnv` (service name, resource attributes), but the Helm chart's `otel.tracing` / `otel.logging` config only surfaces endpoint/protocol/insecure/timeout. Anyone sending traces to an authenticated OTLP backend (Langfuse Cloud, Honeycomb, Datadog, New Relic, Grafana Cloud, ...) currently has to bypass the chart's `otel.*` config entirely and inject env vars via `controller.envFrom` from an out-of-band ConfigMap/Secret. This change adds four declarative knobs, all optional and backward compatible (nothing is rendered when unset): otel.serviceName -> OTEL_SERVICE_NAME otel.resourceAttributes (map) -> OTEL_RESOURCE_ATTRIBUTES otel.tracing.exporter.otlp.headers (map) -> OTEL_EXPORTER_OTLP_TRACES_HEADERS otel.logging.exporter.otlp.headers (map) -> OTEL_EXPORTER_OTLP_LOGS_HEADERS Map values are rendered as `key1=v1,key2=v2` with sorted keys for deterministic output. Secret headers (Basic auth, API keys) should continue to be overlaid through `controller.envFrom` referencing a Secret; the values.yaml comments document this pattern. Adds `tests/controller-configmap_test.yaml` covering: - backward compat: no new keys rendered with default values - each new field renders independently when set - map fields serialize in sorted key order - an end-to-end Langfuse Cloud style render Signed-off-by: Nir Zeira <nirz@elementor.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2126.
Design discussion: #2127.
Summary
Expose the four standard OpenTelemetry SDK env vars that the controller already reads via
autoexport.NewSpanExporterandresource.WithFromEnvingo/core/internal/telemetry/tracing.go, but thathelm/kagent/values.yamldid not surface:otel.serviceNameOTEL_SERVICE_NAMEotel.resourceAttributes(map)OTEL_RESOURCE_ATTRIBUTESotel.tracing.exporter.otlp.headers(map)OTEL_EXPORTER_OTLP_TRACES_HEADERSotel.logging.exporter.otlp.headers(map)OTEL_EXPORTER_OTLP_LOGS_HEADERSMaps serialize to
key1=value1,key2=value2with sorted keys (same pattern already used forDEFAULT_AGENT_POD_LABELS). Everything renders only when non-empty →helm templateoutput is byte-identical for existing installs. No controller code change is required.Unblocks self-service tracing to any authenticated OTLP backend (Langfuse Cloud, Honeycomb, Datadog, Grafana Cloud, New Relic, …) without the current workaround of maintaining out-of-band
ConfigMap+Secretand wiring them viacontroller.envFrom.What changed
helm/kagent/values.yaml— new keys with inline docs pointing users tocontroller.envFromfor secret headers.helm/kagent/templates/controller-configmap.yaml— conditional rendering of the four env vars.helm/kagent/tests/controller-configmap_test.yaml— new suite (11 tests) covering:Non-changes
controller.envFromextension point — the ConfigMapOTEL_EXPORTER_OTLP_TRACES_HEADERSis transparently overridden by the Pod-level env var.values.yamlcomments document this. Happy to addheadersSecretRefin a follow-up if maintainers prefer.helm/tools/querydoc/templates/configmap.yamlhas the same gap but is intentionally left for a separate PR to keep this reviewable.Verification
Rendered output with defaults (unchanged from
main):Rendered output with a Langfuse-Cloud style overlay:
Downstream context
The workaround this PR obsoletes is currently deployed in
elementor/elementor-cloud-external-charts@1e8b9436+elementor/elementor-agents@13545eb. Both will be simplified to nativeotel.*values once this lands.Checklist
helm templateoutput byte-identical with default values)helm lintcleanhelm unittest helm/kagent— 225/225 passing (11 new tests)CONTRIBUTING.md#kagent-devon CNCF Slack (owner:@nirzeira)