feat(engine)!: adopt ResourceDetectors for self-telemetry#3555
Conversation
Pull request dashboard statusStatus last refreshed: 2026-07-26 12:14:14 UTC.
This automated status or its linked feedback items may be incorrect. If something looks wrong, please report it with the result you expected. If you believe this pull request is incorrectly routed as waiting on the author, comment |
There was a problem hiding this comment.
Pull request overview
This PR switches the engine’s self-telemetry resource attribution from bespoke, Linux-centric detection to upstream OpenTelemetry ResourceDetector implementations, making detection configurable via engine.telemetry.detectors and aligning defaults with the Go collector (env + service_instance).
Changes:
- Adds a detector registry (
env,host,os,process,container,k8s,service_instance) and merges detected attributes as typedAttributeValues. - Introduces
engine.telemetry.detectorsconfig (defaulting to["env", "service_instance"]) and wires detection into controller startup with config taking precedence. - Removes the old hardcoded host/container/service.instance detection from the engine and updates dependencies/lockfile accordingly.
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs | New detector registry + typed conversion/merge logic; adds unit tests for mapping, precedence, and env/service instance behavior. |
| rust/otap-dataflow/crates/telemetry/src/lib.rs | Exposes the new resource_detectors module. |
| rust/otap-dataflow/crates/telemetry/src/collector.rs | Updates test config construction to include the new detectors field. |
| rust/otap-dataflow/crates/telemetry/Cargo.toml | Adds OTel SDK + contrib detector deps and temp-env for tests. |
| rust/otap-dataflow/crates/engine/src/context.rs | Removes bespoke host/container/service.instance detection and related tests. |
| rust/otap-dataflow/crates/engine/Cargo.toml | Drops uuid/data-encoding deps no longer needed after removing bespoke detection. |
| rust/otap-dataflow/crates/controller/src/lib.rs | Runs configured detectors and merges detected resource attributes into telemetry resource map (config wins). |
| rust/otap-dataflow/crates/config/src/pipeline/telemetry.rs | Adds TelemetryConfig.detectors with defaults and documentation. |
| rust/otap-dataflow/Cargo.toml | Adds workspace deps for opentelemetry_sdk and pins opentelemetry-resource-detectors to a contrib git rev. |
| rust/otap-dataflow/Cargo.lock | Records new deps and transitive updates (incl. opentelemetry-resource-detectors, temp-env, windows-sys bumps). |
| rust/otap-dataflow/.chloggen/resource-detectors-self-telemetry.yaml | Adds breaking-change changelog entry describing new defaults and semantic changes. |
Comments suppressed due to low confidence (7)
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:135
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:143
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:148
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:156
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:171
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:182
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
rust/otap-dataflow/crates/telemetry/src/resource_detectors.rs:193
- Tests in rust/otap-dataflow are expected to be documented with Rust doc comments describing Scenario/Guarantees (see rust/otap-dataflow/AGENTS.md). This new test is missing those required doc comments.
#[test]
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
80d4952 to
0a2ba42
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #3555 +/- ##
==========================================
- Coverage 86.79% 86.79% -0.01%
==========================================
Files 784 785 +1
Lines 319527 319556 +29
==========================================
+ Hits 277347 277357 +10
- Misses 41656 41675 +19
Partials 524 524
🚀 New features to boost your workflow:
|
drewrelmas
left a comment
There was a problem hiding this comment.
This is great to see, thanks @mwear! Please take a look at the current merge conflicts.
| /// Resource detectors to run for auto-detected telemetry attributes. | ||
| /// Defaults to `["env", "service_instance"]`. Static `resource` attributes take | ||
| /// precedence over detected ones. An empty list disables auto-detection. | ||
| #[serde(default = "default_detectors")] |
There was a problem hiding this comment.
Could you please add a sample config at https://github.com/open-telemetry/otel-arrow/tree/main/rust/otap-dataflow/configs demonstrating resource detector usage?
Change Summary
env,service_instancewhich mirrors the Go collector's defaults for self-telemetry.host,os,process,container, andk8sare opt-in.opentelemetry-resource-detectorsis pinned to open-telemetry/opentelemetry-rust-contrib@4f5296b as it contains new detectors and updates to existing ones.What issue does this PR close?
ResourceDetectorsfor self-telemetry resource attributes #3177How are these changes tested?
cargo xtask checkAre there any user-facing changes?
Yes, breaking. Default self-telemetry no longer emits
host.idandcontainer.id(now opt-in). When opted in,host.idderives from machine-id rather than hostname, andservice.instance.idis a plain UUIDv7 instead of a base32 string.Changelog
.chloggen/*.yamlentrychore(indicated in title)