Skip to content

feat(helm): expose OTEL headers, service name, and resource attributes#2272

Open
shekhargit1912 wants to merge 2 commits into
kagent-dev:mainfrom
shekhargit1912:feat/helm-otel-values
Open

feat(helm): expose OTEL headers, service name, and resource attributes#2272
shekhargit1912 wants to merge 2 commits into
kagent-dev:mainfrom
shekhargit1912:feat/helm-otel-values

Conversation

@shekhargit1912

Copy link
Copy Markdown
Contributor

The controller already honors the standard OpenTelemetry SDK env vars, but the chart had no way to set them, leaving authenticated OTLP backends (Langfuse Cloud, Honeycomb, Datadog, Grafana Cloud, New Relic) unreachable without post-render hacks.

Add optional values, all rendered into the controller ConfigMap only when set so existing installs render identically:

  • otel.tracing.exporter.otlp.headers -> OTEL_EXPORTER_OTLP_TRACES_HEADERS
  • otel.logging.exporter.otlp.headers -> OTEL_EXPORTER_OTLP_LOGS_HEADERS
  • otel.serviceName -> OTEL_SERVICE_NAME
  • otel.resourceAttributes -> OTEL_RESOURCE_ATTRIBUTES

Header and attribute maps render as comma-joined key=value pairs with sorted keys, matching the DEFAULT_AGENT_POD_LABELS pattern. Secret header values should instead be injected via controller.env/envFrom, as documented in values.yaml.

Fixes #2126

The controller already honors the standard OpenTelemetry SDK env vars,
but the chart had no way to set them, leaving authenticated OTLP
backends (Langfuse Cloud, Honeycomb, Datadog, Grafana Cloud, New Relic)
unreachable without post-render hacks.

Add optional values, all rendered into the controller ConfigMap only
when set so existing installs render identically:

- otel.tracing.exporter.otlp.headers -> OTEL_EXPORTER_OTLP_TRACES_HEADERS
- otel.logging.exporter.otlp.headers -> OTEL_EXPORTER_OTLP_LOGS_HEADERS
- otel.serviceName                   -> OTEL_SERVICE_NAME
- otel.resourceAttributes            -> OTEL_RESOURCE_ATTRIBUTES

Header and attribute maps render as comma-joined key=value pairs with
sorted keys, matching the DEFAULT_AGENT_POD_LABELS pattern. Secret
header values should instead be injected via controller.env/envFrom,
as documented in values.yaml.

Fixes kagent-dev#2126

Signed-off-by: shekhargit1912 <shekharchaugule302@gmail.com>
@shekhargit1912
shekhargit1912 requested a review from a team as a code owner July 16, 2026 17:19
Copilot AI review requested due to automatic review settings July 16, 2026 17:19
@github-actions github-actions Bot added the enhancement New feature or request label Jul 16, 2026
Signed-off-by: Shekhar Chaugule <79699567+shekhargit1912@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the helm/kagent chart to expose additional standard OpenTelemetry SDK environment variables (service name, resource attributes, and OTLP headers) via values.yaml, rendering them into the controller ConfigMap only when configured to preserve backwards-compatible output.

Changes:

  • Added otel.serviceName and otel.resourceAttributes values, mapping to OTEL_SERVICE_NAME and OTEL_RESOURCE_ATTRIBUTES.
  • Added otel.tracing.exporter.otlp.headers and otel.logging.exporter.otlp.headers, mapping to OTEL_EXPORTER_OTLP_TRACES_HEADERS and OTEL_EXPORTER_OTLP_LOGS_HEADERS, serialized as sorted k=v pairs.
  • Added Helm chart tests to validate absence-by-default and deterministic sorted rendering when set.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
helm/kagent/values.yaml Adds new OTEL-related values with guidance about avoiding plaintext secrets in ConfigMaps.
helm/kagent/templates/controller-configmap.yaml Conditionally renders the new OTEL env vars into the controller ConfigMap using sorted k=v serialization.
helm/kagent/tests/controller-deployment_test.yaml Adds assertions covering default non-rendering and correct sorted rendering of the new fields.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] helm/kagent: expose OTEL_EXPORTER_OTLP_HEADERS, OTEL_SERVICE_NAME, and OTEL_RESOURCE_ATTRIBUTES

2 participants