diff --git a/go.mod b/go.mod index 301ec33124..39ba997845 100644 --- a/go.mod +++ b/go.mod @@ -7,40 +7,40 @@ replace github.com/influxdata/telegraf => github.com/aws/telegraf v0.10.2-0.2024 // Replace with https://github.com/amazon-contributing/opentelemetry-collector-contrib, there are no requirements for all receivers/processors/exporters // to be all replaced since there are some changes that will always be from upstream replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241024160840-0c7076070f12 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241104203805-20919412150d github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsemfexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20241024185216-f0b80d5c67a5 - github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241024160840-0c7076070f12 + github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awsxrayexporter => github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241104203805-20919412150d ) -replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy => github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20241024160840-0c7076070f12 +replace github.com/open-telemetry/opentelemetry-collector-contrib/extension/awsproxy => github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20241104203805-20919412150d replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20241024160840-0c7076070f12 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/proxy => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20241104203805-20919412150d ) replace ( // For clear resource attributes after copy functionality https://github.com/amazon-contributing/opentelemetry-collector-contrib/pull/148 - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20241024160840-0c7076070f12 + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20241104203805-20919412150d // Replace with contrib to revert upstream change https://github.com/open-telemetry/opentelemetry-collector-contrib/pull/20519 - github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20241024160840-0c7076070f12 + github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus => github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20241104203805-20919412150d ) -replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor => github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241024160840-0c7076070f12 +replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor => github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241104203805-20919412150d replace ( - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20241024160840-0c7076070f12 - github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20241024160840-0c7076070f12 + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20241104203805-20919412150d + github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20241104203805-20919412150d ) // Temporary fix, pending PR https://github.com/shirou/gopsutil/pull/957 @@ -91,7 +91,7 @@ replace github.com/aws/aws-sdk-go => github.com/aws/aws-sdk-go v1.48.6 require ( github.com/BurntSushi/toml v1.3.2 github.com/Jeffail/gabs v1.4.0 - github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241024160840-0c7076070f12 + github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241104203805-20919412150d github.com/aws/aws-sdk-go v1.53.11 github.com/aws/aws-sdk-go-v2/service/cloudwatch v1.30.2 github.com/bigkevmcd/go-configparser v0.0.0-20200217161103-d137835d2579 @@ -164,6 +164,7 @@ require ( github.com/xeipuuv/gojsonschema v1.2.0 go.opentelemetry.io/collector/component v0.103.0 go.opentelemetry.io/collector/config/configauth v0.103.0 + go.opentelemetry.io/collector/config/confighttp v0.103.0 go.opentelemetry.io/collector/config/configopaque v1.10.0 go.opentelemetry.io/collector/config/configtelemetry v0.103.0 go.opentelemetry.io/collector/config/configtls v0.103.0 @@ -229,7 +230,7 @@ require ( github.com/alecthomas/participle v0.4.1 // indirect github.com/alecthomas/participle/v2 v2.1.1 // indirect github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 // indirect - github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20241024160840-0c7076070f12 // indirect + github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20241104203805-20919412150d // indirect github.com/antchfx/jsonquery v1.1.5 // indirect github.com/antchfx/xmlquery v1.3.9 // indirect github.com/antchfx/xpath v1.2.0 // indirect @@ -267,7 +268,7 @@ require ( github.com/containerd/cgroups/v3 v3.0.3 // indirect github.com/containerd/console v1.0.3 // indirect github.com/containerd/errdefs v0.1.0 // indirect - github.com/containerd/ttrpc v1.2.2 // indirect + github.com/containerd/ttrpc v1.2.4 // indirect github.com/coreos/go-semver v0.3.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cyphar/filepath-securejoin v0.2.4 // indirect @@ -275,7 +276,7 @@ require ( github.com/dennwc/varint v1.0.0 // indirect github.com/digitalocean/godo v1.109.0 // indirect github.com/distribution/reference v0.6.0 // indirect - github.com/docker/docker v25.0.6+incompatible // indirect + github.com/docker/docker v26.1.4+incompatible // indirect github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/doclambda/protobufquery v0.0.0-20210317203640-88ffabe06a60 // indirect @@ -313,7 +314,7 @@ require ( github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.4 // indirect - github.com/google/cadvisor v0.49.0 // indirect + github.com/google/cadvisor v0.49.1-0.20240628164550-89f779d86055 // indirect github.com/google/gnostic-models v0.6.8 // indirect github.com/google/go-querystring v1.1.0 // indirect github.com/google/gofuzz v1.2.0 // indirect @@ -377,9 +378,9 @@ require ( github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect - github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect - github.com/moby/sys/mountinfo v0.6.2 // indirect + github.com/moby/docker-image-spec v1.3.1 // indirect + github.com/moby/sys/mountinfo v0.7.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.3 // indirect @@ -416,7 +417,7 @@ require ( github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0 // indirect github.com/opencontainers/runc v1.1.14 // indirect - github.com/opencontainers/runtime-spec v1.1.0 // indirect + github.com/opencontainers/runtime-spec v1.2.0 // indirect github.com/opencontainers/selinux v1.11.0 // indirect github.com/openshift/api v3.9.0+incompatible // indirect github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect @@ -473,7 +474,6 @@ require ( go.opentelemetry.io/collector v0.103.0 // indirect go.opentelemetry.io/collector/config/configcompression v1.10.0 // indirect go.opentelemetry.io/collector/config/configgrpc v0.103.0 // indirect - go.opentelemetry.io/collector/config/confighttp v0.103.0 // indirect go.opentelemetry.io/collector/config/confignet v0.103.0 // indirect go.opentelemetry.io/collector/config/configretry v0.103.0 // indirect go.opentelemetry.io/collector/config/internal v0.103.0 // indirect diff --git a/go.sum b/go.sum index bab30f7f73..a13e40e7fc 100644 --- a/go.sum +++ b/go.sum @@ -180,52 +180,52 @@ github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9 h1:ez/4by2iGztzR4 github.com/alecthomas/units v0.0.0-20231202071711-9a357b53e9c9/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483 h1:J8HaD+Zpfi1gcel3HCKpoHHEsrcuRrZlSnx7R9SCf5I= github.com/aliyun/alibaba-cloud-sdk-go v1.61.1483/go.mod h1:RcDobYh8k5VP6TNybz9m++gL3ijVI5wueVr0EM10VsU= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241024160840-0c7076070f12 h1:+USPP+QlDqsDjsMG1RO2lc1UURGCXwejqC1Z/HAkVQ4= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241024160840-0c7076070f12/go.mod h1:f9JwM/LQdKH8ZbYoH9TO35rmjM6WoTNlhWtYJ3YZucc= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241104203805-20919412150d h1:1nlENK4aucOEP+jSMFTgMfJaL8Rl/h6q2LXKiS8kFkM= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awscloudwatchlogsexporter v0.0.0-20241104203805-20919412150d/go.mod h1:f9JwM/LQdKH8ZbYoH9TO35rmjM6WoTNlhWtYJ3YZucc= github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20241024185216-f0b80d5c67a5 h1:JOp9f4a1pP1zb5U+JPTezTdTZ1LCkcJSTcCd/AAqknM= github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsemfexporter v0.0.0-20241024185216-f0b80d5c67a5/go.mod h1:LPWBVdTSNbZkk80v6aCUthS59cnR4VauVRdAIE3ifaY= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241024160840-0c7076070f12 h1:9E5WNd4oR52CDE74trrIA6/hlG+FRUoo3NdtdKsnprw= -github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241024160840-0c7076070f12/go.mod h1:GNeNylfr5KMt55XowzSdgbP7z8CkIAfIHtWSd+xxtws= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241024160840-0c7076070f12 h1:4T8EO8AhjBwFK3hcocbAqOZEK5YU/6hmDYsVLlDTBEo= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241024160840-0c7076070f12/go.mod h1:/RaNSxxO06niapGT00snMdgFfjjjW/kV3TZGX8kHuwM= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20241024160840-0c7076070f12 h1:DOu5IxGFsk6GuWyeijlYDEifHL62dQAEPHol/tasFrE= -github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20241024160840-0c7076070f12/go.mod h1:hRZt1DsvoLDIYBwjFvjwg/9IkaBXeCPG0QI57wbj98Q= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20241024160840-0c7076070f12 h1:5UfduJNrjayxXhOLhHGmLUTf47TnBeJpe6nv7DRW6ZY= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20241024160840-0c7076070f12/go.mod h1:YL1Y62PxJ7dem1ZBUqCfvbnePaGr5p7DTSyOXSCi6O4= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20241024160840-0c7076070f12 h1:UvHsL0P1OAf2quIOFVk8A9NyGRuypN03b6+0Cu1Kb0M= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20241024160840-0c7076070f12/go.mod h1:LT+qAyMutoADv2qezO+vkm/BkxR88qEfXdF2d13mV+E= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20241024160840-0c7076070f12 h1:rnqocKDo3A82NkHIivOhLekhZXmLQP0S/M6kE7RAMjs= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20241024160840-0c7076070f12/go.mod h1:SkscNdWANcuDJ7PkjS5wurSTAuY69nqP0I+cEVY9Ryw= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20241024160840-0c7076070f12 h1:fd/eSG33sDKHduSwWHsLgbnkA89eXnAH49PI3/HNH1o= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20241024160840-0c7076070f12/go.mod h1:/TOECDME2jYRPY21CrpTX2eMADJdkmBFBXc1lV/nRZA= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20241024160840-0c7076070f12 h1:Tq6ET7zbGOlzID7XO1Ox3SN+xBpwyXA7lJ+9E7j2+nM= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20241024160840-0c7076070f12/go.mod h1:J08A2gx8VFQfuoBiEfZ6uHIkMtVLd0OuRe5pP88b3I0= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20241024160840-0c7076070f12 h1:4n0Tg7jjGspPA76ZlI+cITJaDrDp9V79SgaZ2leLYNQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20241024160840-0c7076070f12/go.mod h1:+w647+1nLYvZWdk24gZWvdl/kFowbe2iDyISXLDYdmQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal v0.0.0-20241024160840-0c7076070f12 h1:bNkLVrj3s8+P1/Xgth/4E4ffGci8jO29v/N5i3OnzvY= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal v0.0.0-20241024160840-0c7076070f12/go.mod h1:WkLIVRD7DNz7zNXQ6CyTajsJFhsV52hgNovjr6fVm1g= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20241024160840-0c7076070f12 h1:7Ri8ritBlBB1hTnFoPE1Upuwqy/uQd8fHeiOUaBWZZw= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20241024160840-0c7076070f12/go.mod h1:VS66oUydCMwiWl1BFmLs7iNy4lGsfVYsriXr/d1fpAk= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20241024160840-0c7076070f12 h1:PHz4IjbJHsNEXO7266BPMs5nzYqhFQ5e0CNTcizqmPA= -github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20241024160840-0c7076070f12/go.mod h1:4qvmHiXPOkOXJdpmmxMqprb2BXxOGPgOG45BwLdipUM= -github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20241024160840-0c7076070f12 h1:bzbj2sMwlS7m2pf3pBL4ReBF5e/My8CXo8Uk03yUWBY= -github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20241024160840-0c7076070f12/go.mod h1:t/hYoRTnlPuRjh8y0BwVGgNvNIXpU2QJME5YVppUUHQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.0.0-20241024160840-0c7076070f12 h1:sIPPJ1tzrLbNQocY/X0scGuZEtbhbuxi6Tmhcw/6zgg= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.0.0-20241024160840-0c7076070f12/go.mod h1:Rr5b3hr6Jy9w/zTjsOl3vcyDDusc90P+iGdOd0UCYOo= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20241024160840-0c7076070f12 h1:rmZ7B/y85fARC0BUXh/ZY/2usWtnpUKPrWwzGZi6EtQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20241024160840-0c7076070f12/go.mod h1:2NSghK+mafMGxM8c4Gff8qcprdMD3YQebZtD9UAdB3E= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20241024160840-0c7076070f12 h1:ShcpTZVJvFUt3PnNjkcrq065L6sy8IQaElnM6PHJpzU= -github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20241024160840-0c7076070f12/go.mod h1:21nuEQl7YYeLkVrGGvxPXkljqjR40teBCG5trGZ5LxM= -github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241024160840-0c7076070f12 h1:gBq9hHmpfUjJIi4mpHrwoRrcpnH5czcBP//FWvf43RU= -github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241024160840-0c7076070f12/go.mod h1:TgRVPbdaFu8pWg4H5yCqVznsRVe8wQJRfEeUpduTKT8= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20241024160840-0c7076070f12 h1:BaDnRWWeZrdpRLXAo3DRRLcWoyKuC1U3uAnj8gs8PWE= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20241024160840-0c7076070f12/go.mod h1:tvoacZuBVf9lftcH2O6rKjumRCFAy+ycjKk3QJFaFXQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20241024160840-0c7076070f12 h1:Qx7pmI91E9i48x7EliCSH3q0ExL/hVzFBuoOEGR8R+Q= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20241024160840-0c7076070f12/go.mod h1:igQaQJt7eA/y3dZ2VLXVql+6k/ZXBgrAa2y9FrMMIKQ= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20241024160840-0c7076070f12 h1:KNu8pcXJ5KlOA93JRXo7xenIo7/ACNpfa4RuulOvwRc= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20241024160840-0c7076070f12/go.mod h1:NfNPpD1AYb1Z8C/0iNtViQUmI8Nzxnr3Q4RY9EreG5c= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20241024160840-0c7076070f12 h1:RMWINfQxfIPPSi3pdMMHcOGppCKD4uFygMc93znXiVo= -github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20241024160840-0c7076070f12/go.mod h1:FMPwht01yV4UvBAWkPFO/5jAkGFtfsmz1TRaoYgWeqU= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241104203805-20919412150d h1:OaeHJsqrLqlgsIG24uYZvDkZ41nFr9LRhKPtX8f4O+Q= +github.com/amazon-contributing/opentelemetry-collector-contrib/exporter/awsxrayexporter v0.0.0-20241104203805-20919412150d/go.mod h1:GNeNylfr5KMt55XowzSdgbP7z8CkIAfIHtWSd+xxtws= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241104203805-20919412150d h1:eXEVMyh0ESwB4HGuPmDH4DDTlEq8kSJ4o+Hr0tdy+RI= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsmiddleware v0.0.0-20241104203805-20919412150d/go.mod h1:/RaNSxxO06niapGT00snMdgFfjjjW/kV3TZGX8kHuwM= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20241104203805-20919412150d h1:f13PqXJBa78lokYPhoL1b96csNXfroC8nlK7R7zpN7U= +github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20241104203805-20919412150d/go.mod h1:hRZt1DsvoLDIYBwjFvjwg/9IkaBXeCPG0QI57wbj98Q= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20241104203805-20919412150d h1:Oz6LLJwcpPD5IYHBzsb0mWZUt0OOgUpDth35qCAF+1Q= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20241104203805-20919412150d/go.mod h1:YL1Y62PxJ7dem1ZBUqCfvbnePaGr5p7DTSyOXSCi6O4= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20241104203805-20919412150d h1:SDkwRzHzXO7HfmhCCvamdQmPH2fKK7PYMXZKhbrpHCk= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20241104203805-20919412150d/go.mod h1:LT+qAyMutoADv2qezO+vkm/BkxR88qEfXdF2d13mV+E= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20241104203805-20919412150d h1:1iitRjrfd7JjmfJbe1iM7XENgzjJ6L2THTKtv6V/qmU= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20241104203805-20919412150d/go.mod h1:SkscNdWANcuDJ7PkjS5wurSTAuY69nqP0I+cEVY9Ryw= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20241104203805-20919412150d h1:JEGyD9HBLCRaw7wWq1H+1oarZ0Aui3a/27V1t0kcnXg= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20241104203805-20919412150d/go.mod h1:/TOECDME2jYRPY21CrpTX2eMADJdkmBFBXc1lV/nRZA= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20241104203805-20919412150d h1:/ogt2A7O9rOZRCgb0kK4ps0T1b9gCnIiF6XfgaOLuVo= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/proxy v0.0.0-20241104203805-20919412150d/go.mod h1:J08A2gx8VFQfuoBiEfZ6uHIkMtVLd0OuRe5pP88b3I0= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20241104203805-20919412150d h1:kSwmEzswg2jdB/WpHhj54u4XL2gLRlwC3dBxO4u9WPY= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/xray v0.0.0-20241104203805-20919412150d/go.mod h1:+w647+1nLYvZWdk24gZWvdl/kFowbe2iDyISXLDYdmQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal v0.0.0-20241104203805-20919412150d h1:1thAqvybJZ8Uvelq1rwUKbvdHG3+tmHXYru2j3PkGaQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/coreinternal v0.0.0-20241104203805-20919412150d/go.mod h1:Ai4BsM7C05bEQYO2O272S1LmsyIhO5r0iLmXF5NN5so= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20241104203805-20919412150d h1:Gdw6doVzDuXBheQS2pdA2b8nEEyUCBIadcHRwPceDB4= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/k8sconfig v0.0.0-20241104203805-20919412150d/go.mod h1:VS66oUydCMwiWl1BFmLs7iNy4lGsfVYsriXr/d1fpAk= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20241104203805-20919412150d h1:IeExpZfRsSLKsRW7ee7IriYHW2k+to26bQ7NxTvYygw= +github.com/amazon-contributing/opentelemetry-collector-contrib/internal/kubelet v0.0.0-20241104203805-20919412150d/go.mod h1:4qvmHiXPOkOXJdpmmxMqprb2BXxOGPgOG45BwLdipUM= +github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20241104203805-20919412150d h1:JM0ZVUKL4vNXQcGOpB3PALHrpe9Uq7YrD3zyOdDXleQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/override/aws v0.0.0-20241104203805-20919412150d/go.mod h1:t/hYoRTnlPuRjh8y0BwVGgNvNIXpU2QJME5YVppUUHQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.0.0-20241104203805-20919412150d h1:IyQzj0JRHEU00FfiwE/mMX6CepK4I8Dhz3XYYetRaaM= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.0.0-20241104203805-20919412150d/go.mod h1:Rr5b3hr6Jy9w/zTjsOl3vcyDDusc90P+iGdOd0UCYOo= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20241104203805-20919412150d h1:l+U6eNiVjhUjsCXD9fFtTssXjRgO2oboalpcCtz2FdM= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/stanza v0.0.0-20241104203805-20919412150d/go.mod h1:2NSghK+mafMGxM8c4Gff8qcprdMD3YQebZtD9UAdB3E= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20241104203805-20919412150d h1:5310F/G6U5YcjKots1ovIJzf+4+NMJ/2UAHfVN2JAVE= +github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20241104203805-20919412150d/go.mod h1:21nuEQl7YYeLkVrGGvxPXkljqjR40teBCG5trGZ5LxM= +github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241104203805-20919412150d h1:2LmndCpP8KMMn7l9zyI5zeiu6OD18vIBMcrGuFRHdfs= +github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20241104203805-20919412150d/go.mod h1:uzpU7Y6+oL6RdOv8IWi6fjT8LNV6FYX6CN6NATLJOiQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20241104203805-20919412150d h1:LvHBMj+2Kh+SAESWTVoLbJ8bD4Xq3toB4SU66hYjg0M= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20241104203805-20919412150d/go.mod h1:StgsMi0cNUydO2N/7WbLYPUBXzvp9wIMcWp9P8x/Vck= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20241104203805-20919412150d h1:eQsOVRzXk32sVDkwJALfN0A4kZEMC2NNG8jBjZAZ7UM= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20241104203805-20919412150d/go.mod h1:igQaQJt7eA/y3dZ2VLXVql+6k/ZXBgrAa2y9FrMMIKQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20241104203805-20919412150d h1:Cld9lc7zzU/EV70Lv8EXylsx4ATjz9jHfsObEYfjyzQ= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20241104203805-20919412150d/go.mod h1:hRUrYatVP/GFNxHn2yW1gJcnPyGtdlTXyebpzzzjZeU= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20241104203805-20919412150d h1:awQLc9eG7SbW5vZCt1lxyRc+ZwTpjXwsH/AhtPF51uE= +github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20241104203805-20919412150d/go.mod h1:TTwtk1IMiqmyGm66w9aIq/TInicOm2Y6DwcJzRIpv1U= github.com/amir/raidman v0.0.0-20170415203553-1ccc43bfb9c9 h1:FXrPTd8Rdlc94dKccl7KPmdmIbVh/OjelJ8/vgMRzcQ= github.com/amir/raidman v0.0.0-20170415203553-1ccc43bfb9c9/go.mod h1:eliMa/PW+RDr2QLWRmLH1R1ZA4RInpmvOzDDXtaIZkc= github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= @@ -400,8 +400,8 @@ github.com/containerd/errdefs v0.1.0 h1:m0wCRBiu1WJT/Fr+iOoQHMQS/eP5myQ8lCv4Dz5Z github.com/containerd/errdefs v0.1.0/go.mod h1:YgWiiHtLmSeBrvpw+UfPijzbLaB77mEG1WwJTDETIV0= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= -github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs= -github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= +github.com/containerd/ttrpc v1.2.4 h1:eQCQK4h9dxDmpOb9QOOMh2NHTfzroH1IkmHiKZi05Oo= +github.com/containerd/ttrpc v1.2.4/go.mod h1:ojvb8SJBSch0XkqNO0L0YX/5NxR3UnVk2LzFKBK0upc= github.com/containerd/typeurl v1.0.2 h1:Chlt8zIieDbzQFzXzAeBEF92KhExuE4p9p92/QmY7aY= github.com/containerd/typeurl v1.0.2/go.mod h1:9trJWW2sRlGub4wZJRTW83VtbOLS6hwcDZXTn6oPz9s= github.com/coreos/go-semver v0.3.0 h1:wkHLiw0WNATZnSG7epLsujiMCgPAc9xhjJ4tgnAxmfM= @@ -445,8 +445,8 @@ github.com/djherbis/times v1.5.0 h1:79myA211VwPhFTqUk8xehWrsEO+zcIZj0zT8mXPVARU= github.com/djherbis/times v1.5.0/go.mod h1:5q7FDLvbNg1L/KaBmPcWlVR9NmoKo3+ucqUA3ijQhA0= github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/docker v25.0.6+incompatible h1:5cPwbwriIcsua2REJe8HqQV+6WlWc1byg2QSXzBxBGg= -github.com/docker/docker v25.0.6+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v26.1.4+incompatible h1:vuTpXDuoga+Z38m1OZHzl7NKisKWaWlhjQk7IDPSLsU= +github.com/docker/docker v26.1.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= @@ -669,8 +669,8 @@ github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Z github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.1 h1:gK4Kx5IaGY9CD5sPJ36FHiBJ6ZXl0kilRiiCj+jdYp4= github.com/google/btree v1.0.1/go.mod h1:xXMiIv4Fb/0kKde4SpL7qlzvu5cMJDRkFDxJfI9uaxA= -github.com/google/cadvisor v0.49.0 h1:1PYeiORXmcFYi609M4Qvq5IzcvcVaWgYxDt78uH8jYA= -github.com/google/cadvisor v0.49.0/go.mod h1:s6Fqwb2KiWG6leCegVhw4KW40tf9f7m+SF1aXiE8Wsk= +github.com/google/cadvisor v0.49.1-0.20240628164550-89f779d86055 h1:LH//TOiNPpCn3a48Flz5sNUmuMW5V/sTKheuXAPowUA= +github.com/google/cadvisor v0.49.1-0.20240628164550-89f779d86055/go.mod h1:koGHrZgL6RdZ29g/iXWT4kUIawssUi88XCYDlyPt5RI= github.com/google/flatbuffers v23.5.26+incompatible h1:M9dgRyhJemaM4Sw8+66GHBu8ioaQmyPLg1b8VwK5WJg= github.com/google/flatbuffers v23.5.26+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/gnostic-models v0.6.8 h1:yo/ABAfM5IMRsS1VnXjTBvUb61tFIHozhlYvRgGre9I= @@ -1059,8 +1059,6 @@ github.com/mitchellh/go-testing-interface v1.0.0/go.mod h1:kRemZodwjscx+RGhAo8eI github.com/mitchellh/go-testing-interface v1.14.1 h1:jrgshOhYAUVNMAJiKbEu7EqAwgJJ2JqpQmpLJOu07cU= github.com/mitchellh/go-testing-interface v1.14.1/go.mod h1:gfgS7OtZj6MA4U1UrDRp04twqAjfvlZyCfX3sDjEym8= github.com/mitchellh/go-wordwrap v1.0.0/go.mod h1:ZXFpozHsX6DPmq2I0TCekCxypsnAUbP2oI0UX1GXzOo= -github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4= -github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.4.2/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= @@ -1070,13 +1068,15 @@ github.com/mitchellh/mapstructure v1.5.1-0.20231216201459-8508981c8b6c/go.mod h1 github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= +github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/moby/ipvs v1.0.1 h1:aoZ7fhLTXgDbzVrAnvV+XbKOU8kOET7B3+xULDF/1o0= github.com/moby/ipvs v1.0.1/go.mod h1:2pngiyseZbIKXNv7hsKj3O9UEz30c53MT9005gt2hxQ= github.com/moby/patternmatcher v0.6.0 h1:GmP9lR19aU5GqSSFko+5pRqHi+Ohk1O69aFiKkVGiPk= github.com/moby/patternmatcher v0.6.0/go.mod h1:hDPoyOpDY7OrrMDLaYoY3hf52gNCR/YOUYxkhApJIxc= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/sys/mountinfo v0.6.2 h1:BzJjoreD5BMFNmD9Rus6gdd1pLuecOFPt8wC+Vygl78= -github.com/moby/sys/mountinfo v0.6.2/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= +github.com/moby/sys/mountinfo v0.7.1 h1:/tTvQaSJRr2FshkhXiIpux6fQ2Zvc4j7tAhMTStAG2g= +github.com/moby/sys/mountinfo v0.7.1/go.mod h1:IJb6JQeOklcdMU9F5xQ8ZALD+CUr5VlGpwtX+VE0rpI= github.com/moby/sys/sequential v0.5.0 h1:OPvI35Lzn9K04PBbCLW0g4LcFAJgHsvXsRyewg5lXtc= github.com/moby/sys/sequential v0.5.0/go.mod h1:tH2cOOs5V9MlPiXcQzRC+eEyab644PWKGRYaaV5ZZlo= github.com/moby/sys/user v0.3.0 h1:9ni5DlcW5an3SvRSx4MouotOygvzaXbaSrc/wGDFWPo= @@ -1261,8 +1261,8 @@ github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQ github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2szdn85PY75RI83NrTrM= github.com/opencontainers/runc v1.1.14 h1:rgSuzbmgz5DUJjeSnw337TxDbRuqjs6iqQck/2weR6w= github.com/opencontainers/runc v1.1.14/go.mod h1:E4C2z+7BxR7GHXp0hAY53mek+x49X1LjPNeMTfRGvOA= -github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= -github.com/opencontainers/runtime-spec v1.1.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= +github.com/opencontainers/runtime-spec v1.2.0 h1:z97+pHb3uELt/yiAWD691HNHQIF07bE7dzrbT927iTk= +github.com/opencontainers/runtime-spec v1.2.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/selinux v1.11.0 h1:+5Zbo97w3Lbmb3PeqQtpmTkMwsW5nRI3YaLpt7tQ7oU= github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec= github.com/openshift/api v0.0.0-20180801171038-322a19404e37 h1:05irGU4HK4IauGGDbsk+ZHrm1wOzMLYjMlfaiqMrBYc= diff --git a/translator/config/sampleSchema/validPrometheusMetrics.json b/translator/config/sampleSchema/validPrometheusMetrics.json new file mode 100644 index 0000000000..3206e73406 --- /dev/null +++ b/translator/config/sampleSchema/validPrometheusMetrics.json @@ -0,0 +1,14 @@ +{ + "metrics": { + "metrics_collected": { + "prometheus": { + "prometheus_config_path": "/test/prom.yaml" + } + }, + "metrics_destinations": { + "amp": { + "workspace_id": "ws-1234" + } + } + } +} \ No newline at end of file diff --git a/translator/config/schema.json b/translator/config/schema.json index 17488bf591..74438f5a71 100644 --- a/translator/config/schema.json +++ b/translator/config/schema.json @@ -164,6 +164,9 @@ }, "otlp": { "$ref": "#/definitions/otlpDefinitions" + }, + "prometheus": { + "$ref": "#/definitions/metricsDefinition/definitions/prometheusDefinitions" } }, "minProperties": 1, @@ -598,6 +601,20 @@ ] }, "uniqueItems": true + }, + "prometheusDefinitions": { + "type": "object", + "properties": { + "prometheus_config_path": { + "type": "string", + "minLength": 1, + "maxLength": 255 + } + }, + "required": [ + "prometheus_config_path" + ], + "additionalProperties": false } } }, diff --git a/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.conf b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.conf new file mode 100644 index 0000000000..ecefec0e08 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.conf @@ -0,0 +1,65 @@ +[agent] + collection_jitter = "0s" + debug = false + flush_interval = "1s" + flush_jitter = "0s" + hostname = "" + interval = "60s" + logfile = "/opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log" + logtarget = "lumberjack" + metric_batch_size = 1000 + metric_buffer_limit = 10000 + omit_hostname = false + precision = "" + quiet = false + round_interval = false + +[inputs] + + [[inputs.prometheus]] + cluster_name = "TestCluster" + prometheus_config_path = "{prometheusFileName}" + [inputs.prometheus.ecs_service_discovery] + sd_cluster_region = "us-west-2" + sd_frequency = "1m" + sd_result_file = "{ecsSdFileName}" + sd_target_cluster = "ecs-cluster-a" + [inputs.prometheus.ecs_service_discovery.docker_label] + sd_job_name_label = "ECS_PROMETHEUS_JOB_NAME_1" + sd_metrics_path_label = "ECS_PROMETHEUS_METRICS_PATH" + sd_port_label = "ECS_PROMETHEUS_EXPORTER_PORT_SUBSET" + + [[inputs.prometheus.ecs_service_discovery.service_name_list_for_tasks]] + sd_container_name_pattern = "nginx-prometheus-exporter" + sd_job_name = "service_name_1" + sd_metrics_path = "/metrics" + sd_metrics_ports = "9113" + sd_service_name_pattern = ".*-application-stack" + + [[inputs.prometheus.ecs_service_discovery.service_name_list_for_tasks]] + sd_metrics_path = "/stats/metrics" + sd_metrics_ports = "9114" + sd_service_name_pattern = "run-application-stack" + + [[inputs.prometheus.ecs_service_discovery.task_definition_list]] + sd_job_name = "task_def_1" + sd_metrics_path = "/stats/metrics" + sd_metrics_ports = "9901" + sd_task_definition_arn_pattern = ".*task_def_1:[0-9]+" + + [[inputs.prometheus.ecs_service_discovery.task_definition_list]] + sd_container_name_pattern = "^envoy$" + sd_metrics_ports = "9902" + sd_task_definition_arn_pattern = "task_def_2" + +[outputs] + + [[outputs.cloudwatch]] + + [[outputs.cloudwatchlogs]] + endpoint_override = "https://fake_endpoint" + force_flush_interval = "30s" + log_stream_name = "i-UNKNOWN" + mode = "EC2" + region = "us-west-2" + region_type = "ACJ" diff --git a/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.json b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.json new file mode 100644 index 0000000000..5ecbcff5bb --- /dev/null +++ b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.json @@ -0,0 +1,102 @@ +{ + "agent": { + "region": "us-west-2" + }, + "metrics": { + "metrics_destinations": { + "cloudwatch": {}, + "amp": { + "workspace_id": "ws-12345" + } + }, + "metrics_collected": { + "prometheus": { + "prometheus_config_path": "{prometheusFileName}" + } + } + }, + "logs": { + "metrics_collected": { + "prometheus": { + "cluster_name": "TestCluster", + "log_group_name": "/aws/ecs/containerinsights/TestCluster/prometheus", + "prometheus_config_path": "{prometheusFileName}", + "ecs_service_discovery": { + "docker_label": { + "sd_job_name_label": "ECS_PROMETHEUS_JOB_NAME_1", + "sd_metrics_path_label": "ECS_PROMETHEUS_METRICS_PATH", + "sd_port_label": "ECS_PROMETHEUS_EXPORTER_PORT_SUBSET" + }, + "task_definition_list": [ + { + "sd_job_name": "task_def_1", + "sd_metrics_path": "/stats/metrics", + "sd_metrics_ports": "9901", + "sd_task_definition_arn_pattern": ".*task_def_1:[0-9]+" + }, + { + "sd_container_name_pattern": "^envoy$", + "sd_metrics_ports": "9902", + "sd_task_definition_arn_pattern": "task_def_2" + } + ], + "service_name_list_for_tasks": [ + { + "sd_job_name": "service_name_1", + "sd_metrics_path": "/metrics", + "sd_metrics_ports": "9113", + "sd_service_name_pattern": ".*-application-stack", + "sd_container_name_pattern": "nginx-prometheus-exporter" + }, + { + "sd_metrics_path":"/stats/metrics", + "sd_metrics_ports": "9114", + "sd_service_name_pattern": "run-application-stack" + } + ], + "sd_cluster_region": "us-west-2", + "sd_frequency": "1m", + "sd_result_file": "{ecsSdFileName}", + "sd_target_cluster": "ecs-cluster-a" + }, + "emf_processor": { + "metric_declaration_dedup": true, + "metric_namespace": "CustomizedNamespace", + "metric_unit": { + "nginx_request_count": "Count" + }, + "metric_declaration": [ + { + "dimensions": [["Service"]], + "label_matcher": "nginx.*", + "label_separator": ";", + "metric_selectors": ["^nginx_request_count$"], + "source_labels": ["Service"] + }, + { + "label_matcher": "default", + "metric_selectors": [".*"], + "source_labels": ["Namespace"] + }, + { + "source_labels":["name"], + "dimensions":[ + ["name"] + ], + "metric_selectors": ["^.*$"] + }, + { + "source_labels":["name"], + "dimensions":[ + ["name"] + ], + "metric_selectors": ["^node_cpu_guest_seconds_total$"] + } + ] + } + } + }, + "force_flush_interval": 30, + "endpoint_override":"https://fake_endpoint" + } +} diff --git a/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml new file mode 100644 index 0000000000..d76d284a56 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/prometheus_combined_config_linux.yaml @@ -0,0 +1,219 @@ +exporters: + awsemf/prometheus: + certificate_file_path: "" + detailed_metrics: false + dimension_rollup_option: NoDimensionRollup + disable_metric_extraction: false + eks_fargate_container_insights_enabled: false + endpoint: https://fake_endpoint + enhanced_container_insights: false + imds_retries: 1 + local_mode: false + log_group_name: /aws/ecs/containerinsights/TestCluster/prometheus + log_retention: 0 + log_stream_name: '{JobName}' + max_retries: 2 + metric_declarations: + - dimensions: + - - Service + label_matchers: + - label_names: + - Service + regex: nginx.* + separator: ; + metric_name_selectors: + - ^nginx_request_count$ + - dimensions: [] + label_matchers: + - label_names: + - Namespace + regex: default + separator: ; + metric_name_selectors: + - .* + - dimensions: + - - name + label_matchers: + - label_names: + - name + regex: .* + separator: ; + metric_name_selectors: + - ^.*$ + - dimensions: + - - name + label_matchers: + - label_names: + - name + regex: .* + separator: ; + metric_name_selectors: + - ^node_cpu_guest_seconds_total$ + metric_descriptors: + - metric_name: nginx_request_count + overwrite: false + unit: Count + middleware: agenthealth/logs + namespace: CustomizedNamespace + no_verify_ssl: false + num_workers: 8 + output_destination: cloudwatch + profile: "" + proxy_address: "" + region: us-west-2 + request_timeout_seconds: 30 + resource_arn: "" + resource_to_telemetry_conversion: + enabled: true + retain_initial_value_of_delta_metric: false + role_arn: "" + version: "0" + prometheusremotewrite/amp: + add_metric_suffixes: true + auth: + authenticator: sigv4auth + compression: "" + disable_keep_alives: false + endpoint: https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-12345/api/v1/remote_write + export_created_metric: + enabled: false + http2_ping_timeout: 0s + http2_read_idle_timeout: 0s + max_batch_size_bytes: 3000000 + namespace: "" + proxy_url: "" + read_buffer_size: 0 + remote_write_queue: + enabled: true + num_consumers: 5 + queue_size: 10000 + resource_to_telemetry_conversion: + clear_after_copy: true + enabled: true + retry_on_failure: + enabled: true + initial_interval: 50ms + max_elapsed_time: 5m0s + max_interval: 30s + multiplier: 1.5 + randomization_factor: 0.5 + send_metadata: false + target_info: + enabled: true + timeout: 5s + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: 0s + server_name_override: "" + write_buffer_size: 524288 +extensions: + agenthealth/logs: + is_usage_data_enabled: true + stats: + operations: + - PutLogEvents + usage_flags: + mode: EC2 + region_type: ACJ + sigv4auth: + assume_role: + sts_region: us-west-2 + region: us-west-2 + entitystore: + mode: ec2 + region: us-west-2 +processors: + batch/prometheus/amp: + metadata_cardinality_limit: 1000 + send_batch_max_size: 0 + send_batch_size: 8192 + timeout: 1m0s + batch/prometheus/cloudwatchlogs: + metadata_cardinality_limit: 1000 + send_batch_max_size: 0 + send_batch_size: 8192 + timeout: 30s +receivers: + prometheus: + config: + global: + evaluation_interval: 1m + scrape_interval: 5m + scrape_protocols: + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_timeout: 5s + scrape_configs: + - enable_compression: true + enable_http2: true + file_sd_configs: + - files: + - {ecsSdFileName} + refresh_interval: 5m + follow_redirects: true + honor_timestamps: true + job_name: cwagent-ecs-file-sd-config + metrics_path: /metrics + sample_limit: 10000 + scheme: http + scrape_interval: 5m + scrape_protocols: + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_timeout: 5s + track_timestamps_staleness: false + report_extra_scrape_metrics: false + start_time_metric_regex: "" + trim_metric_suffixes: false + use_start_time_metric: false + telegraf_prometheus: + collection_interval: 1m0s + initial_delay: 1s + timeout: 0s +service: + extensions: + - agenthealth/logs + - sigv4auth + - entitystore + pipelines: + metrics/prometheus/amp: + exporters: + - prometheusremotewrite/amp + processors: + - batch/prometheus/amp + receivers: + - prometheus + metrics/prometheus/cloudwatchlogs: + exporters: + - awsemf/prometheus + processors: + - batch/prometheus/cloudwatchlogs + receivers: + - telegraf_prometheus + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + output_paths: + - /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: {} diff --git a/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml index ce4ad17041..3c8253f190 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_config_linux.yaml @@ -81,7 +81,7 @@ extensions: mode: ec2 region: us-east-1 processors: - batch/prometheus: + batch/prometheus/cloudwatchlogs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 send_batch_size: 8192 @@ -96,11 +96,11 @@ service: - agenthealth/logs - entitystore pipelines: - metrics/prometheus: + metrics/prometheus/cloudwatchlogs: exporters: - awsemf/prometheus processors: - - batch/prometheus + - batch/prometheus/cloudwatchlogs receivers: - telegraf_prometheus telemetry: diff --git a/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml b/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml index 2a47f34ae3..3757e69799 100644 --- a/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml +++ b/translator/tocwconfig/sampleConfig/prometheus_config_windows.yaml @@ -63,7 +63,7 @@ extensions: mode: ec2 region: us-east-1 processors: - batch/prometheus: + batch/prometheus/cloudwatchlogs: metadata_cardinality_limit: 1000 send_batch_max_size: 0 send_batch_size: 8192 @@ -78,11 +78,11 @@ service: - agenthealth/logs - entitystore pipelines: - metrics/prometheus: + metrics/prometheus/cloudwatchlogs: exporters: - awsemf/prometheus processors: - - batch/prometheus + - batch/prometheus/cloudwatchlogs receivers: - telegraf_prometheus telemetry: diff --git a/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.conf b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.conf new file mode 100644 index 0000000000..d98825b336 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.conf @@ -0,0 +1,19 @@ +[agent] + collection_jitter = "0s" + debug = false + flush_interval = "1s" + flush_jitter = "0s" + hostname = "host_name_from_env" + interval = "60s" + logfile = "" + logtarget = "lumberjack" + metric_batch_size = 1000 + metric_buffer_limit = 10000 + omit_hostname = false + precision = "" + quiet = false + round_interval = false + +[outputs] + + [[outputs.cloudwatch]] diff --git a/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.json b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.json new file mode 100644 index 0000000000..a9e8dc1096 --- /dev/null +++ b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.json @@ -0,0 +1,17 @@ +{ + "agent": { + "region": "us-west-2" + }, + "metrics": { + "metrics_destinations": { + "amp": { + "workspace_id": "ws-12345" + } + }, + "metrics_collected": { + "prometheus": { + "prometheus_config_path": "{prometheusFileName}" + } + } + } +} \ No newline at end of file diff --git a/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml new file mode 100644 index 0000000000..901a74315c --- /dev/null +++ b/translator/tocwconfig/sampleConfig/prometheus_otel_config_linux.yaml @@ -0,0 +1,123 @@ +exporters: + prometheusremotewrite/amp: + add_metric_suffixes: true + auth: + authenticator: sigv4auth + compression: "" + disable_keep_alives: false + endpoint: https://aps-workspaces.us-west-2.amazonaws.com/workspaces/ws-12345/api/v1/remote_write + export_created_metric: + enabled: false + http2_ping_timeout: 0s + http2_read_idle_timeout: 0s + max_batch_size_bytes: 3000000 + namespace: "" + proxy_url: "" + read_buffer_size: 0 + remote_write_queue: + enabled: true + num_consumers: 5 + queue_size: 10000 + resource_to_telemetry_conversion: + clear_after_copy: true + enabled: true + retry_on_failure: + enabled: true + initial_interval: 50ms + max_elapsed_time: 5m0s + max_interval: 30s + multiplier: 1.5 + randomization_factor: 0.5 + send_metadata: false + target_info: + enabled: true + timeout: 5s + tls: + ca_file: "" + cert_file: "" + include_system_ca_certs_pool: false + insecure: false + insecure_skip_verify: false + key_file: "" + max_version: "" + min_version: "" + reload_interval: 0s + server_name_override: "" + write_buffer_size: 524288 +extensions: + sigv4auth: + assume_role: + sts_region: us-west-2 + region: us-west-2 + entitystore: + mode: ec2 + region: us-west-2 +processors: + batch/prometheus/amp: + metadata_cardinality_limit: 1000 + send_batch_max_size: 0 + send_batch_size: 8192 + timeout: 1m0s +receivers: + prometheus: + config: + global: + evaluation_interval: 1m + scrape_interval: 5m + scrape_protocols: + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_timeout: 5s + scrape_configs: + - enable_compression: true + enable_http2: true + file_sd_configs: + - files: + - {ecsSdFileName} + refresh_interval: 5m + follow_redirects: true + honor_timestamps: true + job_name: cwagent-ecs-file-sd-config + metrics_path: /metrics + sample_limit: 10000 + scheme: http + scrape_interval: 5m + scrape_protocols: + - OpenMetricsText1.0.0 + - OpenMetricsText0.0.1 + - PrometheusText0.0.4 + scrape_timeout: 5s + track_timestamps_staleness: false + report_extra_scrape_metrics: false + start_time_metric_regex: "" + trim_metric_suffixes: false + use_start_time_metric: false +service: + extensions: + - sigv4auth + - entitystore + pipelines: + metrics/prometheus/amp: + exporters: + - prometheusremotewrite/amp + processors: + - batch/prometheus/amp + receivers: + - prometheus + telemetry: + logs: + development: false + disable_caller: false + disable_stacktrace: false + encoding: console + level: info + sampling: + enabled: true + initial: 2 + thereafter: 500 + tick: 10s + metrics: + address: "" + level: None + traces: {} diff --git a/translator/tocwconfig/tocwconfig_test.go b/translator/tocwconfig/tocwconfig_test.go index c607257a3a..6b88852bbb 100644 --- a/translator/tocwconfig/tocwconfig_test.go +++ b/translator/tocwconfig/tocwconfig_test.go @@ -27,6 +27,7 @@ import ( "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/tool/testutil" "github.com/aws/amazon-cloudwatch-agent/translator" "github.com/aws/amazon-cloudwatch-agent/translator/cmdutil" "github.com/aws/amazon-cloudwatch-agent/translator/config" @@ -44,7 +45,7 @@ import ( const ( prometheusFileNameToken = "prometheusFileName" - ecsSdFileNamToken = "ecsSdFileName" + ecsSdFileNameToken = "ecsSdFileName" ) //go:embed sampleConfig/prometheus_config.yaml @@ -342,12 +343,12 @@ func TestPrometheusConfig(t *testing.T) { expectedEnvVars := map[string]string{} tokenReplacements := map[string]string{ prometheusFileNameToken: strings.ReplaceAll(prometheusConfigFileName, "\\", "\\\\"), - ecsSdFileNamToken: strings.ReplaceAll(ecsSdFileName, "\\", "\\\\"), + ecsSdFileNameToken: strings.ReplaceAll(ecsSdFileName, "\\", "\\\\"), } // Load prometheus config and replace ecs sd results file name token with temp file name - prometheusConfig = strings.ReplaceAll(prometheusConfig, "{"+ecsSdFileNamToken+"}", ecsSdFileName) + testPrometheusConfig := strings.ReplaceAll(prometheusConfig, "{"+ecsSdFileNameToken+"}", ecsSdFileName) // Write the modified prometheus config to temp prometheus config file - err := os.WriteFile(prometheusConfigFileName, []byte(prometheusConfig), os.ModePerm) + err := os.WriteFile(prometheusConfigFileName, []byte(testPrometheusConfig), os.ModePerm) require.NoError(t, err) // In the following checks, we first load the json and replace tokens with the temp files // Additionally, before comparing with actual, we again replace tokens with temp files in the expected toml & yaml @@ -355,6 +356,53 @@ func TestPrometheusConfig(t *testing.T) { checkTranslation(t, "prometheus_config_windows", "windows", nil, "", tokenReplacements) } +func TestOtelPrometheusConfig(t *testing.T) { + resetContext(t) + context.CurrentContext().SetRunInContainer(true) + context.CurrentContext().SetMode(config.ModeEC2) + testutil.SetPrometheusRemoteWriteTestingEnv(t) + t.Setenv(config.HOST_NAME, "host_name_from_env") + temp := t.TempDir() + prometheusConfigFileName := filepath.Join(temp, "prometheus.yaml") + ecsSdFileName := filepath.Join(temp, "ecs_sd_results.yaml") + expectedEnvVars := map[string]string{} + tokenReplacements := map[string]string{ + prometheusFileNameToken: strings.ReplaceAll(prometheusConfigFileName, "\\", "\\\\"), + ecsSdFileNameToken: strings.ReplaceAll(ecsSdFileName, "\\", "\\\\"), + } + // Load prometheus config and replace ecs sd results file name token with temp file name + testPrometheusConfig := strings.ReplaceAll(prometheusConfig, "{"+ecsSdFileNameToken+"}", ecsSdFileName) + // Write the modified prometheus config to temp prometheus config file + err := os.WriteFile(prometheusConfigFileName, []byte(testPrometheusConfig), os.ModePerm) + require.NoError(t, err) + // In the following checks, we first load the json and replace tokens with the temp files + // Additionally, before comparing with actual, we again replace tokens with temp files in the expected toml & yaml + checkTranslation(t, "prometheus_otel_config_linux", "linux", expectedEnvVars, "", tokenReplacements) +} + +func TestCombinedPrometheusConfig(t *testing.T) { + resetContext(t) + context.CurrentContext().SetMode(config.ModeEC2) + testutil.SetPrometheusRemoteWriteTestingEnv(t) + t.Setenv(config.HOST_NAME, "host_name_from_env") + temp := t.TempDir() + prometheusConfigFileName := filepath.Join(temp, "prometheus.yaml") + ecsSdFileName := filepath.Join(temp, "ecs_sd_results.yaml") + expectedEnvVars := map[string]string{} + tokenReplacements := map[string]string{ + prometheusFileNameToken: strings.ReplaceAll(prometheusConfigFileName, "\\", "\\\\"), + ecsSdFileNameToken: strings.ReplaceAll(ecsSdFileName, "\\", "\\\\"), + } + // Load prometheus config and replace ecs sd results file name token with temp file name + testPrometheusConfig := strings.ReplaceAll(prometheusConfig, "{"+ecsSdFileNameToken+"}", ecsSdFileName) + // Write the modified prometheus config to temp prometheus config file + err := os.WriteFile(prometheusConfigFileName, []byte(testPrometheusConfig), os.ModePerm) + require.NoError(t, err) + // In the following checks, we first load the json and replace tokens with the temp files + // Additionally, before comparing with actual, we again replace tokens with temp files in the expected toml & yaml + checkTranslation(t, "prometheus_combined_config_linux", "linux", expectedEnvVars, "", tokenReplacements) +} + func TestBasicConfig(t *testing.T) { testCases := map[string]testCase{ "linux": { @@ -744,6 +792,9 @@ func verifyToTomlTranslation(t *testing.T, input interface{}, desiredTomlPath st var actual tomlConfigTemplate.TomlConfig _, decodeError2 := toml.Decode(tomlStr, &actual) assert.NoError(t, decodeError2) + + //assert.NoError(t, os.WriteFile(desiredTomlPath, []byte(tomlStr), 0644)) // useful for regenerating TOML + // This less function sort the content of string slice in alphabetical order so the // cmp.Equal method will compare the two struct with slices in them, regardless the elements within the slices opt := cmpopts.SortSlices(func(x, y interface{}) bool { @@ -775,6 +826,8 @@ func verifyToYamlTranslation(t *testing.T, input interface{}, expectedYamlFilePa yamlStr := toyamlconfig.ToYamlConfig(yamlConfig) require.NoError(t, yaml.Unmarshal([]byte(yamlStr), &actual)) + //assert.NoError(t, os.WriteFile(expectedYamlFilePath, []byte(yamlStr), 0644)) // useful for regenerating YAML + opt := cmpopts.SortSlices(func(x, y interface{}) bool { return pretty.Sprint(x) < pretty.Sprint(y) }) diff --git a/translator/translate/logs/metrics_collected/prometheus/ruleConfigPath.go b/translator/translate/logs/metrics_collected/prometheus/ruleConfigPath.go index d9caf43d5c..35e33ccede 100644 --- a/translator/translate/logs/metrics_collected/prometheus/ruleConfigPath.go +++ b/translator/translate/logs/metrics_collected/prometheus/ruleConfigPath.go @@ -5,76 +5,28 @@ package prometheus import ( "log" - "os" - "strings" - "github.com/aws/amazon-cloudwatch-agent/translator" - "github.com/aws/amazon-cloudwatch-agent/translator/config" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/util" ) const ( - source_ENV = "env:" - source_FILE = "file:" - sourceSeparator = ":" - - yamlFileMode = 0644 - - SectionKeyConfigPath = "prometheus_config_path" - defaultLinuxPath = "/etc/cwagentconfig/prometheus.yaml" - linuxDownloadingFile = "/opt/aws/amazon-cloudwatch-agent/etc/prometheus.yaml" - - windowsDownloadingFile = "\\Amazon\\AmazonCloudWatchAgent\\prometheus.yaml" + defaultLinuxPath = "/etc/cwagentconfig/" + prometheusConfigName = "prometheus.yaml" ) type ConfigPath struct { } -func splitConfigPath(configPath string) string { - locationArray := strings.SplitN(configPath, sourceSeparator, 2) - if locationArray == nil || len(locationArray) < 2 { - log.Panicf("Prometheus config path: %s is malformated.", configPath) - } - - return locationArray[1] -} - -func getDownloadPath() string { - if translator.GetTargetPlatform() == config.OS_TYPE_WINDOWS { - var downloadingPath string - if _, ok := os.LookupEnv("ProgramData"); ok { - downloadingPath = os.Getenv("ProgramData") - } - return downloadingPath + windowsDownloadingFile - } - return linuxDownloadingFile -} - func (obj *ConfigPath) ApplyRule(input interface{}) (string, interface{}) { - - _, returnVal := translator.DefaultCase(SectionKeyConfigPath, defaultLinuxPath, input) - configPath := returnVal.(string) - - if strings.HasPrefix(configPath, source_FILE) { - return SectionKeyConfigPath, splitConfigPath(configPath) - } else if strings.HasPrefix(configPath, source_ENV) { - // download the source file to local directory from ENV variable - downloadingPath := getDownloadPath() - configEnv := splitConfigPath(configPath) - if cc, ok := os.LookupEnv(configEnv); ok { - if error := os.WriteFile(downloadingPath, []byte(cc), yamlFileMode); error != nil { - log.Panicf("Failed to download the Prometheus config yaml file. Reason: %s", error.Error()) - } else { - log.Printf("Downloaded the prometheus config from ENV: %v.", configEnv) - } - } else { - log.Panicf("Failed to download the Prometheus config yaml from ENV: %v. Reason: ENV does not exist", configEnv) - } - return SectionKeyConfigPath, downloadingPath + configPath, err := util.GetConfigPath(prometheusConfigName, common.PrometheusConfigPathKey, defaultLinuxPath+prometheusConfigName, input) + if err != nil { + log.Panicf(err.Error()) } - return SectionKeyConfigPath, returnVal + return common.PrometheusConfigPathKey, configPath } func init() { obj := new(ConfigPath) - RegisterRule(SectionKeyConfigPath, obj) + RegisterRule(common.PrometheusConfigPathKey, obj) } diff --git a/translator/translate/metrics/config/registered_metrics.go b/translator/translate/metrics/config/registered_metrics.go index e7bbafcf57..2d0cc06ac1 100644 --- a/translator/translate/metrics/config/registered_metrics.go +++ b/translator/translate/metrics/config/registered_metrics.go @@ -57,4 +57,5 @@ var DisableWinPerfCounters = map[string]bool{ "nvidia_smi": true, "jmx": true, "otlp": true, + "prometheus": true, } diff --git a/translator/translate/otel/common/common.go b/translator/translate/otel/common/common.go index f7637150d2..8e192ef5c9 100644 --- a/translator/translate/otel/common/common.go +++ b/translator/translate/otel/common/common.go @@ -31,6 +31,7 @@ const ( CloudWatchKey = "cloudwatch" CloudWatchLogsKey = "cloudwatchlogs" PrometheusKey = "prometheus" + PrometheusConfigPathKey = "prometheus_config_path" AMPKey = "amp" WorkspaceIDKey = "workspace_id" EMFProcessorKey = "emf_processor" @@ -112,6 +113,7 @@ const ( PipelineNameJmx = "jmx" PipelineNameContainerInsightsJmx = "containerinsightsjmx" PipelineNameEmfLogs = "emf_logs" + PipelineNamePrometheus = "prometheus" AppSignals = "application_signals" AppSignalsFallback = "app_signals" AppSignalsRules = "rules" diff --git a/translator/translate/otel/common/destination.go b/translator/translate/otel/common/destination.go index ee96597d0a..6abd93ebc5 100644 --- a/translator/translate/otel/common/destination.go +++ b/translator/translate/otel/common/destination.go @@ -26,3 +26,7 @@ func GetMetricsDestinations(conf *confmap.Conf) []string { } return destinations } + +func GetLogsDestinations() []string { + return []string{CloudWatchLogsKey} +} diff --git a/translator/translate/otel/exporter/prometheusremotewrite/translator.go b/translator/translate/otel/exporter/prometheusremotewrite/translator.go index 1cca098cbd..b89878d838 100644 --- a/translator/translate/otel/exporter/prometheusremotewrite/translator.go +++ b/translator/translate/otel/exporter/prometheusremotewrite/translator.go @@ -41,15 +41,15 @@ func (t *translator) ID() component.ID { // Translate creates an exporter config based on the fields in the // amp or prometheus section of the JSON config. func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { - if conf == nil || !conf.IsSet(AMPSectionKey) { - return nil, &common.MissingKeyError{ID: t.ID(), JsonKey: AMPSectionKey} + if conf == nil || !(conf.IsSet(AMPSectionKey) && conf.IsSet(common.ConfigKey(AMPSectionKey, common.WorkspaceIDKey))) { + return nil, &common.MissingKeyError{ID: t.ID(), JsonKey: AMPSectionKey + " or " + common.ConfigKey(AMPSectionKey, common.WorkspaceIDKey)} } cfg := t.factory.CreateDefaultConfig().(*prometheusremotewriteexporter.Config) cfg.ClientConfig.Auth = &configauth.Authentication{AuthenticatorID: component.NewID(component.MustNewType(common.SigV4Auth))} cfg.ResourceToTelemetrySettings = resourcetotelemetry.Settings{Enabled: true, ClearAfterCopy: true} - if value, ok := common.GetString(conf, common.ConfigKey(AMPSectionKey, common.WorkspaceIDKey)); ok { - ampEndpoint := "https://aps-workspaces." + agent.Global_Config.Region + ".amazonaws.com/workspaces/" + value + "/api/v1/remote_write" - cfg.ClientConfig.Endpoint = ampEndpoint - } + // ignoring bool return value since we are checking with isSet beforehand + value, _ := common.GetString(conf, common.ConfigKey(AMPSectionKey, common.WorkspaceIDKey)) + ampEndpoint := "https://aps-workspaces." + agent.Global_Config.Region + ".amazonaws.com/workspaces/" + value + "/api/v1/remote_write" + cfg.ClientConfig.Endpoint = ampEndpoint return cfg, nil } diff --git a/translator/translate/otel/exporter/prometheusremotewrite/translator_test.go b/translator/translate/otel/exporter/prometheusremotewrite/translator_test.go index a5b9a146d1..d095918be2 100644 --- a/translator/translate/otel/exporter/prometheusremotewrite/translator_test.go +++ b/translator/translate/otel/exporter/prometheusremotewrite/translator_test.go @@ -33,7 +33,17 @@ func TestTranslator(t *testing.T) { "metrics_destinations": map[string]interface{}{}, }, }, - wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: AMPSectionKey}, + wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: AMPSectionKey + " or " + common.ConfigKey(AMPSectionKey, common.WorkspaceIDKey)}, + }, + "WithMissingWorkspaceId": { + input: map[string]interface{}{ + "metrics": map[string]interface{}{ + "metrics_destinations": map[string]interface{}{ + "amp": map[string]interface{}{}, + }, + }, + }, + wantErr: &common.MissingKeyError{ID: tt.ID(), JsonKey: AMPSectionKey + " or " + common.ConfigKey(AMPSectionKey, common.WorkspaceIDKey)}, }, "WithAMPDestination": { input: testutil.GetJson(t, filepath.Join("testdata", "config.json")), diff --git a/translator/translate/otel/pipeline/host/translators.go b/translator/translate/otel/pipeline/host/translators.go index f44fee05a7..ca9a6595aa 100644 --- a/translator/translate/otel/pipeline/host/translators.go +++ b/translator/translate/otel/pipeline/host/translators.go @@ -70,7 +70,7 @@ func NewTranslators(conf *confmap.Conf, configSection, os string) (pipeline.Tran var destinations []string switch configSection { case LogsKey: - destinations = []string{common.CloudWatchLogsKey} + destinations = common.GetLogsDestinations() case MetricsKey: destinations = common.GetMetricsDestinations(conf) } diff --git a/translator/translate/otel/pipeline/prometheus/translator.go b/translator/translate/otel/pipeline/prometheus/translator.go index 2943273c59..47f34c5d62 100644 --- a/translator/translate/otel/pipeline/prometheus/translator.go +++ b/translator/translate/otel/pipeline/prometheus/translator.go @@ -4,6 +4,7 @@ package prometheus import ( + "fmt" "time" "go.opentelemetry.io/collector/component" @@ -12,41 +13,81 @@ import ( "github.com/aws/amazon-cloudwatch-agent/translator/translate/logs/metrics_collected/prometheus" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/awsemf" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/exporter/prometheusremotewrite" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/agenthealth" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/extension/sigv4auth" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/batchprocessor" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/processor/rollupprocessor" "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/adapter" + otelprom "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/prometheus" ) -const ( - pipelineName = "prometheus" +var ( + MetricsKey = common.ConfigKey(common.MetricsKey, common.MetricsCollectedKey, common.PrometheusKey) + LogsKey = common.ConfigKey(common.LogsKey, common.MetricsCollectedKey, common.PrometheusKey) ) type translator struct { + name string + common.DestinationProvider } var _ common.Translator[*common.ComponentTranslators] = (*translator)(nil) -func NewTranslator() common.Translator[*common.ComponentTranslators] { - return &translator{} +func NewTranslator(opts ...common.TranslatorOption) common.Translator[*common.ComponentTranslators] { + t := &translator{name: common.PipelineNamePrometheus} + for _, opt := range opts { + opt(t) + } + if t.Destination() != "" { + t.name += "/" + t.Destination() + } + return t } func (t *translator) ID() component.ID { - return component.NewIDWithName(component.DataTypeMetrics, pipelineName) + return component.NewIDWithName(component.DataTypeMetrics, t.name) } // Translate creates a pipeline for prometheus if the logs.metrics_collected.prometheus // section is present. func (t *translator) Translate(conf *confmap.Conf) (*common.ComponentTranslators, error) { - key := common.ConfigKey(common.LogsKey, common.MetricsCollectedKey, common.PrometheusKey) - if conf == nil || !conf.IsSet(key) { - return nil, &common.MissingKeyError{ID: t.ID(), JsonKey: key} + if conf == nil || !(conf.IsSet(MetricsKey) || conf.IsSet(LogsKey)) { + return nil, &common.MissingKeyError{ID: t.ID(), JsonKey: fmt.Sprint(MetricsKey + " or " + LogsKey)} + } + + // return pipeline based on destination to keep source/destination combinations clearly separated + // telegraf_prometheus - cloudwatch + // otel_prometheus - AMP + // this could change in future releases to support different source/destination combinations + switch t.Destination() { + case common.CloudWatchLogsKey: + if !conf.IsSet(LogsKey) { + return nil, fmt.Errorf("pipeline (%s) is missing prometheus configuration under logs section with destination (%s)", t.name, t.Destination()) + } + return &common.ComponentTranslators{ + Receivers: common.NewTranslatorMap(adapter.NewTranslator(prometheus.SectionKey, LogsKey, time.Minute)), + Processors: common.NewTranslatorMap( + batchprocessor.NewTranslatorWithNameAndSection(t.name, common.LogsKey), // prometheus sits under metrics_collected in "logs" + ), + Exporters: common.NewTranslatorMap(awsemf.NewTranslatorWithName(common.PipelineNamePrometheus)), + Extensions: common.NewTranslatorMap(agenthealth.NewTranslator(component.DataTypeLogs, []string{agenthealth.OperationPutLogEvents})), + }, nil + case common.AMPKey: + if !conf.IsSet(MetricsKey) { + return nil, fmt.Errorf("pipeline (%s) is missing prometheus configuration under metrics section with destination (%s)", t.name, t.Destination()) + } + translators := &common.ComponentTranslators{ + Receivers: common.NewTranslatorMap(otelprom.NewTranslator()), + Processors: common.NewTranslatorMap(batchprocessor.NewTranslatorWithNameAndSection(t.name, common.MetricsKey)), + Exporters: common.NewTranslatorMap(prometheusremotewrite.NewTranslatorWithName(common.AMPKey)), + Extensions: common.NewTranslatorMap(sigv4auth.NewTranslator()), + } + if conf.IsSet(common.MetricsAggregationDimensionsKey) { + translators.Processors.Set(rollupprocessor.NewTranslator()) + } + return translators, nil + default: + return nil, fmt.Errorf("pipeline (%s) does not support destination %s in configuration", t.name, t.Destination()) } - return &common.ComponentTranslators{ - Receivers: common.NewTranslatorMap(adapter.NewTranslator(prometheus.SectionKey, key, time.Minute)), - Processors: common.NewTranslatorMap( - batchprocessor.NewTranslatorWithNameAndSection(pipelineName, common.LogsKey), // prometheus sits under metrics_collected in "logs" - ), - Exporters: common.NewTranslatorMap(awsemf.NewTranslatorWithName(pipelineName)), - Extensions: common.NewTranslatorMap(agenthealth.NewTranslator(component.DataTypeLogs, []string{agenthealth.OperationPutLogEvents})), - }, nil } diff --git a/translator/translate/otel/pipeline/prometheus/translator_test.go b/translator/translate/otel/pipeline/prometheus/translator_test.go index b83aa7eea0..bad9e1bd42 100644 --- a/translator/translate/otel/pipeline/prometheus/translator_test.go +++ b/translator/translate/otel/pipeline/prometheus/translator_test.go @@ -4,6 +4,7 @@ package prometheus import ( + "errors" "testing" "github.com/stretchr/testify/assert" @@ -17,33 +18,112 @@ import ( func TestTranslator(t *testing.T) { type want struct { + pipelineID string receivers []string processors []string exporters []string extensions []string } - cit := NewTranslator() - require.EqualValues(t, "metrics/prometheus", cit.ID().String()) testCases := map[string]struct { - input map[string]interface{} - want *want - wantErr error + input map[string]any + index int + destination string + want *want + wantErr error }{ - "WithoutPrometheusKey": { - input: map[string]interface{}{}, - wantErr: &common.MissingKeyError{ID: cit.ID(), JsonKey: "logs::metrics_collected::prometheus"}, + "WithoutPrometheusMetrics": { + input: map[string]any{}, + destination: common.AMPKey, + wantErr: &common.MissingKeyError{ + ID: component.NewIDWithName(component.DataTypeMetrics, "prometheus/amp"), + JsonKey: "metrics::metrics_collected::prometheus or logs::metrics_collected::prometheus", + }, + }, + "WithoutPrometheusLogs": { + input: map[string]any{}, + destination: common.CloudWatchLogsKey, + wantErr: &common.MissingKeyError{ + ID: component.NewIDWithName(component.DataTypeMetrics, "prometheus/cloudwatchlogs"), + JsonKey: "metrics::metrics_collected::prometheus or logs::metrics_collected::prometheus", + }, + }, + "WithMissingLogsConfiguration": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_destinations": map[string]any{ + "amp": map[string]any{}, + }, + "metrics_collected": map[string]any{ + "prometheus": map[string]any{ + "prometheus_config_path": "test.yaml", + }, + }, + }, + }, + destination: common.CloudWatchLogsKey, + wantErr: errors.New("pipeline (prometheus/cloudwatchlogs) is missing prometheus configuration under logs section with destination (cloudwatchlogs)"), + }, + "WithMetricsWithCloudWatchDestination": { + input: map[string]any{ + "logs": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + "metrics": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{ + "prometheus_config_path": "test.yaml", + }, + }, + }, + }, + destination: common.CloudWatchLogsKey, + want: &want{ + pipelineID: "metrics/prometheus/cloudwatchlogs", + receivers: []string{"telegraf_prometheus"}, + processors: []string{"batch/prometheus/cloudwatchlogs"}, + exporters: []string{"awsemf/prometheus"}, + extensions: []string{"agenthealth/logs"}, + }, + }, + "WithValidAMP": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_destinations": map[string]any{ + "amp": map[string]any{ + "workspace_id": "ws1234", + }, + }, + "metrics_collected": map[string]any{ + "prometheus": map[string]any{ + "prometheus_config_path": "test.yaml", + }, + }, + }, + }, + destination: common.AMPKey, + want: &want{ + pipelineID: "metrics/prometheus/amp", + receivers: []string{"prometheus"}, + processors: []string{"batch/prometheus/amp"}, + exporters: []string{"prometheusremotewrite/amp"}, + extensions: []string{"sigv4auth"}, + }, }, - "WithPrometheusKey": { - input: map[string]interface{}{ - "logs": map[string]interface{}{ - "metrics_collected": map[string]interface{}{ - "prometheus": nil, + "WithValidCloudWatch": { + input: map[string]any{ + "logs": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, }, }, }, + destination: common.CloudWatchLogsKey, want: &want{ + pipelineID: "metrics/prometheus/cloudwatchlogs", receivers: []string{"telegraf_prometheus"}, - processors: []string{"batch/prometheus"}, + processors: []string{"batch/prometheus/cloudwatchlogs"}, exporters: []string{"awsemf/prometheus"}, extensions: []string{"agenthealth/logs"}, }, @@ -51,13 +131,15 @@ func TestTranslator(t *testing.T) { } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { + tt := NewTranslator(common.WithDestination(testCase.destination)) conf := confmap.NewFromStringMap(testCase.input) - got, err := cit.Translate(conf) - assert.Equal(t, testCase.wantErr, err) + got, err := tt.Translate(conf) + require.Equal(t, testCase.wantErr, err) if testCase.want == nil { - assert.Nil(t, got) + require.Nil(t, got) } else { require.NotNil(t, got) + require.EqualValues(t, testCase.want.pipelineID, tt.ID().String()) assert.Equal(t, testCase.want.receivers, collections.MapSlice(got.Receivers.Keys(), component.ID.String)) assert.Equal(t, testCase.want.processors, collections.MapSlice(got.Processors.Keys(), component.ID.String)) assert.Equal(t, testCase.want.exporters, collections.MapSlice(got.Exporters.Keys(), component.ID.String)) diff --git a/translator/translate/otel/pipeline/prometheus/translators.go b/translator/translate/otel/pipeline/prometheus/translators.go new file mode 100644 index 0000000000..6ee08f4e2e --- /dev/null +++ b/translator/translate/otel/pipeline/prometheus/translators.go @@ -0,0 +1,27 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package prometheus + +import ( + "go.opentelemetry.io/collector/confmap" + + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/pipeline" +) + +func NewTranslators(conf *confmap.Conf) pipeline.TranslatorMap { + translators := common.NewTranslatorMap[*common.ComponentTranslators]() + var destinations []string + if conf.IsSet(LogsKey) { + destinations = append(destinations, common.CloudWatchLogsKey) + } + if conf.IsSet(MetricsKey) { + destinations = append(destinations, common.AMPKey) + } + + for _, destination := range destinations { + translators.Set(NewTranslator(common.WithDestination(destination))) + } + return translators +} diff --git a/translator/translate/otel/pipeline/prometheus/translators_test.go b/translator/translate/otel/pipeline/prometheus/translators_test.go new file mode 100644 index 0000000000..00ec31e83e --- /dev/null +++ b/translator/translate/otel/pipeline/prometheus/translators_test.go @@ -0,0 +1,141 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package prometheus + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + + _ "github.com/aws/amazon-cloudwatch-agent/translator/registerrules" +) + +func TestTranslators(t *testing.T) { + + testCases := map[string]struct { + input map[string]any + want []component.ID + }{ + "WithEmpty": { + input: map[string]any{}, + want: []component.ID{}, + }, + "WithMetricsWithoutDestinations": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + }, + want: []component.ID{ + component.MustNewIDWithName("metrics", "prometheus/amp"), + }, + }, + "WithLogsWithoutDestinations": { + input: map[string]any{ + "logs": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + }, + want: []component.ID{ + component.MustNewIDWithName("metrics", "prometheus/cloudwatchlogs"), + }, + }, + "WithMetricsWithCloudWatchDestination": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_destinations": map[string]any{ + "cloudwatch": map[string]any{}, + }, + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + }, + want: []component.ID{ + component.MustNewIDWithName("metrics", "prometheus/amp"), + }, + }, + "WithMetricsWithAMP": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_destinations": map[string]any{ + "amp": map[string]any{ + "workspace_id": "ws-12345", + }, + }, + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + }, + want: []component.ID{ + component.MustNewIDWithName("metrics", "prometheus/amp"), + }, + }, + "WithLogsWithCloudWatch": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_destinations": map[string]any{ + "cloudwatch": map[string]any{}, + }, + }, + "logs": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + }, + want: []component.ID{ + component.MustNewIDWithName("metrics", "prometheus/cloudwatchlogs"), + }, + }, + "WithMultiple/Destinations": { + input: map[string]any{ + "metrics": map[string]any{ + "metrics_destinations": map[string]any{ + "cloudwatch": map[string]any{}, + "amp": map[string]any{ + "workspace_id": "ws-12345", + }, + }, + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + "logs": map[string]any{ + "metrics_collected": map[string]any{ + "prometheus": map[string]any{}, + }, + }, + }, + want: []component.ID{ + component.MustNewIDWithName("metrics", "prometheus/amp"), + component.MustNewIDWithName("metrics", "prometheus/cloudwatchlogs"), + }, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + conf := confmap.NewFromStringMap(testCase.input) + got := NewTranslators(conf) + if testCase.want == nil { + require.Nil(t, got) + } else { + require.NotNil(t, got) + assert.Equal(t, len(testCase.want), got.Len()) + for _, id := range testCase.want { + _, ok := got.Get(id) + assert.True(t, ok) + } + } + }) + } +} diff --git a/translator/translate/otel/receiver/adapter/translators.go b/translator/translate/otel/receiver/adapter/translators.go index 3db987152d..f47740aa4f 100644 --- a/translator/translate/otel/receiver/adapter/translators.go +++ b/translator/translate/otel/receiver/adapter/translators.go @@ -67,7 +67,7 @@ var ( // otelReceivers is used for receivers that need to be in the same pipeline that // exports to Cloudwatch while not having to follow the adapter rules - otelReceivers = collections.NewSet[string](common.OtlpKey, common.JmxKey) + otelReceivers = collections.NewSet[string](common.OtlpKey, common.JmxKey, common.PrometheusKey) ) // FindReceiversInConfig looks in the metrics and logs sections to determine which diff --git a/translator/translate/otel/receiver/prometheus/testdata/config.json b/translator/translate/otel/receiver/prometheus/testdata/config.json new file mode 100644 index 0000000000..db663ccd87 --- /dev/null +++ b/translator/translate/otel/receiver/prometheus/testdata/config.json @@ -0,0 +1,9 @@ +{ + "metrics": { + "metrics_collected": { + "prometheus": { + "prometheus_config_path": "./testdata/config_otel.yaml" + } + } + } +} diff --git a/translator/translate/otel/receiver/prometheus/testdata/config_otel.yaml b/translator/translate/otel/receiver/prometheus/testdata/config_otel.yaml new file mode 100644 index 0000000000..94f82f6835 --- /dev/null +++ b/translator/translate/otel/receiver/prometheus/testdata/config_otel.yaml @@ -0,0 +1,12 @@ +config: + global: + scrape_interval: 60s + scrape_timeout: 30s + scrape_configs: + - job_name: 'prometheus_test_job' + static_configs: + - targets: ['localhost:8000'] + labels: + label1: 'test1' +target_allocator: + collector_id: "col-1234" \ No newline at end of file diff --git a/translator/translate/otel/receiver/prometheus/testdata/config_prom.json b/translator/translate/otel/receiver/prometheus/testdata/config_prom.json new file mode 100644 index 0000000000..55ea121b80 --- /dev/null +++ b/translator/translate/otel/receiver/prometheus/testdata/config_prom.json @@ -0,0 +1,9 @@ +{ + "metrics": { + "metrics_collected": { + "prometheus": { + "prometheus_config_path": "./testdata/config_prom.yaml" + } + } + } +} diff --git a/translator/translate/otel/receiver/prometheus/testdata/config_prom.yaml b/translator/translate/otel/receiver/prometheus/testdata/config_prom.yaml new file mode 100644 index 0000000000..8c0bbcb8da --- /dev/null +++ b/translator/translate/otel/receiver/prometheus/testdata/config_prom.yaml @@ -0,0 +1,9 @@ +global: + scrape_interval: 60s + scrape_timeout: 30s +scrape_configs: + - job_name: 'prometheus_test_job' + static_configs: + - targets: ['localhost:8000'] + labels: + label1: 'test1' \ No newline at end of file diff --git a/translator/translate/otel/receiver/prometheus/translator.go b/translator/translate/otel/receiver/prometheus/translator.go new file mode 100644 index 0000000000..f0f9912586 --- /dev/null +++ b/translator/translate/otel/receiver/prometheus/translator.go @@ -0,0 +1,103 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package prometheus + +import ( + "fmt" + "os" + "strings" + "time" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/confmap" + "go.opentelemetry.io/collector/receiver" + "gopkg.in/yaml.v3" + + "github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/common" + "github.com/aws/amazon-cloudwatch-agent/translator/util" +) + +const ( + otelConfigParsingError = "has invalid keys: global" + defaultTlsCaPath = "/etc/amazon-cloudwatch-observability-agent-cert/tls-ca.crt" +) + +var ( + configPathKey = common.ConfigKey(common.MetricsKey, common.MetricsCollectedKey, common.PrometheusKey, common.PrometheusConfigPathKey) +) + +type translator struct { + name string + factory receiver.Factory +} + +type Option func(any) + +var _ common.Translator[component.Config] = (*translator)(nil) + +func NewTranslator(opts ...Option) common.Translator[component.Config] { + t := &translator{factory: prometheusreceiver.NewFactory()} + for _, opt := range opts { + opt(t) + } + return t +} + +func (t *translator) ID() component.ID { + return component.NewIDWithName(t.factory.Type(), t.name) +} + +func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) { + cfg := t.factory.CreateDefaultConfig().(*prometheusreceiver.Config) + + if !conf.IsSet(configPathKey) { + return nil, &common.MissingKeyError{ID: t.ID(), JsonKey: configPathKey} + } + + configPath, _ := common.GetString(conf, configPathKey) + processedConfigPath, err := util.GetConfigPath("prometheus.yaml", configPathKey, configPath, nil) + if err != nil { + return nil, fmt.Errorf("unable to process prometheus config with given config: %w", err) + } + configPath = processedConfigPath.(string) + content, err := os.ReadFile(configPath) + if err != nil { + return nil, fmt.Errorf("unable to read prometheus config from path: %w", err) + } + var stringMap map[string]interface{} + err = yaml.Unmarshal(content, &stringMap) + if err != nil { + return nil, err + } + componentParser := confmap.NewFromStringMap(stringMap) + if componentParser == nil { + return nil, fmt.Errorf("unable to parse config from filename %s", configPath) + } + err = componentParser.Unmarshal(&cfg) + if err != nil { + // passed in prometheus config is in plain prometheus format and not otel wrapper + if !strings.Contains(err.Error(), otelConfigParsingError) { + return nil, fmt.Errorf("unable to unmarshall config to otel prometheus config from filename %s", configPath) + } + + var promCfg prometheusreceiver.PromConfig + err = componentParser.Unmarshal(&promCfg) + if err != nil { + return nil, fmt.Errorf("unable to unmarshall config to prometheus config from filename %s", configPath) + } + cfg.PrometheusConfig.GlobalConfig = promCfg.GlobalConfig + cfg.PrometheusConfig.ScrapeConfigs = promCfg.ScrapeConfigs + cfg.PrometheusConfig.TracingConfig = promCfg.TracingConfig + } else { + // given prometheus config is in otel format so check if target allocator is being used + // then add the default cert for TargetAllocator + if cfg.TargetAllocator != nil && len(cfg.TargetAllocator.CollectorID) > 0 { + cfg.TargetAllocator.TLSSetting.Config.CAFile = defaultTlsCaPath + cfg.TargetAllocator.TLSSetting.ReloadInterval = 10 * time.Second + } + } + + return cfg, nil +} diff --git a/translator/translate/otel/receiver/prometheus/translator_test.go b/translator/translate/otel/receiver/prometheus/translator_test.go new file mode 100644 index 0000000000..b5c5073db0 --- /dev/null +++ b/translator/translate/otel/receiver/prometheus/translator_test.go @@ -0,0 +1,156 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package prometheus + +import ( + "path/filepath" + "testing" + "time" + + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver" + "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver/targetallocator" + promcommon "github.com/prometheus/common/config" + "github.com/prometheus/common/model" + "github.com/prometheus/prometheus/config" + promconfig "github.com/prometheus/prometheus/config" + "github.com/prometheus/prometheus/discovery" + "github.com/prometheus/prometheus/discovery/targetgroup" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/config/confighttp" + "go.opentelemetry.io/collector/config/configtls" + "go.opentelemetry.io/collector/confmap" + + "github.com/aws/amazon-cloudwatch-agent/internal/util/testutil" +) + +func TestTranslator(t *testing.T) { + testCases := map[string]struct { + input map[string]any + wantID string + want *prometheusreceiver.Config + wantErr error + }{ + "WithOtelConfig": { + input: testutil.GetJson(t, filepath.Join("testdata", "config.json")), + wantID: "prometheus", + want: &prometheusreceiver.Config{ + PrometheusConfig: &prometheusreceiver.PromConfig{ + GlobalConfig: promconfig.GlobalConfig{ + ScrapeInterval: model.Duration(1 * time.Minute), + ScrapeTimeout: model.Duration(30 * time.Second), + ScrapeProtocols: promconfig.DefaultScrapeProtocols, + EvaluationInterval: model.Duration(1 * time.Minute), + }, + ScrapeConfigs: []*config.ScrapeConfig{ + { + ScrapeInterval: model.Duration(1 * time.Minute), + ScrapeTimeout: model.Duration(30 * time.Second), + JobName: "prometheus_test_job", + HonorTimestamps: true, + ScrapeProtocols: promconfig.DefaultScrapeProtocols, + MetricsPath: "/metrics", + Scheme: "http", + EnableCompression: true, + ServiceDiscoveryConfigs: discovery.Configs{ + discovery.StaticConfig{ + &targetgroup.Group{ + Targets: []model.LabelSet{ + { + model.AddressLabel: "localhost:8000", + }, + }, + Labels: map[model.LabelName]model.LabelValue{ + "label1": "test1", + }, + Source: "0", + }, + }, + }, + HTTPClientConfig: promcommon.HTTPClientConfig{ + FollowRedirects: true, + EnableHTTP2: true, + }, + }, + }, + }, + TargetAllocator: &targetallocator.Config{ + CollectorID: "col-1234", + ClientConfig: confighttp.ClientConfig{ + TLSSetting: configtls.ClientConfig{ + Config: configtls.Config{ + CAFile: defaultTlsCaPath, + ReloadInterval: 10 * time.Second, + }, + }, + }, + }, + }, + }, + "WithPromConfig": { + input: testutil.GetJson(t, filepath.Join("testdata", "config_prom.json")), + wantID: "prometheus", + want: &prometheusreceiver.Config{ + PrometheusConfig: &prometheusreceiver.PromConfig{ + GlobalConfig: promconfig.GlobalConfig{ + ScrapeInterval: model.Duration(1 * time.Minute), + ScrapeTimeout: model.Duration(30 * time.Second), + ScrapeProtocols: promconfig.DefaultScrapeProtocols, + EvaluationInterval: model.Duration(1 * time.Minute), + }, + ScrapeConfigs: []*config.ScrapeConfig{ + { + ScrapeInterval: model.Duration(1 * time.Minute), + ScrapeTimeout: model.Duration(30 * time.Second), + JobName: "prometheus_test_job", + HonorTimestamps: true, + ScrapeProtocols: promconfig.DefaultScrapeProtocols, + MetricsPath: "/metrics", + Scheme: "http", + EnableCompression: true, + ServiceDiscoveryConfigs: discovery.Configs{ + discovery.StaticConfig{ + &targetgroup.Group{ + Targets: []model.LabelSet{ + { + model.AddressLabel: "localhost:8000", + }, + }, + Labels: map[model.LabelName]model.LabelValue{ + "label1": "test1", + }, + Source: "0", + }, + }, + }, + HTTPClientConfig: promcommon.HTTPClientConfig{ + FollowRedirects: true, + EnableHTTP2: true, + }, + }, + }, + }, + }, + }, + } + for name, testCase := range testCases { + t.Run(name, func(t *testing.T) { + tt := NewTranslator() + assert.EqualValues(t, testCase.wantID, tt.ID().String()) + conf := confmap.NewFromStringMap(testCase.input) + got, err := tt.Translate(conf) + assert.Equal(t, testCase.wantErr, err) + if err == nil { + require.NotNil(t, got) + gotCfg, ok := got.(*prometheusreceiver.Config) + require.True(t, ok) + + assert.NoError(t, err) + assert.Equal(t, testCase.want.PrometheusConfig.ScrapeConfigs, gotCfg.PrometheusConfig.ScrapeConfigs) + assert.Equal(t, testCase.want.PrometheusConfig.GlobalConfig, gotCfg.PrometheusConfig.GlobalConfig) + assert.Equal(t, testCase.want.TargetAllocator, gotCfg.TargetAllocator) + } + }) + } +} diff --git a/translator/translate/otel/translate_otel.go b/translator/translate/otel/translate_otel.go index 12c38185fd..40f400bf2e 100644 --- a/translator/translate/otel/translate_otel.go +++ b/translator/translate/otel/translate_otel.go @@ -69,7 +69,7 @@ func Translate(jsonConfig interface{}, os string) (*otelcol.Config, error) { translators.Set(applicationsignals.NewTranslator(component.DataTypeTraces)) translators.Set(applicationsignals.NewTranslator(component.DataTypeMetrics)) translators.Set(containerinsights.NewTranslator()) - translators.Set(prometheus.NewTranslator()) + translators.Merge(prometheus.NewTranslators(conf)) translators.Set(emf_logs.NewTranslator()) translators.Set(xray.NewTranslator()) translators.Set(containerinsightsjmx.NewTranslator()) diff --git a/translator/translate/otel/translate_otel_test.go b/translator/translate/otel/translate_otel_test.go index 565c781d2d..309743caad 100644 --- a/translator/translate/otel/translate_otel_test.go +++ b/translator/translate/otel/translate_otel_test.go @@ -16,6 +16,7 @@ import ( _ "github.com/aws/amazon-cloudwatch-agent/translator/registerrules" "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/pipeline/prometheus" "github.com/aws/amazon-cloudwatch-agent/translator/util/eksdetector" ) @@ -190,6 +191,23 @@ func TestTranslator(t *testing.T) { }, }, }, + "WithOutValidatePrometheusConfig": { + input: map[string]interface{}{ + "metrics": map[string]interface{}{ + "metrics_destinations": map[string]interface{}{ + "amp": map[string]interface{}{ + "workspace_id": "ws-12345", + }, + }, + "metrics_collected": map[string]interface{}{ + "prometheus": map[string]interface{}{ + "prometheus_config": "missing.yaml", + }, + }, + }, + }, + wantErrContains: common.ConfigKey(prometheus.MetricsKey, common.PrometheusConfigPathKey), + }, } for name, testCase := range testCases { t.Run(name, func(t *testing.T) { diff --git a/translator/util/configutil.go b/translator/util/configutil.go new file mode 100644 index 0000000000..853de1031a --- /dev/null +++ b/translator/util/configutil.go @@ -0,0 +1,70 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package util + +import ( + "errors" + "fmt" + "os" + "strings" + + "github.com/aws/amazon-cloudwatch-agent/translator" + "github.com/aws/amazon-cloudwatch-agent/translator/config" +) + +const ( + source_ENV = "env:" + source_FILE = "file:" + sourceSeparator = ":" + + yamlFileMode = 0644 + + linuxDownloadingPath = "/opt/aws/amazon-cloudwatch-agent/etc/" + windowsDownloadingPath = "\\Amazon\\AmazonCloudWatchAgent\\" +) + +func splitConfigPath(configPath string) (string, error) { + locationArray := strings.SplitN(configPath, sourceSeparator, 2) + if locationArray == nil || len(locationArray) < 2 { + return "", errors.New(fmt.Sprintf("config path: %s is malformatted.", configPath)) + } + + return locationArray[1], nil +} + +func getDownloadPath() string { + if translator.GetTargetPlatform() == config.OS_TYPE_WINDOWS { + var downloadingPath string + if _, ok := os.LookupEnv("ProgramData"); ok { + downloadingPath = os.Getenv("ProgramData") + } + return downloadingPath + windowsDownloadingPath + } + return linuxDownloadingPath +} + +func GetConfigPath(configFileName string, sectionKey string, defaultPath string, input interface{}) (interface{}, error) { + _, returnVal := translator.DefaultCase(sectionKey, defaultPath, input) + configPath := returnVal.(string) + + if strings.HasPrefix(configPath, source_FILE) { + return splitConfigPath(configPath) + } else if strings.HasPrefix(configPath, source_ENV) { + // download the source file to local directory from ENV variable + downloadingPath := getDownloadPath() + configFileName + configEnv, err := splitConfigPath(configPath) + if err != nil { + return nil, err + } + if cc, ok := os.LookupEnv(configEnv); ok { + if err := os.WriteFile(downloadingPath, []byte(cc), yamlFileMode); err != nil { + return "", errors.New(fmt.Sprintf("Failed to download config file %s. Reason: %s", configFileName, err.Error())) + } + } else { + return "", errors.New(fmt.Sprintf("Failed to download config from ENV: %v. Reason: ENV does not exist", configEnv)) + } + return downloadingPath, nil + } + return returnVal, nil +} diff --git a/translator/util/configutil_test.go b/translator/util/configutil_test.go new file mode 100644 index 0000000000..2cbcc9cd37 --- /dev/null +++ b/translator/util/configutil_test.go @@ -0,0 +1,88 @@ +// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +// SPDX-License-Identifier: MIT + +package util + +import ( + "os" + "testing" + + "gotest.tools/v3/assert" +) + +func TestConfigPathUtil(t *testing.T) { + tests := []struct { + name string + sectionKey string + fileName string + defaultValue string + config map[string]any + expectedPath string + setEnv bool + wantError bool + }{ + { + name: "basic", + sectionKey: "path", + config: map[string]any{ + "path": "/prometheus.yaml", + }, + expectedPath: "/prometheus.yaml", + }, + { + name: "default", + sectionKey: "path", + defaultValue: "/prometheus.yaml", + config: map[string]any{ + "key": "/other.yaml", + }, + expectedPath: "/prometheus.yaml", + }, + { + name: "missingInput", + sectionKey: "path", + config: nil, + expectedPath: "", + }, + { + name: "file", + sectionKey: "path", + config: map[string]any{ + "path": "file:/prometheus.yaml", + }, + expectedPath: "/prometheus.yaml", + }, + // skipping ENV due to hardcoded download path + //{ + // name: "env", + // sectionKey: "path", + // fileName: "prometheus.yaml", + // config: map[string]any{ + // "path": "env:TEST_ENV", + // }, + // setEnv: true, + // expectedPath: "/opt/aws/amazon-cloudwatch-agent/etc/prometheus.yaml", + //}, + { + name: "missingEnv", + sectionKey: "path", + fileName: "prometheus.yaml", + config: map[string]any{ + "path": "env:TEST_ENV", + }, + wantError: true, + }, + } + for _, tt := range tests { + func() { + t.Run(tt.name, func(t *testing.T) { + if tt.setEnv { + defer os.Setenv("TEST_ENV", "") + } + got, err := GetConfigPath(tt.fileName, tt.sectionKey, tt.defaultValue, tt.config) + assert.Equal(t, tt.wantError, err != nil) + assert.Equal(t, got, tt.expectedPath) + }) + }() + } +}