From 596ee4fdcaed272cc882752907d68a45d66ddf11 Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Thu, 7 Sep 2023 11:26:01 +0200 Subject: [PATCH 1/2] NETOBSERV-1274 index duplicate (improve query perfs) --- controllers/constants/constants.go | 2 +- controllers/flowlogspipeline/flp_common_objects.go | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/controllers/constants/constants.go b/controllers/constants/constants.go index 98a2f79b5..8447fb921 100644 --- a/controllers/constants/constants.go +++ b/controllers/constants/constants.go @@ -34,6 +34,6 @@ const ( EndConnectionType = "endConnection" ) -var LokiIndexFields = []string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "DstK8S_Namespace", "DstK8S_OwnerName", "FlowDirection"} +var LokiIndexFields = []string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "DstK8S_Namespace", "DstK8S_OwnerName", "FlowDirection", "Duplicate"} var LokiConnectionIndexFields = []string{"_RecordType"} var FlowCollectorName = types.NamespacedName{Name: "cluster"} diff --git a/controllers/flowlogspipeline/flp_common_objects.go b/controllers/flowlogspipeline/flp_common_objects.go index e184ad399..13695de68 100644 --- a/controllers/flowlogspipeline/flp_common_objects.go +++ b/controllers/flowlogspipeline/flp_common_objects.go @@ -540,7 +540,6 @@ func (b *builder) addConnectionTracking(indexFields []string, lastStage config.P SwapAB: true, }, }) - } return indexFields, lastStage } From 9a0872fea271d5c96e3c0b8b4dae7b27fc173277 Mon Sep 17 00:00:00 2001 From: Joel Takvorian Date: Thu, 7 Sep 2023 12:26:23 +0200 Subject: [PATCH 2/2] NETOBSERV-314: Index src/dst types and fix test --- controllers/constants/constants.go | 2 +- controllers/flowlogspipeline/flp_test.go | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/controllers/constants/constants.go b/controllers/constants/constants.go index 8447fb921..2cb1ff06c 100644 --- a/controllers/constants/constants.go +++ b/controllers/constants/constants.go @@ -34,6 +34,6 @@ const ( EndConnectionType = "endConnection" ) -var LokiIndexFields = []string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "DstK8S_Namespace", "DstK8S_OwnerName", "FlowDirection", "Duplicate"} +var LokiIndexFields = []string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "SrcK8S_Type", "DstK8S_Namespace", "DstK8S_OwnerName", "DstK8S_Type", "FlowDirection", "Duplicate"} var LokiConnectionIndexFields = []string{"_RecordType"} var FlowCollectorName = types.NamespacedName{Name: "cluster"} diff --git a/controllers/flowlogspipeline/flp_test.go b/controllers/flowlogspipeline/flp_test.go index bd070ed22..368a8d690 100644 --- a/controllers/flowlogspipeline/flp_test.go +++ b/controllers/flowlogspipeline/flp_test.go @@ -630,7 +630,17 @@ func TestConfigMapShouldDeserializeAsJSON(t *testing.T) { assert.Equal(loki.MaxBackoff.Duration.String(), lokiCfg.MaxBackoff) assert.EqualValues(*loki.MaxRetries, lokiCfg.MaxRetries) assert.EqualValues(loki.BatchSize, lokiCfg.BatchSize) - assert.EqualValues([]string{"SrcK8S_Namespace", "SrcK8S_OwnerName", "DstK8S_Namespace", "DstK8S_OwnerName", "FlowDirection", "_RecordType"}, lokiCfg.Labels) + assert.EqualValues([]string{ + "SrcK8S_Namespace", + "SrcK8S_OwnerName", + "SrcK8S_Type", + "DstK8S_Namespace", + "DstK8S_OwnerName", + "DstK8S_Type", + "FlowDirection", + "Duplicate", + "_RecordType", + }, lokiCfg.Labels) assert.Equal(`{app="netobserv-flowcollector"}`, fmt.Sprintf("%v", lokiCfg.StaticLabels)) assert.Equal(cfg.Processor.Metrics.Server.Port, int32(decoded.MetricsSettings.Port))