mirror of
https://github.com/prometheus/prometheus.git
synced 2025-01-11 05:47:27 -08:00
Add stabilizing to UI
Signed-off-by: Julien Pivotto <roidelapluie@o11y.eu>
This commit is contained in:
parent
8e500dbd39
commit
2c408289f8
|
@ -539,6 +539,7 @@ func (r *AlertingRule) String() string {
|
||||||
Alert: r.name,
|
Alert: r.name,
|
||||||
Expr: r.vector.String(),
|
Expr: r.vector.String(),
|
||||||
For: model.Duration(r.holdDuration),
|
For: model.Duration(r.holdDuration),
|
||||||
|
KeepFiringFor: model.Duration(r.keepFiringFor),
|
||||||
Labels: r.labels.Map(),
|
Labels: r.labels.Map(),
|
||||||
Annotations: r.annotations.Map(),
|
Annotations: r.annotations.Map(),
|
||||||
}
|
}
|
||||||
|
|
|
@ -1115,7 +1115,7 @@ type Alert struct {
|
||||||
Annotations labels.Labels `json:"annotations"`
|
Annotations labels.Labels `json:"annotations"`
|
||||||
State string `json:"state"`
|
State string `json:"state"`
|
||||||
ActiveAt *time.Time `json:"activeAt,omitempty"`
|
ActiveAt *time.Time `json:"activeAt,omitempty"`
|
||||||
KeepFiringSince *time.Time `json:"keep_firing_since,omitempty"`
|
KeepFiringSince *time.Time `json:"keepFiringSince,omitempty"`
|
||||||
Value string `json:"value"`
|
Value string `json:"value"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1143,9 +1143,11 @@ func rulesAlertsToAPIAlerts(rulesAlerts []*rules.Alert) []*Alert {
|
||||||
Annotations: ruleAlert.Annotations,
|
Annotations: ruleAlert.Annotations,
|
||||||
State: ruleAlert.State.String(),
|
State: ruleAlert.State.String(),
|
||||||
ActiveAt: &ruleAlert.ActiveAt,
|
ActiveAt: &ruleAlert.ActiveAt,
|
||||||
KeepFiringSince: &ruleAlert.KeepFiringSince,
|
|
||||||
Value: strconv.FormatFloat(ruleAlert.Value, 'e', -1, 64),
|
Value: strconv.FormatFloat(ruleAlert.Value, 'e', -1, 64),
|
||||||
}
|
}
|
||||||
|
if !ruleAlert.KeepFiringSince.IsZero() {
|
||||||
|
apiAlerts[i].KeepFiringSince = &ruleAlert.KeepFiringSince
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiAlerts
|
return apiAlerts
|
||||||
|
|
|
@ -29,6 +29,7 @@ export interface Alert {
|
||||||
value: string;
|
value: string;
|
||||||
annotations: Record<string, string>;
|
annotations: Record<string, string>;
|
||||||
activeAt: string;
|
activeAt: string;
|
||||||
|
keepFiringSince: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RuleGroup {
|
interface RuleGroup {
|
||||||
|
|
|
@ -96,9 +96,14 @@ const CollapsibleAlertPanel: FC<CollapsibleAlertPanelProps> = ({ rule, showAnnot
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<h5 className="m-0">
|
<h5 className="m-0">
|
||||||
<Badge color={alertColors[alert.state] + ' text-uppercase'} className="px-3">
|
<Badge color={alertColors[alert.state] + ' text-uppercase'} className="px-3 mr-1">
|
||||||
{alert.state}
|
{alert.state}
|
||||||
</Badge>
|
</Badge>
|
||||||
|
{alert.keepFiringSince && (
|
||||||
|
<Badge color="secondary" className="px-3">
|
||||||
|
Stabilizing
|
||||||
|
</Badge>
|
||||||
|
)}
|
||||||
</h5>
|
</h5>
|
||||||
</td>
|
</td>
|
||||||
<td>{alert.activeAt}</td>
|
<td>{alert.activeAt}</td>
|
||||||
|
|
Loading…
Reference in a new issue