From 8631bfce59c5095522c644e32601692cd105419c Mon Sep 17 00:00:00 2001 From: Riccardo Freschi Date: Thu, 13 Jun 2024 17:25:41 +0200 Subject: [PATCH] fix for: logs pipeline in OpenTelemetryCollector references undefined receiver and exporter if adotcontainerlogs.pattern.enabled is not defined in cdk.json --- lib/common/resources/otel-collector-config.yml | 2 ++ .../index.ts | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/lib/common/resources/otel-collector-config.yml b/lib/common/resources/otel-collector-config.yml index d9f385aa..53f80a97 100644 --- a/lib/common/resources/otel-collector-config.yml +++ b/lib/common/resources/otel-collector-config.yml @@ -1879,10 +1879,12 @@ spec: metrics: receivers: [prometheus] exporters: [logging, prometheusremotewrite] + {{ start enableAdotContainerLogsPipeline }} logs: receivers: [filelog] processors: [batch,k8sattributes] exporters: [awscloudwatchlogs] + {{ stop enableAdotContainerLogsPipeline }} {{ start enableAdotMetricsCollectionTelemetry }} telemetry: metrics: diff --git a/lib/single-new-eks-opensource-observability-pattern/index.ts b/lib/single-new-eks-opensource-observability-pattern/index.ts index dfcb4652..ea5db0d8 100644 --- a/lib/single-new-eks-opensource-observability-pattern/index.ts +++ b/lib/single-new-eks-opensource-observability-pattern/index.ts @@ -92,6 +92,12 @@ export default class SingleNewEksOpenSourceobservabilityPattern { "{{ stop enableAdotContainerLogsExporter }}", jsonStringnew.context["adotcontainerlogs.pattern.enabled"] ); + doc = utils.changeTextBetweenTokens( + doc, + "{{ start enableAdotContainerLogsPipeline }}", + "{{ stop enableAdotContainerLogsPipeline }}", + jsonStringnew.context["adotcontainerlogs.pattern.enabled"] + ); doc = utils.changeTextBetweenTokens( doc, "{{ start kubecostJob }}",