automata/event/metadata

Types

Free-form attribute key/value pairs attached to an event.

pub type Attributes =
  dict.Dict(String, String)

Tracing and correlation metadata shared by every event.

correlation_id groups events that belong to the same business transaction. causation_id points to the immediate parent event’s id. trace_id is reserved for bridging with W3C TraceContext / OpenTelemetry. attributes carries free-form string-keyed labels for routing and observability.

pub type Metadata {
  Metadata(
    correlation_id: option.Option(String),
    causation_id: option.Option(String),
    trace_id: option.Option(String),
    attributes: dict.Dict(String, String),
  )
}

Constructors

Values

pub fn attribute(
  metadata metadata: Metadata,
  key key: String,
) -> option.Option(String)

Look up an attribute by key. Returns None when no value is set.

pub fn empty() -> Metadata

Empty metadata with no ids and no attributes.

pub fn has_attribute(
  metadata metadata: Metadata,
  key key: String,
) -> Bool

True when key is present in the attribute map (regardless of its value).

pub fn with_attribute(
  metadata metadata: Metadata,
  key key: String,
  value value: String,
) -> Metadata

Insert (or overwrite) a free-form attribute pair.

pub fn with_causation_id(
  metadata metadata: Metadata,
  id id: String,
) -> Metadata

Set the causation id pointing at the immediate parent event.

pub fn with_correlation_id(
  metadata metadata: Metadata,
  id id: String,
) -> Metadata

Tag this metadata with the correlation id that groups events belonging to the same business transaction.

pub fn with_trace_id(
  metadata metadata: Metadata,
  id id: String,
) -> Metadata

Set the W3C/OpenTelemetry-style trace id.

Search Document