mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-08 05:49:57 +00:00
[refactor/TRA-3693] type:latency to slo and latency field to response-time (#282)
* type:latency to slo and latency field to response-time * remove comment from import * Friendly message on ignored rules and format * formatting * change conditional to catch negative values and ignore it * Fix Bug Alon Reported * sliceUtils to shared
This commit is contained in:
@@ -101,7 +101,7 @@ func MatchRequestPolicy(harEntry har.Entry, service string) (resultPolicyToSend
|
||||
|
||||
func PassedValidationRules(rulesMatched []RulesMatched) (bool, int64, int) {
|
||||
var numberOfRulesMatched = len(rulesMatched)
|
||||
var latency int64 = -1
|
||||
var responseTime int64 = -1
|
||||
|
||||
if numberOfRulesMatched == 0 {
|
||||
return false, 0, numberOfRulesMatched
|
||||
@@ -109,15 +109,15 @@ func PassedValidationRules(rulesMatched []RulesMatched) (bool, int64, int) {
|
||||
|
||||
for _, rule := range rulesMatched {
|
||||
if rule.Matched == false {
|
||||
return false, latency, numberOfRulesMatched
|
||||
return false, responseTime, numberOfRulesMatched
|
||||
} else {
|
||||
if strings.ToLower(rule.Rule.Type) == "latency" {
|
||||
if rule.Rule.Latency < latency || latency == -1 {
|
||||
latency = rule.Rule.Latency
|
||||
if strings.ToLower(rule.Rule.Type) == "responseTime" {
|
||||
if rule.Rule.ResponseTime < responseTime || responseTime == -1 {
|
||||
responseTime = rule.Rule.ResponseTime
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true, latency, numberOfRulesMatched
|
||||
return true, responseTime, numberOfRulesMatched
|
||||
}
|
||||
|
Reference in New Issue
Block a user