Module journey

Module journey 

Source
Expand description

API journey recorder (DW-110): records the request flow through the gateway as a JSON document for debugging.

A Journey is the ordered sequence of phases a request passed through (route match, authn, authz, transforms, upstream pick, response), each captured as a JourneyStep (phase, duration, result, detail). The recorder is a bounded in-memory ring buffer of recent journeys (for live debugging) plus a JSON serializer that stores the journey via the existing analytics raw table’s custom dimensions column (a JSON object column – no schema change needed).

§Storage

The journey JSON document is carried on the AccessRecord(crate::observability::AccessRecord)’s custom dimensions as a _journey key (the same JSON object column the DW-043 custom dimensions ride). This reuses the existing raw table’s fire-and-forget write path – no schema migration, no new table, no new writer channel. The in-memory ring buffer is a bounded VecDeque (capped at JOURNEY_BUFFER_CAP) for live debugging queries; the durable copy is the raw row.

§Retention

The journey’s durable retention is the raw table’s retention (the analytics.retention config, default 24h). The retention_hours config field on JourneyConfig is an advisory cap that the recorder honors by dropping journeys older than the window from the in-memory buffer (the raw table’s own retention handles the durable copy).

The config schema type (JourneyConfig) lives in crate::config (always present, so configs round-trip without the api_lifecycle feature). This module re-exports it as the runtime-facing alias the recorder consumes.

Re-exports§

pub use crate::config::LifecycleJourneyConfig as JourneyConfig;

Structs§

Journey
A recorded request journey: the request id, the ordered steps, and the timestamp (wall-clock ms since the Unix epoch).
JourneyRecorder
The journey recorder: a bounded in-memory ring buffer of recent journeys, plus the retention window for dropping stale entries.
JourneyStep
One step in a request’s journey through the gateway.

Enums§

JourneyStepResult
The result of a journey step.

Functions§

journey_dimension
Build the custom-dimension entry that carries a journey on an AccessRecord into the raw table’s JSON object column. The key is _journey (the leading underscore avoids collisions with operator-declared dimensions). Returns the (key, value) pair to push onto AccessRecord::custom.