Implement bad connections baseline reset functionality
Publish telemt-api gateway Docker image / test (push) Successful in 9s
Publish telemt-api gateway Docker image / build-and-push (push) Successful in 2m1s

- Added a new field `badConnBaseline` in the `Handler` struct to store the baseline for bad connections.
- Updated the `BuildIncidents` function to utilize the effective bad connections count for incident generation.
- Introduced a new API endpoint `/api/agg/bad-connections/reset` to reset the bad connections baseline.
- Enhanced the frontend with a button to trigger the reset action, providing user feedback through toast notifications.
- Updated Svelte components to handle the reset functionality and display appropriate messages based on the operation's success or failure.
This commit is contained in:
Denozordec
2026-04-12 13:30:56 +07:00
parent ea2ecb44d2
commit d1095081bc
8 changed files with 233 additions and 4 deletions
+5 -4
View File
@@ -65,7 +65,8 @@ func BuildIncidents(ctx context.Context, h *Handler, aliases []string) (Incident
partial = true
continue
}
if data.ConnectionsBadTotal >= 10000 {
badEff := h.effectiveConnectionsBad(alias, data.ConnectionsBadTotal)
if badEff >= 10000 {
out.Items = append(out.Items, IncidentItem{
ID: fmt.Sprintf("bad_connections_high:%s", alias),
Kind: "bad_connections_high",
@@ -75,13 +76,13 @@ func BuildIncidents(ctx context.Context, h *Handler, aliases []string) (Incident
Summary: "Резкий рост ошибок клиентских соединений",
AffectedAliases: []string{alias},
MetricName: "connections_bad_total",
MetricValue: float64(data.ConnectionsBadTotal),
MetricValue: float64(badEff),
MetricThreshold: 10000,
Actions: []IncidentAction{
{Label: "Node dashboard", Href: "/servers/" + alias},
},
})
} else if data.ConnectionsBadTotal >= 1000 {
} else if badEff >= 1000 {
out.Items = append(out.Items, IncidentItem{
ID: fmt.Sprintf("bad_connections_warn:%s", alias),
Kind: "bad_connections_warn",
@@ -91,7 +92,7 @@ func BuildIncidents(ctx context.Context, h *Handler, aliases []string) (Incident
Summary: "Наблюдается рост ошибок клиентских соединений",
AffectedAliases: []string{alias},
MetricName: "connections_bad_total",
MetricValue: float64(data.ConnectionsBadTotal),
MetricValue: float64(badEff),
MetricThreshold: 1000,
Actions: []IncidentAction{
{Label: "Node dashboard", Href: "/servers/" + alias},