From a5d4713925913ff6209ac45a24c4536f3d6529f6 Mon Sep 17 00:00:00 2001 From: Dominik Rosiek <58699848+sumo-drosiek@users.noreply.github.com> Date: Fri, 5 Jul 2024 10:30:10 +0200 Subject: [PATCH] fix(logs): do not add exporters mutliple times to the pipeline (#3796) * fix(logs): do not add exporters mutliple times to the pipeline Signed-off-by: Dominik Rosiek * chore: tests Signed-off-by: Dominik Rosiek * chore: changelog Signed-off-by: Dominik Rosiek --------- Signed-off-by: Dominik Rosiek --- .changelog/3796.fixed.txt | 1 + deploy/helm/sumologic/templates/_helpers/_logs.tpl | 1 + .../testdata/goldenfile/metadata_logs_otc/routing.input.yaml | 1 + .../testdata/goldenfile/metadata_logs_otc/routing.output.yaml | 2 ++ 4 files changed, 5 insertions(+) create mode 100644 .changelog/3796.fixed.txt diff --git a/.changelog/3796.fixed.txt b/.changelog/3796.fixed.txt new file mode 100644 index 0000000000..adf9198db7 --- /dev/null +++ b/.changelog/3796.fixed.txt @@ -0,0 +1 @@ +fix(logs): do not add exporters mutliple times to the pipeline \ No newline at end of file diff --git a/deploy/helm/sumologic/templates/_helpers/_logs.tpl b/deploy/helm/sumologic/templates/_helpers/_logs.tpl index c67fec66df..26ad92db7d 100644 --- a/deploy/helm/sumologic/templates/_helpers/_logs.tpl +++ b/deploy/helm/sumologic/templates/_helpers/_logs.tpl @@ -127,6 +127,7 @@ Return all exporters for .Type pipeline {{- $exporters = append $exporters $exporter -}} {{- end -}} {{- end -}} +{{- $exporters = uniq $exporters -}} {{- range $_, $exporter := $exporters }} {{ printf "- %s" $exporter }} {{- end }} diff --git a/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.input.yaml b/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.input.yaml index 6cdf0ddce3..6df29369bc 100644 --- a/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.input.yaml +++ b/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.input.yaml @@ -13,6 +13,7 @@ sumologic: routing: fallbackExporters: - debug + - sumologic/test table: - exporter: sumologic/test statement: route() where resource.attributes["exporter"] == "test" diff --git a/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.output.yaml b/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.output.yaml index eb9a92c03a..3133052e2a 100644 --- a/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.output.yaml +++ b/tests/helm/testdata/goldenfile/metadata_logs_otc/routing.output.yaml @@ -221,6 +221,7 @@ data: routing/containers: default_exporters: - debug + - sumologic/test table: - exporters: - sumologic/test @@ -228,6 +229,7 @@ data: routing/systemd: default_exporters: - debug + - sumologic/test table: - exporters: - sumologic/test