1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// SPDX-License-Identifier: MIT OR Apache-2.0
//! The plan-time telemetry carrier — what `compile_plan` needs in hand to
//! emit a structural miss at the dispatch pick site.
//!
//! [`crate::plan::PlanOptions`] threads an `Option<&TelemetryHooks>`; when it
//! is `None` (the default) OR the config's mode is
//! [`TelemetryMode::Off`](super::config::TelemetryMode::Off), the plan's
//! emission post-pass returns before touching anything — the opt-in gate is
//! branch-predictable and the default build path is untouched (the whole
//! module is behind the `telemetry` cargo feature besides).
//!
//! ## Never-panic posture
//!
//! The `sink` is shared behind a [`Mutex`] because the plan's emission is a
//! `&`-borrow of the options while [`TelemetrySink::record_miss`] needs `&mut`.
//! `record_miss` cannot fail (pure in-memory aggregation); the only failure
//! mode at the call site is a poisoned lock, which the emission swallows to a
//! no-op — telemetry is best-effort and must never break dispatch.
use Mutex;
use TelemetryConfig;
use HwStamp;
use TelemetrySink;
use StructureKeyProvider;
/// Everything the plan-time miss emission needs, threaded through
/// [`crate::plan::PlanOptions::telemetry`]. Built once per realize/compile
/// call and borrowed by [`crate::plan::compile_plan`].