From 0c2a418e24039f1365318bef03a0e869baa52149 Mon Sep 17 00:00:00 2001 From: Koosha Pari Date: Sun, 21 Jun 2026 01:41:40 -0700 Subject: [PATCH] =?UTF-8?q?feat(tasken):=20L62=20adoption=20=E2=80=94=20re?= =?UTF-8?q?cord=5Ferror=20on=20circular-import=20(v14=20cycle-3=20T7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds one `pheno_otel::metrics::record_error` call (gated by the `otel` feature) to the circular-import check in `application::import`, the highest-traffic error site in the import pipeline. Adds `pheno-otel` as an optional path dep behind the same `otel` feature as the existing tracing + opentelemetry deps so non-OTel consumers don't pull it in. Refs: plans/2026-06-20-v14-71-pillar-cycle-3-p0.md § T7, ADR-036B, ADR-042. Depends on: pheno-otel#52 (metrics API). --- Cargo.lock | 150 +++++++++++++++++++++++++++++++++++++- Cargo.toml | 8 +- src/application/import.rs | 2 + 3 files changed, 156 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5d4cd25..59732d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -516,6 +516,12 @@ dependencies = [ "libc", ] +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "leb128fmt" version = "0.1.0" @@ -603,6 +609,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "nu-ansi-term" +version = "0.50.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7957b9740744892f114936ab4a57b3f487491bbeafaf8083688b16841a4240e5" +dependencies = [ + "windows-sys 0.61.2", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -624,6 +639,20 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" +[[package]] +name = "opentelemetry" +version = "0.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c365a63eec4f55b7efeceb724f1336f26a9cf3427b70e59e2cd2a5b947fba96" +dependencies = [ + "futures-core", + "futures-sink", + "js-sys", + "once_cell", + "pin-project-lite", + "thiserror 1.0.69", +] + [[package]] name = "option-ext" version = "0.2.0" @@ -665,6 +694,16 @@ dependencies = [ "serde", ] +[[package]] +name = "pheno-otel" +version = "0.1.0" +dependencies = [ + "opentelemetry", + "serde", + "serde_json", + "thiserror 2.0.18", +] + [[package]] name = "pin-project-lite" version = "0.2.17" @@ -722,7 +761,7 @@ checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac" dependencies = [ "getrandom 0.2.17", "libredox", - "thiserror", + "thiserror 2.0.18", ] [[package]] @@ -836,6 +875,15 @@ dependencies = [ "unsafe-libyaml", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + [[package]] name = "shlex" version = "2.0.1" @@ -906,15 +954,19 @@ dependencies = [ "futures", "libc", "notify", + "opentelemetry", "petgraph", + "pheno-otel", "serde", "serde_json", "serde_yaml", "temp-env", "tempfile", - "thiserror", + "thiserror 2.0.18", "tokio", "toml", + "tracing", + "tracing-subscriber", "uuid", ] @@ -940,13 +992,33 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + [[package]] name = "thiserror" version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.18", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -960,6 +1032,15 @@ dependencies = [ "syn", ] +[[package]] +name = "thread_local" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f60246a4944f24f6e018aa17cdeffb7818b76356965d03b07d6a9886e8962185" +dependencies = [ + "cfg-if", +] + [[package]] name = "tokio" version = "1.52.3" @@ -1029,6 +1110,63 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7f578e5945fb242538965c2d0b04418d38ec25c79d160cd279bf0731c8d319" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + [[package]] name = "unicode-ident" version = "1.0.24" @@ -1065,6 +1203,12 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + [[package]] name = "walkdir" version = "2.5.0" diff --git a/Cargo.toml b/Cargo.toml index e8b82bf..10a3886 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,6 +54,12 @@ serde_yaml = "0.9" # Observability (optional, gated by the `otel` feature flag) tracing = { version = "0.1", optional = true } opentelemetry = { version = "0.24", optional = true } +# L62 (error rate) observability adoption (v14 cycle-3 T7). +# Optional, gated by the same `otel` feature as the other observability deps +# so consumers that don't want OTel don't pull it in. When enabled, the +# `import::ImportError::CircularImport` site records an `errors.count` metric +# labelled `tasken.import.circular` so fleet-wide error rate dashboards see it. +pheno-otel = { path = "../pheno-otel", optional = true } [dev-dependencies] tempfile = "3" @@ -72,4 +78,4 @@ default = [] # is wired into TaskService::run_task and TaskService::execute_workflow, # but the actual exporter (stdout, OTLP, etc.) is left to the embedding # application — see `infrastructure::otel::init_tracer` for a stub. -otel = ["dep:tracing", "dep:opentelemetry"] +otel = ["dep:tracing", "dep:opentelemetry", "dep:pheno-otel"] diff --git a/src/application/import.rs b/src/application/import.rs index 13077df..12fc71d 100644 --- a/src/application/import.rs +++ b/src/application/import.rs @@ -151,6 +151,8 @@ impl ImportResolver { ) -> Result { // --- Circular import check --- if visited.iter().any(|p| p == path) { + #[cfg(feature = "otel")] + pheno_otel::metrics::record_error("tasken.import", "circular_import"); return Err(ImportError::CircularImport { path: path.to_path_buf(), });