Observation

One stage of work being observed, from its start to its end: a span and its timings, say.

  • context is what the stage runs in: a TraceContext the work started on the way inherits, empty when the observer traces nothing.

  • trace is the propagation fields of the stage, which what it sends to another node or appends carries.

  • outcome names how the stage ended (ObservedOutcome), before it ends; failed tells it the failure it ended with.

NONE observes nothing, and observe runs a block with no overhead for it.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
Link copied to clipboard
open val trace: Map<String, String>

Functions

Link copied to clipboard
open fun end()
Link copied to clipboard
open fun failed(error: Throwable)
Link copied to clipboard
inline suspend fun <T> Observation.observe(crossinline block: suspend () -> T): T

Runs block as this observed stage: in its Observation.context, telling it what block fails with, and ending it once block returns or fails. For Observation.NONE it only runs block.

Link copied to clipboard
open fun outcome(outcome: ObservedOutcome)