Skip to main content

OperationTimer

No overview available.

Attributes​

AttributeTypeDescription
Starttime.TimeStores the starting time of an operation, used to calculate the duration of the operation.
Successprometheus.ObserverAn observer used to record the duration of successful operations, contributing to metrics for successful execution times.
Failureprometheus.ObserverAn observer used to record the duration of failed operations, contributing to metrics for failed execution times.

Methods​


Stop()​

@classmethod
def Stop(
err: *error
)

Records the duration of the operation and observes it as either a success or a failure based on the provided error. This method should be called at the end of an operation to log its outcome and timing.

Parameters​

NameTypeDescription
err*errorThe error object indicating whether the operation failed. If 'err' is nil, the operation is considered successful; otherwise, it's a failure.