Expand description
Shared attribute helpers used by every enrichment pass: numeric rounding,
the f64 → AttrValue bridge, typed attribute reads, and the external-node
predicate. This is a leaf module — it depends only on the plugin API, never
on the crate root, so the enrichment passes can pull helpers from here
without creating a submodule → crate-root back-edge.
Functions§
- num_
attr - Round a metric and pick the natural JSON scalar: an integral value becomes
an
Int(so1.0serializes as1), otherwise aFloat. This is the single bridge metric producers use before inserting intoattrs. - round_
sig3 - Truncate to 3 significant digits (matching the historical
sig3serializer): values ≥ 1 are truncated to 3 decimals, values < 1 to 3 significant figures. Non-finite values collapse to 0 (JSON has no NaN/Inf).