OperationTimer
No overview available.
Attributes
| Attribute | Type | Description |
|---|---|---|
| Start | time.Time | Stores the starting time of an operation, used to calculate the duration of the operation. |
| Success | prometheus.Observer | An observer used to record the duration of successful operations, contributing to metrics for successful execution times. |
| Failure | prometheus.Observer | An 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.
Parameters
| Name | Type | Description |
|---|---|---|
| err | *error | The error object indicating if the operation failed. If 'nil', the operation is considered successful; otherwise, it's a failure. |