mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-02 03:27:54 +00:00
Port: Telemetry For Lease Expiration Times (#10375)
* port lease metrics * go mod vendor * caught a bug
This commit is contained in:
@@ -37,3 +37,22 @@ func TTLBucket(ttl time.Duration) string {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func ExpiryBucket(expiryTime time.Time, leaseEpsilon time.Duration, rollingWindow time.Time, labelNS string, useNS bool) *LeaseExpiryLabel {
|
||||
if !useNS {
|
||||
labelNS = ""
|
||||
}
|
||||
leaseExpiryLabel := LeaseExpiryLabel{LabelNS: labelNS}
|
||||
|
||||
// calculate rolling window
|
||||
if expiryTime.Before(rollingWindow) {
|
||||
leaseExpiryLabel.LabelName = expiryTime.Round(leaseEpsilon).String()
|
||||
return &leaseExpiryLabel
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type LeaseExpiryLabel = struct {
|
||||
LabelName string
|
||||
LabelNS string
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user