Wire up self telemetry OTLP export for TargetAllocator#5068
Conversation
b47bf27 to
4fe8371
Compare
46ea73b to
9a25f11
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5068 +/- ##
==========================================
+ Coverage 63.15% 63.29% +0.13%
==========================================
Files 217 217
Lines 15311 15440 +129
==========================================
+ Hits 9670 9773 +103
- Misses 4962 4984 +22
- Partials 679 683 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
… resource, shutdown, validation
- Export self-telemetry over OTLP with the same metric set as /metrics by
bridging the default Prometheus registry (SD internals, Go/process collectors)
into the OTLP reader via the Prometheus bridge; SDK metrics use a dedicated
registry to avoid double counting, and /metrics serves the union.
- Attach a resource with a default service.name (overridable via OTEL_* env).
- Shut down the meter provider on exit to flush the final export.
- Expand ${env:VAR} in OTLP header/endpoint values so secrets (API tokens) can be
sourced from a Secret via pod env instead of being written into the ConfigMap.
- Accept both a full URL and host:port endpoint for gRPC (consistent with HTTP).
- Validate telemetry config in the TA binary for standalone use.
- Unit + end-to-end export tests, config-file README docs, changelog entry.
9a25f11 to
87b320d
Compare
|
Rebased this onto Prometheus SD/registry metrics now covered@swiatekm - your concern was that the TA's SD metrics (and the Go/process collectors) are registered directly on the Prometheus registry, bypassing the OTel SDK, so an OTLP exporter wired only to the SDK would expose a different metric set than This is now handled with the Prometheus bridge (
Net effect: OTLP export and On config shape/otelconfI kept the VerificationDeployed the tiered Prometheus-large-scale setup on a local kind cluster with the TA pushing OTLP to a self-monitoring collector. Confirmed the TA's own metrics, the bridged SD/Go/process metrics, and the collector self-telemetry all arrive and that the customer scrape path is unaffected. PTAL when you get a chance. Thank you! |
swiatekm
left a comment
There was a problem hiding this comment.
Thank you for working on this!
I think it's going to be much easier to review and merge these changes if we decouple the target allocator feature from the CRD additions.
In plain target allocator configuration, we should be able to just embed https://pkg.go.dev/go.opentelemetry.io/contrib/otelconf into the config file - the fact that parts of the spec may be experimental is not an obstruction here.
On the other hand, in the CRD, we have to be more careful, as we're not allowed to make any breaking changes without bumping the version. The problem of embedding the declarative sdk config in the CRD also came up in @pavolloffay's work on the Instrumentation CRD, so we should align that bit.
| setupLog.Info("Target allocator exited.") | ||
| } | ||
|
|
||
| // envRefPattern matches ${env:VAR} references, mirroring the OTel Collector's |
There was a problem hiding this comment.
We should move all the telemetry related setup to a separate telemetry.go file.
|
Thanks @swiatekm, that makes sense. I've split the work along the lines you suggested:
|
Description:
Allow the TA to export it's selfmonitoring data via OTLP.
The meat of the changes is in the TA binary at cmd/otel-allocator/main.go, everything else is wiring through configuration. Configuration follows the same config structure as the OTel collector selfmonitoring.
Link to tracking Issue(s):
Testing:
Added tests in internal/manifests/targetallocator/configmap_test.go to ensure config is correct.
Documentation:
Added docs in docs/api/opentelemetrycollectors.md.