From de0911b1f5966aad36edb8091a5ed5e20a18fa3c Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Wed, 23 Aug 2023 13:46:20 -0400 Subject: [PATCH 01/12] Add CA Bundle Path To Container Insights --- go.mod | 4 +++- go.sum | 9 ++++++++- translator/tocwconfig/tocwconfig_test.go | 9 ++++++++- translator/translate/otel/exporter/awsemf/translator.go | 9 ++++++++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/go.mod b/go.mod index a12eaeed95..f649e6d9d1 100644 --- a/go.mod +++ b/go.mod @@ -78,7 +78,7 @@ replace github.com/go-kit/kit => github.com/go-kit/kit v0.12.1-0.20220808180842- replace github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37 require ( - github.com/BurntSushi/toml v0.4.1 + github.com/BurntSushi/toml v1.3.2 github.com/Jeffail/gabs v1.4.0 github.com/Rican7/retry v0.1.1-0.20160712041035-272ad122d6e5 github.com/aws/aws-sdk-go v1.44.309 @@ -153,6 +153,8 @@ require ( k8s.io/klog/v2 v2.90.1 ) +require github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws v0.24.0 + require ( cloud.google.com/go/compute v1.19.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect diff --git a/go.sum b/go.sum index 15678e0fd4..ba7c2999fa 100644 --- a/go.sum +++ b/go.sum @@ -95,8 +95,9 @@ github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo= github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/Azure/go-ntlmssp v0.0.0-20200615164410-66371956d46c h1:/IBSNwUN8+eKzUzbJPqhK839ygXJ82sde8x3ogr6R28= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= +github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ClickHouse/clickhouse-go v1.5.4 h1:cKjXeYLNWVJIx2J1K6H2CqyRmfwVJVY1OV1coaaFcI0= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= @@ -953,6 +954,8 @@ github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.77.0 h1:l4T8p1MOei5MJOheFAJVuSnJcAR1D929I7ycoqMIKPg= github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.77.0 h1:UU5IzATj3qbO6E3eY27pe5JrP/GiKOal58vWRNzqt94= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws v0.24.0 h1:aAzw1kWnyfQnD7mmd6W4nMUFeB4uIccqDodyAUnVVf8= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws v0.24.0/go.mod h1:cJuh7B7ioJooKFhkrEK2qPd2hRjcs7BPI1Yly1tbb2Q= github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.79.0 h1:EXFITXhCONGJ2htxXqujga3ZJaUQj7hqeLlnpYaVU1s= github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.79.0/go.mod h1:r03E03RLmrUgq1b/AD1owCVLqsg47sEWHent1PHKmR0= github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.77.0 h1:c5u+RvQdxzUpZT21c+nekncCVrHxRjKPAyH6fPGoaQA= @@ -1279,18 +1282,22 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0/go.mod h1: go.opentelemetry.io/contrib/propagators/b3 v1.17.0 h1:ImOVvHnku8jijXqkwCSyYKRDt2YrnGXD4BbhcpfbfJo= go.opentelemetry.io/contrib/propagators/b3 v1.17.0/go.mod h1:IkfUfMpKWmynvvE0264trz0sf32NRTZL4nuAN9AbWRc= go.opentelemetry.io/contrib/zpages v0.42.0 h1:hFscXKQ9PTjyIVmAr6zIV8cMoiEeR9lPIwPVqHi8+5Q= +go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/bridge/opencensus v0.39.0 h1:YHivttTaDhbZIHuPlg1sWsy2P5gj57vzqPfkHItgbwQ= go.opentelemetry.io/otel/bridge/opencensus v0.39.0/go.mod h1:vZ4537pNjFDXEx//WldAR6Ro2LC8wwmFC76njAXwNPE= go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= go.opentelemetry.io/otel/exporters/prometheus v0.39.0/go.mod h1:4jo5Q4CROlCpSPsXLhymi+LYrDXd2ObU5wbKayfZs7Y= +go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc= go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= +go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA= go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= go.opentelemetry.io/otel/sdk/metric v0.39.0 h1:Kun8i1eYf48kHH83RucG93ffz0zGV1sh46FAScOTuDI= go.opentelemetry.io/otel/sdk/metric v0.39.0/go.mod h1:piDIRgjcK7u0HCL5pCA4e74qpK/jk3NiUoAHATVAmiI= +go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg= go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 2060372f5f..5cc64313f3 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -9,6 +9,7 @@ import ( "encoding/json" "errors" "fmt" + "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "io/fs" "os" "path/filepath" @@ -50,7 +51,13 @@ func TestBaseContainerInsightsConfig(t *testing.T) { context.CurrentContext().SetRunInContainer(true) t.Setenv(config.HOST_NAME, "host_name_from_env") t.Setenv(config.HOST_IP, "127.0.0.1") - expectedEnvVars := map[string]string{} + t.Setenv(envconfig.AWS_CA_BUNDLE, "sampleConfig/public_amazon_cert.pem") + defer func() { + t.Setenv(envconfig.AWS_CA_BUNDLE, "") + }() + expectedEnvVars := map[string]string{ + "AWS_CA_BUNDLE": "sampleConfig/public_amazon_cert.pem", + } checkTranslation(t, "base_container_insights_config", "linux", expectedEnvVars, "") checkTranslation(t, "base_container_insights_config", "darwin", nil, "") } diff --git a/translator/translate/otel/exporter/awsemf/translator.go b/translator/translate/otel/exporter/awsemf/translator.go index 94a62658a0..c8e2ec4828 100644 --- a/translator/translate/otel/exporter/awsemf/translator.go +++ b/translator/translate/otel/exporter/awsemf/translator.go @@ -6,6 +6,7 @@ package awsemf import ( _ "embed" "fmt" + "os" "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter" "go.opentelemetry.io/collector/component" @@ -13,6 +14,7 @@ import ( "go.opentelemetry.io/collector/exporter" "gopkg.in/yaml.v3" + "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/awscontainerinsight" @@ -32,6 +34,7 @@ var ( kubernetesBasePathKey = common.ConfigKey(common.LogsKey, common.MetricsCollectedKey, common.KubernetesKey) prometheusBasePathKey = common.ConfigKey(common.LogsKey, common.MetricsCollectedKey, common.PrometheusKey) emfProcessorBasePathKey = common.ConfigKey(prometheusBasePathKey, common.EMFProcessorKey) + endpointOverrideKey = common.ConfigKey(common.LogsKey, common.EndpointOverrideKey) ) type translator struct { @@ -78,6 +81,11 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) { } } cfg.AWSSessionSettings.Region = agent.Global_Config.Region + if c.IsSet(endpointOverrideKey) { + cfg.AWSSessionSettings.Endpoint, _ = common.GetString(c, endpointOverrideKey) + } + cfg.AWSSessionSettings.CertificateFilePath = os.Getenv(envconfig.AWS_CA_BUNDLE) + cfg.AWSSessionSettings.Region = agent.Global_Config.Region if profileKey, ok := agent.Global_Config.Credentials[agent.Profile_Key]; ok { cfg.AWSSessionSettings.Profile = fmt.Sprintf("%v", profileKey) } @@ -98,7 +106,6 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) { return nil, err } } - return cfg, nil } From 74ca8670bfa7a0f7617fefe78e4ad06dfd46e833 Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Wed, 23 Aug 2023 14:02:13 -0400 Subject: [PATCH 02/12] yaml edits for test successs --- .../sampleConfig/base_container_insights_config.yaml | 8 ++++---- .../sampleConfig/emf_and_kubernetes_config.yaml | 2 +- .../sampleConfig/kubernetes_on_prem_config.yaml | 2 +- .../tocwconfig/sampleConfig/log_ecs_metric_only.yaml | 2 +- .../sampleConfig/logs_and_kubernetes_config.yaml | 2 +- .../tocwconfig/sampleConfig/prometheus_config_linux.yaml | 2 +- .../sampleConfig/prometheus_config_windows.yaml | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml index 29c22d60d8..d6f65137e6 100644 --- a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml @@ -1,7 +1,7 @@ connectors: {} exporters: awscloudwatchlogs/emf_logs: - certificate_file_path: "" + certificate_file_path: "sampleConfig/public_amazon_cert.pem" emf_only: true endpoint: "https://fake_endpoint" local_mode: false @@ -38,8 +38,8 @@ exporters: disable_metric_extraction: true version: "0" eks_fargate_container_insights_enabled: false - certificate_file_path: "" - endpoint: "" + certificate_file_path: "sampleConfig/public_amazon_cert.pem" + endpoint: "https://fake_endpoint" enhanced_container_insights: false local_mode: false retain_initial_value_of_delta_metric: false @@ -194,8 +194,8 @@ service: processors: - batch/emf_logs receivers: - - udplog/emf_logs - tcplog/emf_logs + - udplog/emf_logs metrics/containerinsights: exporters: - awsemf/containerinsights diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml index e74427f94e..3ea78bb02a 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml @@ -34,7 +34,7 @@ exporters: disable_metric_extraction: true eks_fargate_container_insights_enabled: false certificate_file_path: "" - endpoint: "" + endpoint: "https://fake_endpoint" enhanced_container_insights: true local_mode: false log_group_name: /aws/containerinsights/{ClusterName}/performance diff --git a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml index d5a17ef254..c48bd9b73a 100644 --- a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml +++ b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml @@ -6,7 +6,7 @@ exporters: dimension_rollup_option: NoDimensionRollup disable_metric_extraction: true eks_fargate_container_insights_enabled: false - endpoint: "" + endpoint: "https://fake_endpoint" enhanced_container_insights: true local_mode: false log_group_name: /aws/containerinsights/{ClusterName}/performance diff --git a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml index d4e8252f43..83b3475e47 100644 --- a/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml +++ b/translator/tocwconfig/sampleConfig/log_ecs_metric_only.yaml @@ -34,7 +34,7 @@ exporters: disable_metric_extraction: false eks_fargate_container_insights_enabled: false certificate_file_path: "" - endpoint: "" + endpoint: "https://fake_endpoint" enhanced_container_insights: false local_mode: false log_group_name: /aws/ecs/containerinsights/{ClusterName}/performance diff --git a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml index f350f63898..9ca187969e 100644 --- a/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/logs_and_kubernetes_config.yaml @@ -34,7 +34,7 @@ exporters: dimension_rollup_option: NoDimensionRollup disable_metric_extraction: false eks_fargate_container_insights_enabled: false - endpoint: "" + endpoint: "https://fake_endpoint" enhanced_container_insights: true local_mode: false log_group_name: /aws/containerinsights/{ClusterName}/performance diff --git a/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml index 23f02ee58b..3dda406528 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml @@ -8,7 +8,7 @@ exporters: retain_initial_value_of_delta_metric: false eks_fargate_container_insights_enabled: false certificate_file_path: "" - endpoint: "" + endpoint: "https://fake_endpoint" enhanced_container_insights: false local_mode: false log_group_name: /aws/ecs/containerinsights/TestCluster/prometheus diff --git a/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml b/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml index e51313d2a4..9608a57508 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml @@ -8,7 +8,7 @@ exporters: retain_initial_value_of_delta_metric: false eks_fargate_container_insights_enabled: false certificate_file_path: "" - endpoint: "" + endpoint: "https://fake_endpoint" enhanced_container_insights: false local_mode: false log_group_name: /aws/ecs/containerinsights/TestCluster/prometheus From 6c3c07582b9d98f00fac175c2b063426c54cb60a Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Wed, 23 Aug 2023 16:51:54 -0400 Subject: [PATCH 03/12] removed the require block --- go.mod | 2 -- go.sum | 6 ------ 2 files changed, 8 deletions(-) diff --git a/go.mod b/go.mod index f649e6d9d1..302f23b339 100644 --- a/go.mod +++ b/go.mod @@ -153,8 +153,6 @@ require ( k8s.io/klog/v2 v2.90.1 ) -require github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws v0.24.0 - require ( cloud.google.com/go/compute v1.19.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect diff --git a/go.sum b/go.sum index ba7c2999fa..36948f0952 100644 --- a/go.sum +++ b/go.sum @@ -954,8 +954,6 @@ github.com/onsi/gomega v1.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusremotewriteexporter v0.77.0 h1:l4T8p1MOei5MJOheFAJVuSnJcAR1D929I7ycoqMIKPg= github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.77.0 h1:UU5IzATj3qbO6E3eY27pe5JrP/GiKOal58vWRNzqt94= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws v0.24.0 h1:aAzw1kWnyfQnD7mmd6W4nMUFeB4uIccqDodyAUnVVf8= -github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws v0.24.0/go.mod h1:cJuh7B7ioJooKFhkrEK2qPd2hRjcs7BPI1Yly1tbb2Q= github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.79.0 h1:EXFITXhCONGJ2htxXqujga3ZJaUQj7hqeLlnpYaVU1s= github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.79.0/go.mod h1:r03E03RLmrUgq1b/AD1owCVLqsg47sEWHent1PHKmR0= github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy v0.77.0 h1:c5u+RvQdxzUpZT21c+nekncCVrHxRjKPAyH6fPGoaQA= @@ -1282,22 +1280,18 @@ go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0/go.mod h1: go.opentelemetry.io/contrib/propagators/b3 v1.17.0 h1:ImOVvHnku8jijXqkwCSyYKRDt2YrnGXD4BbhcpfbfJo= go.opentelemetry.io/contrib/propagators/b3 v1.17.0/go.mod h1:IkfUfMpKWmynvvE0264trz0sf32NRTZL4nuAN9AbWRc= go.opentelemetry.io/contrib/zpages v0.42.0 h1:hFscXKQ9PTjyIVmAr6zIV8cMoiEeR9lPIwPVqHi8+5Q= -go.opentelemetry.io/otel v0.19.0/go.mod h1:j9bF567N9EfomkSidSfmMwIwIBuP37AMAIzVW85OxSg= go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= go.opentelemetry.io/otel/bridge/opencensus v0.39.0 h1:YHivttTaDhbZIHuPlg1sWsy2P5gj57vzqPfkHItgbwQ= go.opentelemetry.io/otel/bridge/opencensus v0.39.0/go.mod h1:vZ4537pNjFDXEx//WldAR6Ro2LC8wwmFC76njAXwNPE= go.opentelemetry.io/otel/exporters/prometheus v0.39.0 h1:whAaiHxOatgtKd+w0dOi//1KUxj3KoPINZdtDaDj3IA= go.opentelemetry.io/otel/exporters/prometheus v0.39.0/go.mod h1:4jo5Q4CROlCpSPsXLhymi+LYrDXd2ObU5wbKayfZs7Y= -go.opentelemetry.io/otel/metric v0.19.0/go.mod h1:8f9fglJPRnXuskQmKpnad31lcLJ2VmNNqIsx/uIwBSc= go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= -go.opentelemetry.io/otel/oteltest v0.19.0/go.mod h1:tI4yxwh8U21v7JD6R3BcA/2+RBoTKFexE/PJ/nSO7IA= go.opentelemetry.io/otel/sdk v1.16.0 h1:Z1Ok1YsijYL0CSJpHt4cS3wDDh7p572grzNrBMiMWgE= go.opentelemetry.io/otel/sdk v1.16.0/go.mod h1:tMsIuKXuuIWPBAOrH+eHtvhTL+SntFtXF9QD68aP6p4= go.opentelemetry.io/otel/sdk/metric v0.39.0 h1:Kun8i1eYf48kHH83RucG93ffz0zGV1sh46FAScOTuDI= go.opentelemetry.io/otel/sdk/metric v0.39.0/go.mod h1:piDIRgjcK7u0HCL5pCA4e74qpK/jk3NiUoAHATVAmiI= -go.opentelemetry.io/otel/trace v0.19.0/go.mod h1:4IXiNextNOpPnRlI4ryK69mn5iC84bjBWZQA5DXz/qg= go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= From 1dd28f8938676037ca4f84de0510c1ef85faba3f Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Wed, 23 Aug 2023 17:29:13 -0400 Subject: [PATCH 04/12] changed the bundle file path --- .../sampleConfig/base_container_insights_config.yaml | 4 ++-- translator/tocwconfig/tocwconfig_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml index d6f65137e6..828d901b1e 100644 --- a/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml +++ b/translator/tocwconfig/sampleConfig/base_container_insights_config.yaml @@ -1,7 +1,7 @@ connectors: {} exporters: awscloudwatchlogs/emf_logs: - certificate_file_path: "sampleConfig/public_amazon_cert.pem" + certificate_file_path: "/etc/test/ca_bundle.pem" emf_only: true endpoint: "https://fake_endpoint" local_mode: false @@ -38,7 +38,7 @@ exporters: disable_metric_extraction: true version: "0" eks_fargate_container_insights_enabled: false - certificate_file_path: "sampleConfig/public_amazon_cert.pem" + certificate_file_path: "/etc/test/ca_bundle.pem" endpoint: "https://fake_endpoint" enhanced_container_insights: false local_mode: false diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 5cc64313f3..43fd8d4eb1 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -51,12 +51,12 @@ func TestBaseContainerInsightsConfig(t *testing.T) { context.CurrentContext().SetRunInContainer(true) t.Setenv(config.HOST_NAME, "host_name_from_env") t.Setenv(config.HOST_IP, "127.0.0.1") - t.Setenv(envconfig.AWS_CA_BUNDLE, "sampleConfig/public_amazon_cert.pem") + t.Setenv(envconfig.AWS_CA_BUNDLE, "/etc/test/ca_bundle.pem") defer func() { t.Setenv(envconfig.AWS_CA_BUNDLE, "") }() expectedEnvVars := map[string]string{ - "AWS_CA_BUNDLE": "sampleConfig/public_amazon_cert.pem", + "AWS_CA_BUNDLE": "/etc/test/ca_bundle.pem", } checkTranslation(t, "base_container_insights_config", "linux", expectedEnvVars, "") checkTranslation(t, "base_container_insights_config", "darwin", nil, "") From 53a9592510d9948b094e472a9cbf6a21c9588ac2 Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Thu, 24 Aug 2023 12:50:53 -0400 Subject: [PATCH 05/12] Fixed the check lint --- translator/tocwconfig/tocwconfig_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 43fd8d4eb1..330cdd57f5 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -9,13 +9,14 @@ import ( "encoding/json" "errors" "fmt" - "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "io/fs" "os" "path/filepath" "strings" "testing" + "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" + "github.com/BurntSushi/toml" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" From d27fdedba84a7d9e7b800fce4b4d88dcd45cbf12 Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Thu, 24 Aug 2023 13:38:06 -0400 Subject: [PATCH 06/12] Fixed check license and imports --- translator/tocwconfig/tocwconfig_test.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 330cdd57f5..7fad00374b 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -15,8 +15,6 @@ import ( "strings" "testing" - "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" - "github.com/BurntSushi/toml" "github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp/cmpopts" @@ -26,6 +24,7 @@ import ( "gopkg.in/yaml.v3" "github.com/aws/amazon-cloudwatch-agent/cfg/commonconfig" + "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "github.com/aws/amazon-cloudwatch-agent/internal/retryer" "github.com/aws/amazon-cloudwatch-agent/translator" "github.com/aws/amazon-cloudwatch-agent/translator/cmdutil" From 8ba68c5ebfe829513f9e315828fbac207385c532 Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Thu, 24 Aug 2023 14:20:06 -0400 Subject: [PATCH 07/12] removed defer function --- translator/tocwconfig/tocwconfig_test.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index 7fad00374b..a198c172b0 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -52,9 +52,6 @@ func TestBaseContainerInsightsConfig(t *testing.T) { t.Setenv(config.HOST_NAME, "host_name_from_env") t.Setenv(config.HOST_IP, "127.0.0.1") t.Setenv(envconfig.AWS_CA_BUNDLE, "/etc/test/ca_bundle.pem") - defer func() { - t.Setenv(envconfig.AWS_CA_BUNDLE, "") - }() expectedEnvVars := map[string]string{ "AWS_CA_BUNDLE": "/etc/test/ca_bundle.pem", } From dac0a3775e5ada279f2509f03b1734afa16384ef Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Mon, 28 Aug 2023 15:17:22 -0400 Subject: [PATCH 08/12] make format --- translator/translate/otel/exporter/awsemf/translator.go | 1 - 1 file changed, 1 deletion(-) diff --git a/translator/translate/otel/exporter/awsemf/translator.go b/translator/translate/otel/exporter/awsemf/translator.go index f216dc59f8..8d4c92fb76 100644 --- a/translator/translate/otel/exporter/awsemf/translator.go +++ b/translator/translate/otel/exporter/awsemf/translator.go @@ -14,7 +14,6 @@ import ( "go.opentelemetry.io/collector/exporter" "gopkg.in/yaml.v3" - "github.com/aws/amazon-cloudwatch-agent/cfg/envconfig" "github.com/aws/amazon-cloudwatch-agent/internal/retryer" "github.com/aws/amazon-cloudwatch-agent/translator/translate/agent" From 8df9d39db92b9e341800b3b54ab3b8bc90ef8597 Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Wed, 6 Sep 2023 11:06:26 -0400 Subject: [PATCH 09/12] rebasing container-insights branch --- amazon-cloudwatch-agent | 1 + .../otel/exporter/otel_aws_cloudwatch_logs/translator.go | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) create mode 160000 amazon-cloudwatch-agent diff --git a/amazon-cloudwatch-agent b/amazon-cloudwatch-agent new file mode 160000 index 0000000000..1df41c2770 --- /dev/null +++ b/amazon-cloudwatch-agent @@ -0,0 +1 @@ +Subproject commit 1df41c2770449ded3fd3247c379873b3e3a16388 diff --git a/translator/translate/otel/exporter/otel_aws_cloudwatch_logs/translator.go b/translator/translate/otel/exporter/otel_aws_cloudwatch_logs/translator.go index ec4ee1c190..09cf02b61f 100644 --- a/translator/translate/otel/exporter/otel_aws_cloudwatch_logs/translator.go +++ b/translator/translate/otel/exporter/otel_aws_cloudwatch_logs/translator.go @@ -89,7 +89,6 @@ func (t *translator) Translate(c *confmap.Conf) (component.Config, error) { if c.IsSet(endpointOverrideKey) { cfg.AWSSessionSettings.Endpoint, _ = common.GetString(c, endpointOverrideKey) } - cfg.AWSSessionSettings.CertificateFilePath = os.Getenv(envconfig.AWS_CA_BUNDLE) cfg.AWSSessionSettings.IMDSRetries = retryer.GetDefaultRetryNumber() return cfg, nil From 7f21765f4c9e52244641a9dff2f02851a24105dc Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Mon, 2 Oct 2023 17:40:44 -0400 Subject: [PATCH 10/12] removed the merge conflict --- .../tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml index d548e887a0..68d96ca404 100644 --- a/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml +++ b/translator/tocwconfig/sampleConfig/emf_and_kubernetes_config.yaml @@ -36,7 +36,6 @@ exporters: eks_fargate_container_insights_enabled: false certificate_file_path: "" endpoint: "https://fake_endpoint" - "imds_retries": 2 enhanced_container_insights: true imds_retries: 2 local_mode: false From d00375cf107298a2771cdb49e939778b1026c88e Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Mon, 2 Oct 2023 17:55:58 -0400 Subject: [PATCH 11/12] removed the merge conflict --- .../tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml index 2a0426c27c..09f4346536 100644 --- a/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml +++ b/translator/tocwconfig/sampleConfig/kubernetes_on_prem_config.yaml @@ -7,7 +7,6 @@ exporters: disable_metric_extraction: true eks_fargate_container_insights_enabled: false endpoint: "https://fake_endpoint" - "imds_retries": 1 enhanced_container_insights: true imds_retries: 1 local_mode: false From 60f1f3a1664d189311cfdc7edb872adc9482be26 Mon Sep 17 00:00:00 2001 From: Bhanu Bandi Date: Tue, 3 Oct 2023 10:23:57 -0400 Subject: [PATCH 12/12] removed the merge conflict --- amazon-cloudwatch-agent | 1 - 1 file changed, 1 deletion(-) delete mode 160000 amazon-cloudwatch-agent diff --git a/amazon-cloudwatch-agent b/amazon-cloudwatch-agent deleted file mode 160000 index 1df41c2770..0000000000 --- a/amazon-cloudwatch-agent +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1df41c2770449ded3fd3247c379873b3e3a16388