AITrace.Event (AITrace v0.2.0)

Copy Markdown View Source

An Event represents a point-in-time annotation within a Span.

Events capture notable occurrences that aren't timed operations, such as:

  • State changes
  • Validation failures
  • Cache hits/misses
  • Tool errors

Summary

Functions

Creates a new event with a name and attributes.

Sets the capture/persistence posture for the event.

Types

t()

@type t() :: %AITrace.Event{
  attributes: map(),
  clock_domain: map(),
  name: String.t(),
  persistence_posture: AITrace.PersistencePosture.t(),
  timestamp: integer(),
  wall_time: DateTime.t()
}

Functions

new(name, attributes \\ %{})

@spec new(String.t(), map()) :: t()

Creates a new event with a name and attributes.

Examples

iex> event = AITrace.Event.new("cache_miss", %{key: "user_123"})
iex> event.name
"cache_miss"
iex> event.attributes
%{key: "user_123"}

with_persistence_posture(event, attrs)

@spec with_persistence_posture(t(), map() | keyword()) :: t()

Sets the capture/persistence posture for the event.