recordFailure

open fun recordFailure(tableName: String, operation: String, durationMs: Long, attempts: Int, exceptionType: String)

Called when a query ultimately fails and no successful result was ever produced — covers retry exhaustion, an immediate non-retryable exception (wrong type for io.kandra.runtime.RetryConfig.retryOn, or a non-idempotent statement), and rejection because Kandra is shutting down. Has a no-op default so existing KandraMetrics implementations keep compiling unchanged — this interface is public and pluggable, so adding this hook must not be a breaking change.

Parameters

tableName

the primary table name the query targeted

operation

same free-form operation string as record

durationMs

wall-clock duration from first attempt to final failure, in milliseconds (0 for a shutdown-rejection, which fails before any attempt is made)

attempts

total number of execution attempts made before giving up (0 for a shutdown-rejection that never attempted the query at all)

exceptionType

the fully-qualified class name of the exception that caused the failure (falls back to the simple name, or "Unknown"/"Throwable" if unavailable)