NetworkEvent

class NetworkEvent(val endpointId: String, val method: String, val durationMs: Long, val statusCode: Int? = null, val errorType: String? = null, val isRetryable: Boolean = false, val attempt: Int = 0, val isFinalAttempt: Boolean = true)

A single observed network request outcome, for telemetry/analytics. The Kotlin counterpart of Novalingo's NetworkTelemetryEvent, kept transport-agnostic so any analytics backend can consume it.

Constructors

Link copied to clipboard
constructor(endpointId: String, method: String, durationMs: Long, statusCode: Int? = null, errorType: String? = null, isRetryable: Boolean = false, attempt: Int = 0, isFinalAttempt: Boolean = true)

Properties

Link copied to clipboard

the 0-based attempt index this event describes (0 = first try). A request that is retried emits one event per failed attempt followed by a final success/failure event.

Link copied to clipboard

wall-clock duration of the attempt(s).

Link copied to clipboard

a normalized, low-cardinality endpoint identifier (e.g. videos/:id).

Link copied to clipboard

a coarse error classification, or null on success.

Link copied to clipboard

whether this event is the last one for its logical request — true for a success, or for a failure the RetryPolicy declined to retry; false for a failed attempt that's about to be retried. Lets a metrics bridge emit exactly one request-duration observation per logical request (filter on isFinalAttempt) while still using every event, including non-final ones, for a per-attempt/retry-count counter.

Link copied to clipboard

whether the failure is considered transient.

Link copied to clipboard

Whether this event represents a successful (2xx) request.

Link copied to clipboard

the HTTP method.

Link copied to clipboard

the final HTTP status, or null if the request never completed.

Functions

Link copied to clipboard
operator fun component1(): String
Link copied to clipboard
operator fun component2(): String
Link copied to clipboard
operator fun component3(): Long
Link copied to clipboard
operator fun component4(): Int?
Link copied to clipboard
operator fun component5(): String?
Link copied to clipboard
operator fun component6(): Boolean
Link copied to clipboard
operator fun component7(): Int
Link copied to clipboard
fun copy(endpointId: String = this.endpointId, method: String = this.method, durationMs: Long = this.durationMs, statusCode: Int? = this.statusCode, errorType: String? = this.errorType, isRetryable: Boolean = this.isRetryable, attempt: Int = this.attempt): NetworkEvent

Preserves the copy method and copy$default bridge generated by the pre-0.4 data class.

fun copy(endpointId: String, method: String, durationMs: Long, statusCode: Int?, errorType: String?, isRetryable: Boolean, attempt: Int, isFinalAttempt: Boolean): NetworkEvent

Copies an event while explicitly changing whether it is the final attempt.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String