Skip to content

Commit

Permalink
NETOBSERV-1458: reduce loki streams, index FlowLayer (#554)
Browse files Browse the repository at this point in the history
* NETOBSERV-1458: reduce loki streams, index FlowInfra

* fix test
  • Loading branch information
jotak authored Feb 2, 2024
1 parent cbde5f8 commit 5450d07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions controllers/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ const (
LokiCRReader = "netobserv-reader"
)

var LokiIndexFields = []string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "SrcK8S_Type", "DstK8S_Namespace", "DstK8S_OwnerName", "DstK8S_Type"}
var LokiIndexFields = []string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "SrcK8S_Type", "DstK8S_Namespace", "DstK8S_OwnerName", "DstK8S_Type", "K8S_FlowLayer"}
var LokiConnectionIndexFields = []string{"_RecordType"}
var LokiDeduperMarkIndexFields = []string{"FlowDirection", "Duplicate"}
var LokiDeduperMarkIndexFields = []string{"FlowDirection"}
var LokiZoneIndexFields = []string{"SrcK8S_Zone", "DstK8S_Zone"}
var FlowCollectorName = types.NamespacedName{Name: "cluster"}
var EnvNoHTTP2 = corev1.EnvVar{
Expand Down
13 changes: 12 additions & 1 deletion controllers/flp/flp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,7 @@ func TestConfigMapShouldDeserializeAsJSONWithLokiManual(t *testing.T) {
"DstK8S_Namespace",
"DstK8S_OwnerName",
"DstK8S_Type",
"K8S_FlowLayer",
"_RecordType",
}, lokiCfg.Labels)
assert.Equal(`{app="netobserv-flowcollector"}`, fmt.Sprintf("%v", lokiCfg.StaticLabels))
Expand Down Expand Up @@ -702,7 +703,17 @@ func TestConfigMapShouldDeserializeAsJSONWithLokiStack(t *testing.T) {
assert.Equal(cfg.Loki.Advanced.WriteMinBackoff.Duration.String(), lokiCfg.MinBackoff)
assert.Equal(cfg.Loki.Advanced.WriteMaxBackoff.Duration.String(), lokiCfg.MaxBackoff)
assert.EqualValues(*cfg.Loki.Advanced.WriteMaxRetries, lokiCfg.MaxRetries)
assert.EqualValues([]string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "SrcK8S_Type", "DstK8S_Namespace", "DstK8S_OwnerName", "DstK8S_Type", "_RecordType", "FlowDirection", "Duplicate"}, lokiCfg.Labels)
assert.EqualValues([]string{
"SrcK8S_Namespace",
"SrcK8S_OwnerName",
"SrcK8S_Type",
"DstK8S_Namespace",
"DstK8S_OwnerName",
"DstK8S_Type",
"K8S_FlowLayer",
"_RecordType",
"FlowDirection",
}, lokiCfg.Labels)
assert.Equal(`{app="netobserv-flowcollector"}`, fmt.Sprintf("%v", lokiCfg.StaticLabels))

assert.Equal(cfg.Processor.Metrics.Server.Port, int32(decoded.MetricsSettings.Port))
Expand Down

0 comments on commit 5450d07

Please sign in to comment.