Skip to main content

Event

Derive Macro Event 

Source
#[derive(Event)]
{
    // Attributes available to this derive:
    #[event]
    #[obs]
}
Expand description

Derive macro for the Rust-first authoring path.

Container attributes:

  • #[event(tier = "log" | "metric" | "trace" | "audit")]
  • #[event(default_sev = "trace" | "debug" | "info" | "warn" | "error" | "fatal")]
  • #[event(full_name = "myapp.v1.ObsXxx")] (defaults to <crate>.v1.<TypeName> derived from module_path!).

Field attributes:

  • #[obs(label, cardinality = "low" | "medium" | "high" | "unbounded")]
  • #[obs(attribute, classification = "internal" | "pii" | "secret")]
  • #[obs(measurement)]
  • #[obs(trace_id)], #[obs(span_id)], #[obs(parent_span_id)]
  • #[obs(forensic)]

Lints (compile-time const _: () = { assert!(...) } blocks):

  • L001 — every LABEL field must declare a Low or Medium cardinality.
  • L002PII-classified fields must not be LABEL.
  • L003SECRET-classified fields must not exist on LOG or AUDIT tier events.
  • L011 — the type name must start with the workspace event prefix (default Obs).

See spec 12 § 3.4.