yera.runtime.activity

Construct metadata-only runtime logging events.

Symbols

def create_logging_event — Construct one phase of a metadata-only runtime operation.
def logging_operation — Create a correlated metadata-only logging operation.

create_logging_event

create_logging_event(
    operation_id: UUID,
    actor: LoggingActor,
    activity: LoggingActivity,
    phase: LoggingPhase,
    app_instance: AppInstance,
    parent_operation_id: UUID | None = None,
    elapsed_seconds: float | None = None,
    attributes: LoggingAttributes | None = None,
) → OutputEvent

Construct one phase of a metadata-only runtime operation.

The event retains the ordinary output-event shape so it can cross the existing stream, persistence, and replay boundaries. Started operations use chunk zero; terminal phases use chunk one.

Parameters

operation_id
type: UUID

Stable identity shared by all phases of the operation.

actor
type: LoggingActor

Kind of component performing the operation.

activity
type: LoggingActivity

Kind of operation being performed.

phase
type: LoggingPhase

Lifecycle phase represented by this event.

app_instance
type: AppInstance

App invocation associated with the operation.

parent_operation_id
type: UUID | None = None

Enclosing operation, if any.

elapsed_seconds
type: float | None = None

Monotonic duration for a terminal phase.

attributes
type: LoggingAttributes | None = None

Explicitly reviewed privacy-safe metadata.

Returns

type: OutputEvent

A logging record represented as an ordinary output event.

Raises

ValueError

If the phase and elapsed duration are inconsistent.

logging_operation

logging_operation(
    actor: LoggingActor,
    activity: LoggingActivity,
    app_instance: AppInstance,
    attributes: LoggingAttributes | None = None,
    parent_operation_id: UUID | None = None,
) → _LoggingOperation

Create a correlated metadata-only logging operation.

Entering the returned context emits a started record and establishes its operation ID as the parent of nested activity. Normal exit emits completion; exceptional exit emits failure; calling cancel() emits cancellation. Every operation emits at most one terminal record.

Parameters

actor
type: LoggingActor

Kind of component performing the operation.

activity
type: LoggingActivity

Kind of operation being performed.

app_instance
type: AppInstance

App invocation associated with the operation.

attributes
type: LoggingAttributes | None = None

Explicitly reviewed privacy-safe metadata.

parent_operation_id
type: UUID | None = None

Explicit enclosing operation. When omitted, the currently active logging operation becomes the parent.

Returns

type: _LoggingOperation

An operation context that emits records through the current event stream.