Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions helm/kagent/templates/controller-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,31 @@ data:
IMAGE_REPOSITORY: {{ .Values.controller.agentImage.repository | quote }}
IMAGE_TAG: {{ coalesce .Values.controller.agentImage.tag .Values.tag .Chart.Version | quote }}
LEADER_ELECT: {{ include "kagent.leaderElectionEnabled" . | quote }}
OTEL_EXPORTER_OTLP_ENDPOINT: {{ .Values.otel.tracing.exporter.otlp.endpoint | quote }}
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: {{ .Values.otel.logging.exporter.otlp.endpoint | quote }}
# OpenTelemetry Configuration
OTEL_TRACING_ENABLED: {{ .Values.otel.tracing.enabled | quote }}
OTEL_LOGGING_ENABLED: {{ .Values.otel.logging.enabled | quote }}
{{- $tracesEndpoint := .Values.otel.tracing.exporter.otlp.endpoint }}
{{- $logsEndpoint := .Values.otel.logging.exporter.otlp.endpoint }}
{{- if and $tracesEndpoint $logsEndpoint (eq $tracesEndpoint $logsEndpoint) }}
# Using unified OTEL endpoint (same for traces and logs)
OTEL_EXPORTER_OTLP_ENDPOINT: {{ $tracesEndpoint | quote }}
OTEL_EXPORTER_OTLP_TRACES_INSECURE: {{ .Values.otel.tracing.exporter.otlp.insecure | quote }}
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: {{ .Values.otel.tracing.exporter.otlp.timeout | quote }}
Comment on lines +29 to +30
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?

OTEL_EXPORTER_OTLP_LOGS_INSECURE: {{ .Values.otel.logging.exporter.otlp.insecure | quote }}
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: {{ .Values.otel.logging.exporter.otlp.timeout | quote }}
{{- else }}
# Using separate endpoints for traces and logs
{{- if $tracesEndpoint }}
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: {{ $tracesEndpoint | quote }}
OTEL_EXPORTER_OTLP_TRACES_INSECURE: {{ .Values.otel.tracing.exporter.otlp.insecure | quote }}
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: {{ .Values.otel.tracing.exporter.otlp.timeout | quote }}
OTEL_LOGGING_ENABLED: {{ .Values.otel.logging.enabled | quote }}
OTEL_TRACING_ENABLED: {{ .Values.otel.tracing.enabled | quote }}
OTEL_TRACING_EXPORTER_OTLP_ENDPOINT: {{ .Values.otel.tracing.exporter.otlp.endpoint | quote }}
{{- end }}
{{- if $logsEndpoint }}
OTEL_EXPORTER_OTLP_LOGS_ENDPOINT: {{ $logsEndpoint | quote }}
OTEL_EXPORTER_OTLP_LOGS_INSECURE: {{ .Values.otel.logging.exporter.otlp.insecure | quote }}
OTEL_EXPORTER_OTLP_LOGS_TIMEOUT: {{ .Values.otel.logging.exporter.otlp.timeout | quote }}
Comment on lines +42 to +43
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?

{{- end }}
{{- end }}
{{- if .Values.proxy.url }}
PROXY_URL: {{ .Values.proxy.url | quote }}
{{- end }}
Expand Down
5 changes: 5 additions & 0 deletions helm/tools/querydoc/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ data:
KAGENT_LOG_LEVEL: {{ .Values.logLevel | quote }}
PORT: {{ .Values.service.port | quote }}
TRANSPORT_TYPE: "http"
# OpenTelemetry Configuration
OTEL_TRACING_ENABLED: {{ .Values.otel.tracing.enabled | quote }}
{{- if .Values.otel.tracing.exporter.otlp.endpoint }}
# Standard OTEL environment variables
OTEL_EXPORTER_OTLP_ENDPOINT: {{ .Values.otel.tracing.exporter.otlp.endpoint | quote }}
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT: {{ .Values.otel.tracing.exporter.otlp.endpoint | quote }}
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT: {{ .Values.otel.tracing.exporter.otlp.timeout | quote }}
OTEL_EXPORTER_OTLP_TRACES_INSECURE: {{ .Values.otel.tracing.exporter.otlp.insecure | quote }}
{{- end }}

# Custom configuration
{{- range $key, $value := .Values.config }}
Expand Down
17 changes: 13 additions & 4 deletions python/packages/kagent-core/src/kagent/core/tracing/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,12 @@ def configure(name: str = "kagent", namespace: str = "kagent", fastapi_app: Fast
# Configure tracing if enabled
if tracing_enabled:
logging.info("Enabling tracing")
# Check new env var first, fall back to old one for backward compatibility
trace_endpoint = os.getenv("OTEL_TRACING_EXPORTER_OTLP_ENDPOINT") or os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
# Check standard OTEL env vars: signal-specific endpoint first, then general endpoint
trace_endpoint = (
os.getenv("OTEL_EXPORTER_OTLP_TRACES_ENDPOINT")
or os.getenv("OTEL_TRACING_EXPORTER_OTLP_ENDPOINT") # Backward compatibility
or os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
)
logging.info("Trace endpoint: %s", trace_endpoint or "<default>")
if trace_endpoint:
processor = BatchSpanProcessor(OTLPSpanExporter(endpoint=trace_endpoint))
Expand Down Expand Up @@ -93,8 +97,13 @@ def configure(name: str = "kagent", namespace: str = "kagent", fastapi_app: Fast
if logging_enabled:
logging.info("Enabling logging for GenAI events")
logger_provider = LoggerProvider(resource=resource)
log_endpoint = os.getenv("OTEL_LOGGING_EXPORTER_OTLP_ENDPOINT")
logging.info(f"Log endpoint configured: {log_endpoint}")
# Check standard OTEL env vars: signal-specific endpoint first, then general endpoint
log_endpoint = (
os.getenv("OTEL_EXPORTER_OTLP_LOGS_ENDPOINT")
or os.getenv("OTEL_LOGGING_EXPORTER_OTLP_ENDPOINT") # Backward compatibility
or os.getenv("OTEL_EXPORTER_OTLP_ENDPOINT")
)
logging.info("Log endpoint: %s", log_endpoint or "<default>")

# Add OTLP exporter
if log_endpoint:
Expand Down
Loading