Observer

interface Observer

The observation seams of the core: where the kernel and the runtime tell an observer, such as wow-observability's tracing and metrics, that a stage of their work starts. The core knows no tracing or metrics library; an observer only watches and never changes what the work does (06-modules §3).

Each method but observed starts an Observation of one stage, which the core ends when the stage does; observed tells it something without a duration (ObservedEvent). Every method has a default that observes nothing, so an observer overrides only what it watches; the stages' defaults, and NONE, return Observation.NONE, so the core allocates nothing for a stage nobody observes.

The trace context goes with the work: in a coroutine through the TraceContext element an observation's Observation.context holds, and between nodes through me.ahoo.wow.spi.log.Transport.trace (a log entry, a message of a topic) or the cluster channel. A stage that starts from what arrived that way is handed its propagation fields.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open fun admitting(context: String, aggregate: String, command: String, trace: Map<String, String>): Observation

Admission of a request for command (the name the request gave) of the aggregate type aggregate of context; trace holds the propagation fields the request arrived with, such as an HTTP request's traceparent, empty when none.

Link copied to clipboard

The append of stream; what is appended with it carries the observation's Observation.trace.

Link copied to clipboard
open fun deciding(command: Command<*>): Observation

One decision of command: its decide function and its after hooks.

Link copied to clipboard
open fun executing(command: Command<*>, commandType: String): Observation

The kernel's execution of command, whose resolved type name is commandType (context.aggregate.Name, as the Manifest and the log name it, @Name included), from taking it to its outcome (Observation.outcome).

Link copied to clipboard
open fun firing(timer: Timer): Observation

The firing of timer: its command sent to its target.

Link copied to clipboard
open fun handling(group: String, subscription: String, context: String, stream: EventStreamRecord, trace: Map<String, String>, topic: String?): Observation

subscription of context, run in the log or lease group, handling stream, retries included; trace holds the propagation fields the entry carries. topic is the topic the entry was read from (a consumption), null for the context's log. A subscription is one by its group and its name: each context has its own snapshot.

Link copied to clipboard
open fun observed(event: ObservedEvent)

Something the core noticed that has no duration of its own (ObservedEvent): a refusal, a dropped signal, a paused partition. Nothing by default.

Link copied to clipboard

The coroutine context that continues the trace whose propagation fields are trace, arrived without a stage of its own (a command forwarded over the cluster channel); empty when there is none to continue.