-
Notifications
You must be signed in to change notification settings - Fork 219
Description
Summary
When running Elastic Agent in Kubernetes agentless mode with an initial configuration containing service.telemetry settings, the OTel collector does not receive this configuration. The persisted configuration (from elastic-agent.yml) is successfully merged but is not passed to the OTel manager due to a timing issue in the coordinator.
Expected Behavior
The OTel collector should receive the complete merged configuration including:
service.telemetry.resourceattributes from the persisted configservice.telemetry.logsOTLP exporter configurationservice.telemetry.metricsOTLP exporter configuration with delta temporalityservice.telemetry.tracesOTLP exporter configuration
This allows the collector to instrument itself and export telemetry to a specified OTLP endpoint.
Actual Behavior
The OTel collector receives nil for the collector configuration, losing all service.telemetry settings from the persisted config. This prevents the collector from exporting its own telemetry.
Root Cause
In coordinator.go, the c.otelCfg field is set after refreshComponentModel() is called, which means when updateManagersWithConfig() reads c.otelCfg to pass to the OTel manager, it's still nil.
Problematic flow:
processConfig()
├── processConfigAgent()
│ ├── applyPersistedConfig() // cfg.OTel now has service.telemetry ✅
│ └── refreshComponentModel()
│ └── updateManagersWithConfig()
│ └── otelMgr.Update(c.otelCfg) // c.otelCfg is still nil ❌
└── c.otelCfg = cfg.OTel // Set too late!
Steps to Reproduce
- Deploy Elastic Agent in Kubernetes using agentless mode
- Add initial configuration with
service.telemetrysection inelastic-agent.yml:
service:
telemetry:
resource:
policy_id: my-policy
logs:
level: info
processors:
- batch:
exporter:
otlp:
protocol: http/protobuf
endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT}
metrics:
level: detailed
readers:
- periodic:
exporter:
otlp:
protocol: http/protobuf
endpoint: ${env:OTEL_EXPORTER_OTLP_ENDPOINT}
temporality_preference: delta- Run diagnostics and check otel.yml and otel-merged.yml