Insider.Event (Insider v0.1.0)

Copy Markdown View Source

Versioned, bounded, portable evidence shared by collectors and detectors.

Extensible vocabulary remains binary on both sides of the trust boundary. Only closed library-owned enums, such as severity, use atoms internally. Version 1 monotonic timestamps are signed microseconds. Wall time is display and provenance metadata and never establishes causality.

Summary

Types

causality()

@type causality() :: %{
  trace_id: String.t() | nil,
  span_id: String.t() | nil,
  parent_event_id: String.t() | nil,
  logical_operation_id: String.t() | nil,
  process_generation: String.t() | nil
}

severity()

@type severity() :: :debug | :info | :warning | :error | :critical

t()

@type t() :: %Insider.Event{
  attributes: map(),
  authority: String.t(),
  boot_id: String.t(),
  causality: causality(),
  clock_id: String.t(),
  extensions: map(),
  id: String.t(),
  kind: String.t(),
  monotonic_time: integer(),
  node: String.t(),
  payload: term(),
  redactions: [map()],
  schema: String.t(),
  severity: severity(),
  source: String.t(),
  source_instance_id: String.t(),
  source_sequence: pos_integer(),
  subject: map() | nil,
  wall_time: DateTime.t() | nil
}

Functions

canonical_binary(event)

@spec canonical_binary(term()) ::
  {:ok, binary()} | {:error, Insider.Protocol.Error.t()}

decode_map(payload)

@spec decode_map(term()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

new(options)

@spec new(keyword()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}

new!(options)

@spec new!(keyword()) :: t()

to_wire_map(event)

@spec to_wire_map(t()) :: map()

validate(event)

@spec validate(term()) :: {:ok, t()} | {:error, Insider.Protocol.Error.t()}