/
githubmirror
/
origin
Обзор
Документация
Войти
/
githubmirror
/
origin
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/monitor/monitorapi/disruption.go
29 строк
844 B
Vadim Rutkovsky
Reapply "Reapply "OCPBUGS-18865: Reapply "Merge pull request #28944 from vrutkovs/in-cluster-fixes-v4"""
03 апр 2025, 15:23
03 апр 2025, 15:23
289a4b2
Код
Авторство
О чём код?
package monitorapi import ( "time" ) const EventDir = "monitor-events" // BackendDisruptionSeconds return duration of disruption observed (rounded to nearest second), // disruptionMessages, and New or Reused connection type. func BackendDisruptionSeconds(backendDisruptionName string, events Intervals) (time.Duration, []string) { disruptionEvents := events.Filter( And( IsErrorEvent, IsEventForBackendDisruptionName(backendDisruptionName), ), ) disruptionMessages := disruptionEvents.Strings() return disruptionEvents.Duration(1 * time.Second).Round(time.Second), disruptionMessages } func IsDisruptionEvent(eventInterval Interval) bool { return eventInterval.Source == SourceDisruption } func HasRealLoadBalancer(eventInterval Interval) bool { return eventInterval.Locator.Keys[LocatorLoadBalancerKey] != "localhost" }