PtcRunner.Kernel.Events (PtcRunner v0.14.0)

Copy Markdown View Source

Internal canonical event helpers.

Sink failure is reflected atomically into run state so a private fail-closed event policy becomes the terminal run outcome.

Summary

Functions

Returns non-negative elapsed monotonic milliseconds.

Emits an event and records fail-closed sink failure in run state.

Builds a run-local identifier for an evaluation or capability attempt.

Copies a payload-free rejection class from an error envelope onto event data.

Derives a valid W3C trace context from private run-local identifiers.

Functions

duration_ms(started_ms)

Returns non-negative elapsed monotonic milliseconds.

emit(state, sink, type, data)

Emits an event and records fail-closed sink failure in run state.

id(prefix)

Builds a run-local identifier for an evaluation or capability attempt.

put_rejection_class(data, result)

@spec put_rejection_class(map(), term()) :: map()

Copies a payload-free rejection class from an error envelope onto event data.

Known Kernel envelope kind and reason atoms remain readable. An unrecognized atom is retained only as a one-way fingerprint. Details, messages, and caller-supplied strings stay off the canonical event. Successful results omit these fields.

traceparent(trace_id, capability_id)

@spec traceparent(binary(), binary()) :: binary()

Derives a valid W3C trace context from private run-local identifiers.

Hashing prevents arbitrary operator-selected trace IDs from crossing the provider boundary. The capability attempt supplies a distinct span ID.