Skip to content

Commit 0bb7f34

Browse files
committed
fix todos
1 parent 456b454 commit 0bb7f34

File tree

6 files changed

+21
-31
lines changed

6 files changed

+21
-31
lines changed

api/flowcollector/v1beta2/flowcollector_defaults.go

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -164,10 +164,8 @@ var (
164164
Info: "100",
165165
},
166166
GroupBy: GroupByNamespace,
167-
TrendOffset: &v1.Duration{Duration: time.Minute * 30},
168-
TrendDuration: &v1.Duration{Duration: time.Minute * 30},
169-
// TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
170-
// TrendDuration: &v1.Duration{Duration: time.Hour},
167+
TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
168+
TrendDuration: &v1.Duration{Duration: time.Hour},
171169
},
172170
},
173171
},
@@ -180,21 +178,17 @@ var (
180178
Warning: "200",
181179
},
182180
GroupBy: GroupByNode,
183-
TrendOffset: &v1.Duration{Duration: time.Minute * 30},
184-
TrendDuration: &v1.Duration{Duration: time.Minute * 30},
185-
// TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
186-
// TrendDuration: &v1.Duration{Duration: time.Hour},
181+
TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
182+
TrendDuration: &v1.Duration{Duration: time.Hour},
187183
},
188184
{
189185
Thresholds: HealthRuleThresholds{
190186
Info: "100",
191187
Warning: "500",
192188
},
193189
GroupBy: GroupByNamespace,
194-
TrendOffset: &v1.Duration{Duration: time.Minute * 30},
195-
TrendDuration: &v1.Duration{Duration: time.Minute * 30},
196-
// TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
197-
// TrendDuration: &v1.Duration{Duration: time.Hour},
190+
TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
191+
TrendDuration: &v1.Duration{Duration: time.Hour},
198192
},
199193
},
200194
},
@@ -207,26 +201,23 @@ var (
207201
Warning: "200",
208202
},
209203
GroupBy: GroupByNode,
210-
TrendOffset: &v1.Duration{Duration: time.Minute * 30},
211-
TrendDuration: &v1.Duration{Duration: time.Minute * 30},
212-
// TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
213-
// TrendDuration: &v1.Duration{Duration: time.Hour},
204+
TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
205+
TrendDuration: &v1.Duration{Duration: time.Hour},
214206
},
215207
{
216208
Thresholds: HealthRuleThresholds{
217209
Info: "100",
218210
Warning: "500",
219211
},
220212
GroupBy: GroupByNamespace,
221-
TrendOffset: &v1.Duration{Duration: time.Minute * 30},
222-
TrendDuration: &v1.Duration{Duration: time.Minute * 30},
223-
// TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
224-
// TrendDuration: &v1.Duration{Duration: time.Hour},
213+
TrendOffset: &v1.Duration{Duration: 24 * time.Hour},
214+
TrendDuration: &v1.Duration{Duration: time.Hour},
225215
},
226216
},
227217
},
228218
{
229219
Template: HealthRuleIngress5xxErrors,
220+
Mode: ModeRecording,
230221
Variants: []HealthRuleVariant{
231222
{
232223
Thresholds: HealthRuleThresholds{
@@ -239,6 +230,7 @@ var (
239230
},
240231
{
241232
Template: HealthRuleIngressHTTPLatencyTrend,
233+
Mode: ModeRecording,
242234
Variants: []HealthRuleVariant{
243235
{
244236
Thresholds: HealthRuleThresholds{

internal/controller/flp/flp_controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func ControllerSpecs() {
465465
}, &pr)
466466
}, timeout, interval).Should(Succeed())
467467
Expect(pr.Spec.Groups).Should(HaveLen(1))
468-
Expect(pr.Spec.Groups[0].Rules).Should(HaveLen(10))
468+
Expect(pr.Spec.Groups[0].Rules).Should(HaveLen(8))
469469

470470
// Manually delete ServiceMonitor
471471
By("Deleting ServiceMonitor")

internal/pkg/metrics/alerts/alerts_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,10 @@ func TestBuildRules_DefaultWithFeaturesAndDisabled(t *testing.T) {
116116
"netobserv:health:netpol_denied:namespace:dst:rate2m",
117117
"NetpolDenied_PerSrcNamespaceWarning",
118118
"NetpolDenied_PerDstNamespaceWarning",
119-
"netobserv:health:tcp_latency_p90:namespace:src:rate2m",
120-
"netobserv:health:tcp_latency_p90:namespace:dst:rate2m",
121-
"Ingress5xxErrors_PerSrcNamespaceWarning",
122-
"Ingress5xxErrors_PerSrcNamespaceInfo",
123-
"IngressHTTPLatencyTrend_PerSrcNamespaceWarning",
124-
"IngressHTTPLatencyTrend_PerSrcNamespaceInfo",
119+
"netobserv:health:tcp_latency_increase_p90:namespace:src:rate2m",
120+
"netobserv:health:tcp_latency_increase_p90:namespace:dst:rate2m",
121+
"netobserv:health:ingress_5xx_errors:namespace:src:rate2m",
122+
"netobserv:health:ingress_http_latency_increase_avg:namespace:src:rate2m",
125123
"NetObservNoFlows",
126124
}, allNames(rules))
127125
assert.Contains(t, rules[2].Annotations["description"], "NetObserv is detecting more than 20% of packets dropped by the kernel [source namespace={{ $labels.namespace }}]")

internal/pkg/metrics/alerts/builder_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,14 @@ func TestRecordingRuleNames(t *testing.T) {
158158
template: flowslatest.HealthRuleLatencyHighTrend,
159159
groupBy: "",
160160
side: asSource,
161-
expected: "netobserv:health:tcp_latency_p90:rate2m",
161+
expected: "netobserv:health:tcp_latency_increase_p90:rate2m",
162162
},
163163
{
164164
name: "LatencyHighTrend by Node",
165165
template: flowslatest.HealthRuleLatencyHighTrend,
166166
groupBy: flowslatest.GroupByNode,
167167
side: asDest,
168-
expected: "netobserv:health:tcp_latency_p90:node:dst:rate2m",
168+
expected: "netobserv:health:tcp_latency_increase_p90:node:dst:rate2m",
169169
},
170170
}
171171

internal/pkg/metrics/alerts/ingress_latency_trend.go renamed to internal/pkg/metrics/alerts/ingress_http_latency_trend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ func newIngressHTTPLatencyTrend(ctx *ruleContext) HealthRule {
1616
}
1717

1818
func (r *ingressHTTPLatencyTrend) RecordingName() string {
19-
return buildRecordingRuleName(r.ctx, "ingress_http_latency_avg", "2m")
19+
return buildRecordingRuleName(r.ctx, "ingress_http_latency_increase_avg", "2m")
2020
}
2121

2222
func (r *ingressHTTPLatencyTrend) GetAnnotations() (map[string]string, error) {

internal/pkg/metrics/alerts/latency_trend.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func newLatencyTrend(ctx *ruleContext) HealthRule {
1515
}
1616

1717
func (r *latencyTrend) RecordingName() string {
18-
return buildRecordingRuleName(r.ctx, "tcp_latency_p90", "2m")
18+
return buildRecordingRuleName(r.ctx, "tcp_latency_increase_p90", "2m")
1919
}
2020

2121
func (r *latencyTrend) GetAnnotations() (map[string]string, error) {

0 commit comments

Comments
 (0)