Skip to content

Standardize OpenTelemetry environment variable naming#1292

Merged
EItanya merged 3 commits intokagent-dev:mainfrom
Daniel-Vaz:cleanup-otel-env-vars-logic
Feb 17, 2026
Merged

Standardize OpenTelemetry environment variable naming#1292
EItanya merged 3 commits intokagent-dev:mainfrom
Daniel-Vaz:cleanup-otel-env-vars-logic

Conversation

@Daniel-Vaz
Copy link
Contributor

Description

This PR addresses the OpenTelemetry configuration inconsistency reported in #1273 by standardizing environment variable naming to follow the official OpenTelemetry specification.

Changes Made

kagent-core

  • Updated _utils.py to check standard OpenTelemetry environment variables first:
    • OTEL_EXPORTER_OTLP_TRACES_ENDPOINT (standard) → OTEL_TRACING_EXPORTER_OTLP_ENDPOINT (legacy fallback)
    • OTEL_EXPORTER_OTLP_LOGS_ENDPOINT (standard) → OTEL_LOGGING_EXPORTER_OTLP_ENDPOINT (legacy fallback)
  • Maintained backward compatibility with legacy variable names
  • Both now fall back to OTEL_EXPORTER_OTLP_ENDPOINT as per OpenTelemetry spec

Helm

  • Controller ConfigMap: Implemented smart endpoint configuration
    • Uses OTEL_EXPORTER_OTLP_ENDPOINT when tracing and logging endpoints are identical
    • Uses signal-specific endpoints (OTEL_EXPORTER_OTLP_TRACES_ENDPOINT / OTEL_EXPORTER_OTLP_LOGS_ENDPOINT) when different
  • QueryDoc ConfigMap: Added OTEL_EXPORTER_OTLP_TRACES_ENDPOINT for consistency

Copilot AI review requested due to automatic review settings February 13, 2026 09:05
Copy link
Contributor

Copilot AI left a comment

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 standardizes OpenTelemetry OTLP endpoint environment variable naming across kagent-core and Helm charts to align with the official OTel spec, while retaining legacy fallbacks in the Python runtime to address the configuration mismatch reported in #1273.

Changes:

  • Updated Python OTel configuration to prefer signal-specific standard env vars (OTEL_EXPORTER_OTLP_{TRACES,LOGS}_ENDPOINT) with legacy and general fallback.
  • Updated controller Helm ConfigMap to use a unified endpoint when trace/log endpoints match, otherwise emit signal-specific endpoints.
  • Updated QueryDoc Helm ConfigMap to include OTEL_EXPORTER_OTLP_TRACES_ENDPOINT for consistency.

Reviewed changes

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

File Description
python/packages/kagent-core/src/kagent/core/tracing/_utils.py Prefer standard OTel env vars for trace/log endpoints with backward-compatible fallbacks.
helm/kagent/templates/controller-configmap.yaml Emit unified vs signal-specific OTLP endpoint env vars based on whether trace/log endpoints are equal.
helm/tools/querydoc/templates/configmap.yaml Add OTEL_EXPORTER_OTLP_TRACES_ENDPOINT alongside existing OTLP env vars.

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

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Signed-off-by: dvaz-external <dvaz.external@epo.org>
Signed-off-by: dvaz-external <dvaz.external@epo.org>
Signed-off-by: dvaz-external <dvaz.external@epo.org>
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

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


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

Comment on lines +29 to +30
OTEL_EXPORTER_OTLP_TRACES_INSECURE: {{ .Values.otel.tracing.exporter.otlp.insecure | quote }}
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: {{ .Values.otel.tracing.exporter.otlp.timeout | quote }}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is doubled up, It's also present on line 37?

Comment on lines +42 to +43
OTEL_EXPORTER_OTLP_LOGS_INSECURE: {{ .Values.otel.logging.exporter.otlp.insecure | quote }}
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: {{ .Values.otel.logging.exporter.otlp.timeout | quote }}
Copy link
Contributor

Choose a reason for hiding this comment

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

These are also present above?

@Daniel-Vaz
Copy link
Contributor Author

@EItanya
Those values are mentioned twice but aren't duplicates, thanks to the if\else condition defined.

The logic is the following:

  • If traces and logs endpoints are defined and they're the same value then the vars OTEL_EXPORTER_OTLP_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_INSECURE, OTEL_EXPORTER_OTLP_TRACES_TIMEOUT, OTEL_EXPORTER_OTLP_LOGS_INSECURE and OTEL_EXPORTER_OTLP_LOGS_TIMEOUT are set.
  • If Traces and Logs endpoints are not the same, then it falls back to the else condition:
    • If Traces endpoint is defined then the vars OTEL_EXPORTER_OTLP_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_INSECURE and OTEL_EXPORTER_OTLP_TRACES_TIMEOUT are set;
    • If Logs endpoint is defined then the vars OTEL_EXPORTER_OTLP_LOGS_ENDPOINT, OTEL_EXPORTER_OTLP_LOGS_INSECURE and OTEL_EXPORTER_OTLP_LOGS_TIMEOUT are set.

@Daniel-Vaz Daniel-Vaz requested a review from EItanya February 17, 2026 09:04
@EItanya EItanya merged commit be3bac5 into kagent-dev:main Feb 17, 2026
21 of 22 checks passed
@Daniel-Vaz Daniel-Vaz deleted the cleanup-otel-env-vars-logic branch February 18, 2026 07:47
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.

3 participants