SetPartitionLagSeconds is similar to the auto exported lag, except it is in real clock seconds which can only be known after the record is read from the queue, therefore it is set by the caller. Call ResetLagMetricsForRevokedPartitions when partitions are revoked to prevent exporting stale data.
(group string, partition int32, lag time.Duration)
| 98 | // which can only be known after the record is read from the queue, therefore it is set by the caller. |
| 99 | // Call ResetLagMetricsForRevokedPartitions when partitions are revoked to prevent exporting stale data. |
| 100 | func SetPartitionLagSeconds(group string, partition int32, lag time.Duration) { |
| 101 | metricPartitionLagSeconds.WithLabelValues(group, strconv.Itoa(int(partition))).Set(lag.Seconds()) |
| 102 | } |
| 103 | |
| 104 | // ResetLagMetricsForRevokedPartitions should be called when a partition is revoked to prevent |
| 105 | // exporting stale metrics for partitions that the application no longer owns. |
no test coverage detected