intervalStart

abstract suspend fun intervalStart(wideEventId: Long, key: String, timeout: Duration? = null, buckets: Set<Duration>? = DEFAULT_INTERVAL_BUCKETS): Result<Unit>

Start a named interval inside the flow.

If timeout elapses before intervalEnd, flowFinish or flowAbort, the flow auto-finishes with FlowStatus.Unknown and is sent. Explicit finish/abort cancels any pending timeouts.

The measured duration is bucketed according to buckets. The recorded duration is rounded down to the nearest bucket. Values below the smallest bucket are recorded as 0. A null value disables bucketing and records the raw duration.

Parameters

wideEventId

ID of the wide event.

key

Interval key (e.g., "token_refresh_duration").

timeout

Optional duration for auto-finish.

buckets

Bucket boundaries for the measured duration, or null to disable bucketing. Defaults to DEFAULT_INTERVAL_BUCKETS.