in pkg/profiling/continuous/checker/common/http_checker.go [183:221]
func (n *HTTPBasedChecker[Data]) Check(ctx base.CheckContext, metricsAppender *base.MetricsAppender) []base.ThresholdCause {
causes := make([]base.ThresholdCause, 0)
for _, pidPolicies := range n.PidWithInfos {
for item, itemInfo := range pidPolicies.PolicyWithWindows {
globalURI := ""
if itemInfo.uriRegex != nil {
globalURI = itemInfo.uriRegex.String()
}
for uri, windows := range itemInfo.uriWithTimeWindows {
n.flushMetrics(uri, windows, pidPolicies.Process, metricsAppender)
}
if itemInfo.defaultTimeWindows != nil {
n.flushMetrics(globalURI, itemInfo.defaultTimeWindows, pidPolicies.Process, metricsAppender)
}
if !ctx.ShouldCheck(pidPolicies.Process, item) {
continue
}
// url list checker
for uri, window := range itemInfo.uriWithTimeWindows {
if lastMatch, isMatch := window.MatchRule(item, func(val float64) bool {
return val >= itemInfo.threshold
}); isMatch {
causes = append(causes, NewURICause(pidPolicies.Process, false, uri, item,
n.MonitorType, itemInfo.threshold, lastMatch))
}
}
// regex or global
if lastMatch, isMatch := itemInfo.defaultTimeWindows.MatchRule(item, func(val float64) bool {
return val >= itemInfo.threshold
}); isMatch {
causes = append(causes, NewURICause(pidPolicies.Process, itemInfo.uriRegex != nil, globalURI, item,
n.MonitorType, itemInfo.threshold, lastMatch))
}
}
}
return causes
}