mirror of
https://github.com/datarhei/core.git
synced 2025-10-06 08:27:08 +08:00
Upgrade dependencies
This commit is contained in:
27
vendor/github.com/prometheus/common/model/alert.go
generated
vendored
27
vendor/github.com/prometheus/common/model/alert.go
generated
vendored
@@ -75,7 +75,12 @@ func (a *Alert) ResolvedAt(ts time.Time) bool {
|
||||
|
||||
// Status returns the status of the alert.
|
||||
func (a *Alert) Status() AlertStatus {
|
||||
if a.Resolved() {
|
||||
return a.StatusAt(time.Now())
|
||||
}
|
||||
|
||||
// StatusAt returns the status of the alert at the given timestamp.
|
||||
func (a *Alert) StatusAt(ts time.Time) AlertStatus {
|
||||
if a.ResolvedAt(ts) {
|
||||
return AlertResolved
|
||||
}
|
||||
return AlertFiring
|
||||
@@ -127,6 +132,17 @@ func (as Alerts) HasFiring() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// HasFiringAt returns true iff one of the alerts is not resolved
|
||||
// at the time ts.
|
||||
func (as Alerts) HasFiringAt(ts time.Time) bool {
|
||||
for _, a := range as {
|
||||
if !a.ResolvedAt(ts) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// Status returns StatusFiring iff at least one of the alerts is firing.
|
||||
func (as Alerts) Status() AlertStatus {
|
||||
if as.HasFiring() {
|
||||
@@ -134,3 +150,12 @@ func (as Alerts) Status() AlertStatus {
|
||||
}
|
||||
return AlertResolved
|
||||
}
|
||||
|
||||
// StatusAt returns StatusFiring iff at least one of the alerts is firing
|
||||
// at the time ts.
|
||||
func (as Alerts) StatusAt(ts time.Time) AlertStatus {
|
||||
if as.HasFiringAt(ts) {
|
||||
return AlertFiring
|
||||
}
|
||||
return AlertResolved
|
||||
}
|
||||
|
4
vendor/github.com/prometheus/common/model/labelset_string.go
generated
vendored
4
vendor/github.com/prometheus/common/model/labelset_string.go
generated
vendored
@@ -17,7 +17,7 @@ package model
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"sort"
|
||||
"slices"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -28,7 +28,7 @@ func (l LabelSet) String() string {
|
||||
for name := range l {
|
||||
labelNames = append(labelNames, string(name))
|
||||
}
|
||||
sort.Strings(labelNames)
|
||||
slices.Sort(labelNames)
|
||||
var bytea [1024]byte // On stack to avoid memory allocation while building the output.
|
||||
b := bytes.NewBuffer(bytea[:0])
|
||||
b.WriteByte('{')
|
||||
|
Reference in New Issue
Block a user