pub struct ZeroclawAttribution {
pub fields: BTreeMap<String, String>,
pub duration_ms: Option<u64>,
}Expand description
ZeroClaw-domain attribution. Every field is alias-bound where
applicable: channel is the <type>.<alias> composite, model_provider
is the <type>.<alias> composite, etc. Composites are stored as three
keys (<prefix>, <prefix>_type, <prefix>_alias) so filters can
match either coarse or precise.
The shape is a flat string map flattened into the parent on-disk JSON,
driven by ATTRIBUTION_FIELDS + COMPOSITE_PREFIXES. Adding a new
attribution key requires extending those constants — nothing else.
Fields§
§fields: BTreeMap<String, String>§duration_ms: Option<u64>Per-event duration when applicable. Kept off fields so JSON
readers see a number, not a stringified number.
Implementations§
Source§impl ZeroclawAttribution
impl ZeroclawAttribution
pub fn get(&self, key: &str) -> Option<&str>
pub fn set(&mut self, key: impl Into<String>, value: impl Into<String>)
Sourcepub fn set_composite(&mut self, prefix: &str, composite: &str)
pub fn set_composite(&mut self, prefix: &str, composite: &str)
Set a composite-prefixed attribution by splitting composite at
the first . — populates <prefix>, <prefix>_type, and
(when the dotted form is present) <prefix>_alias in one call.
Sourcepub fn merge_from(&mut self, other: &Self)
pub fn merge_from(&mut self, other: &Self)
Fill any key absent on self from other. The flat-map shape
means composite groups move as a unit naturally (all three keys
merge independently, but the composite-prefix setter always
writes all three together, so the parent’s set is consistent).
Sourcepub fn is_fully_populated(&self) -> bool
pub fn is_fully_populated(&self) -> bool
True when every plain field in ATTRIBUTION_FIELDS and every
composite in COMPOSITE_PREFIXES has been populated — the
span-walk uses this as a “no point looking further up” check.
Trait Implementations§
Source§impl Clone for ZeroclawAttribution
impl Clone for ZeroclawAttribution
Source§fn clone(&self) -> ZeroclawAttribution
fn clone(&self) -> ZeroclawAttribution
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more