Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ replace (

replace (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20250722193355-2e41d3b81be3
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics => github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/metrics v0.0.0-20250717174233-f514045fc484
Expand All @@ -42,11 +42,11 @@ replace (
replace github.com/open-telemetry/opentelemetry-collector-contrib/processor/resourcedetectionprocessor => github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20250717174233-f514045fc484

replace (
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20250722193355-2e41d3b81be3
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver v0.0.0-20250722193355-2e41d3b81be3
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awsxrayreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jmxreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20250717174233-f514045fc484
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20250722193355-2e41d3b81be3
)

// Temporary fix, pending PR https://github.com/shirou/gopsutil/pull/957
Expand Down
14 changes: 6 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,6 @@ github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsprox
github.com/amazon-contributing/opentelemetry-collector-contrib/extension/awsproxy v0.0.0-20250717174233-f514045fc484/go.mod h1:IaVVx5+2dXba7dDVfnCAZkqBc3fE7XX5UnehsGmf+mw=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20250717174233-f514045fc484 h1:34a19sMva8wCzo9OMMMdK26woQy5WKG3wKGe4Xt6tYM=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/awsutil v0.0.0-20250717174233-f514045fc484/go.mod h1:AbdplNaM4g1LnEbDczU5tDqnF1xhzlgBvpB1xwEUlhg=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20250717174233-f514045fc484 h1:gs9fAS213niCP4k2sPeqsEfOgSrXI6eDsn2REPeKDJw=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/containerinsight v0.0.0-20250717174233-f514045fc484/go.mod h1:9bL/kFVrHh9yDtTUQwxkVl7gRA0PfTmt87CBzC/ihBM=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20250717174233-f514045fc484 h1:cRB7SfM84zjadY92D1s2ywEAsO7+YKAFBDXUlpveh10=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/cwlogs v0.0.0-20250717174233-f514045fc484/go.mod h1:XK8ww4E/9UaVR0wz3mS1HRr+qFEfA/FBZoSRZjVnJRs=
github.com/amazon-contributing/opentelemetry-collector-contrib/internal/aws/k8s v0.0.0-20250717174233-f514045fc484 h1:36mpJBt/c/mZYE7R2+z2anERw0vmc7tf22SJ9FkRJf8=
Expand Down Expand Up @@ -229,16 +227,16 @@ github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/pr
github.com/amazon-contributing/opentelemetry-collector-contrib/pkg/translator/prometheus v0.0.0-20250717174233-f514045fc484/go.mod h1:7prJseoHF7mXXAPdU+q1zoZdVOclFZsgNhoBriqBIp0=
github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20250717174233-f514045fc484 h1:cFRXqozAwclrrSJD/1fwrrebwNNVL8sAPvewZSmYl0k=
github.com/amazon-contributing/opentelemetry-collector-contrib/processor/resourcedetectionprocessor v0.0.0-20250717174233-f514045fc484/go.mod h1:K8inysgi51ecddal8W6MPqrYcjh65wm1PsVDV+zgCEA=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20250717174233-f514045fc484 h1:KkQR49FSmepOqBfze1zNBmAi06DUUSQzOS+lzQkSPTY=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20250717174233-f514045fc484/go.mod h1:78qZtZnv6jO7K56d1OUMtgTcH0rPcb4N8Zp4/EiMJ0o=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver v0.0.0-20250717174233-f514045fc484 h1:NqDlh14x1674xIAnLC3iCvEmaLeGEorAzzWopMKAW9o=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver v0.0.0-20250717174233-f514045fc484/go.mod h1:GipgrS7Hgv0MgjQ6c2CrEti5kWKsXSaqB+E2XrHmiy4=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20250722185957-5561c58c81fd h1:Vg8NFRXprGAgmLvsrxP5etgVgTFT4aKluPOGWFRB+b8=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver v0.0.0-20250722185957-5561c58c81fd/go.mod h1:78qZtZnv6jO7K56d1OUMtgTcH0rPcb4N8Zp4/EiMJ0o=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver v0.0.0-20250722185957-5561c58c81fd h1:nwrxRfSQ3wQ5udVCh+vEQsW8i5cYWWUZOA7kCQsXDG0=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver v0.0.0-20250722185957-5561c58c81fd/go.mod h1:GipgrS7Hgv0MgjQ6c2CrEti5kWKsXSaqB+E2XrHmiy4=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20250717174233-f514045fc484 h1:7Eq8GHafdPwuj/zruhctXzYyhtXUmp0FVAcsHX0V6Co=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/awsxrayreceiver v0.0.0-20250717174233-f514045fc484/go.mod h1:iNL2C4bugyDA/nYSAu4O68xD859BudOWGd0+03+lWVs=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20250717174233-f514045fc484 h1:ot2Q8zo4EQBwhCIOht3XkuRYkBsJhddWBQrng37LFWQ=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/jmxreceiver v0.0.0-20250717174233-f514045fc484/go.mod h1:tEB7CZP8f7qVEWH9y3F2sbI5EcvICSW3sZOFwXRge5U=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20250717174233-f514045fc484 h1:hh+kKCO1UBFIvDIF4pxiwSbixO3AfbjOc36z6uuXujE=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20250717174233-f514045fc484/go.mod h1:Tc/PSUfe91PN6BoGKEHFo6V0gb23gxp7QLTdsrK2meI=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20250722185957-5561c58c81fd h1:O8ea/g1SGPLV34xU5rRMW5XYTvAvP9BHvKrzJhhqXVI=
github.com/amazon-contributing/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-20250722185957-5561c58c81fd/go.mod h1:Tc/PSUfe91PN6BoGKEHFo6V0gb23gxp7QLTdsrK2meI=
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=
Expand Down
10 changes: 10 additions & 0 deletions translator/translate/otel/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,16 @@ func GetOrDefaultNumber(conf *confmap.Conf, key string, defaultVal float64) floa
return value
}

// GetOrDefaultCollectionInterval gets the collection interval from the configuration.
// If the interval is not specified or is <= 0, it returns the component's default interval.
func GetOrDefaultCollectionInterval(conf *confmap.Conf, key string, componentDefault time.Duration) time.Duration {
interval, ok := GetDuration(conf, key)
if !ok || interval <= 0 {
return componentDefault
}
return interval
}

// GetDuration gets the value for the key and calls ParseDuration on it.
// If the key is missing, it is unable to parse the duration, or the
// duration is set to 0, then the returned bool will be false.
Expand Down
4 changes: 2 additions & 2 deletions translator/translate/otel/receiver/adapter/translator.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ type translator struct {
// See otel.ConfigKey.
cfgKey string

// preferMetricCollectionInterval is an option to using the preferaable metric collection interval before
// preferMetricCollectionInterval is an option to using the preferable metric collection interval before
// using the interval key chain and defaultMetricCollectionInterval
preferMetricCollectionInterval time.Duration

// defaultMetricCollectionInterval is the fallback interval if it
// defaultMetricCollectionInterval is the fallback interval if
// it is not present in the interval keychain.
defaultMetricCollectionInterval time.Duration
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"fmt"
"os"
"strings"
"time"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver"

Check failure on line 12 in translator/translate/otel/receiver/awscontainerinsight/translator.go

View workflow job for this annotation

GitHub Actions / BuildAndUpload / MakeBinary

missing go.sum entry for module providing package github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver (imported by github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/awscontainerinsight); to add:
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/receiver"
Expand All @@ -32,7 +31,7 @@
ecs = "ecs"
eks = "eks"

defaultMetricsCollectionInterval = time.Minute
defaultMetricsCollectionInterval = -1 // default to -1 to use default value defined in receiver
defaultLeaderLockName = "cwagent-clusterleader" // To maintain backwards compatability with https://github.com/aws/amazon-cloudwatch-agent/blob/2dd89abaab4590cffbbc31ef89319b62809b09d1/plugins/inputs/k8sapiserver/k8sapiserver.go#L30
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: ecs,
CollectionInterval: time.Minute,
CollectionInterval: defaultMetricsCollectionInterval,
LeaderLockName: "otel-container-insight-clusterleader",
TagService: true,
},
Expand Down Expand Up @@ -130,7 +130,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
TagService: false,
LeaderLockName: defaultLeaderLockName,
LeaderLockUsingConfigMapOnly: true,
Expand All @@ -153,7 +153,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
CollectionRole: awscontainerinsightreceiver.LEADER,
TagService: true,
LeaderLockName: defaultLeaderLockName,
Expand All @@ -177,7 +177,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
CollectionRole: awscontainerinsightreceiver.NODE,
TagService: true,
LeaderLockName: defaultLeaderLockName,
Expand All @@ -199,7 +199,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
PrefFullPodName: true,
LeaderLockName: defaultLeaderLockName,
LeaderLockUsingConfigMapOnly: true,
Expand All @@ -224,7 +224,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
LeaderLockName: defaultLeaderLockName,
LeaderLockUsingConfigMapOnly: true,
ClusterName: "TestCluster",
Expand All @@ -248,7 +248,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
PrefFullPodName: true,
LeaderLockName: defaultLeaderLockName,
LeaderLockUsingConfigMapOnly: true,
Expand All @@ -273,7 +273,7 @@ func TestTranslator(t *testing.T) {
},
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
PrefFullPodName: true,
LeaderLockName: defaultLeaderLockName,
LeaderLockUsingConfigMapOnly: true,
Expand Down Expand Up @@ -322,7 +322,7 @@ func TestTranslator(t *testing.T) {
isSystemd: true,
want: &awscontainerinsightreceiver.Config{
ContainerOrchestrator: eks,
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
PrefFullPodName: false,
LeaderLockName: defaultLeaderLockName,
LeaderLockUsingConfigMapOnly: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@

import (
"errors"
"time"

"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver"

Check failure on line 9 in translator/translate/otel/receiver/awscontainerinsightskueue/translator.go

View workflow job for this annotation

GitHub Actions / BuildAndUpload / MakeBinary

missing go.sum entry for module providing package github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightskueuereceiver (imported by github.com/aws/amazon-cloudwatch-agent/translator/translate/otel/receiver/awscontainerinsightskueue); to add:
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap"
"go.opentelemetry.io/collector/receiver"
Expand All @@ -16,7 +15,7 @@
)

const (
defaultMetricsCollectionInterval = time.Minute
defaultMetricsCollectionInterval = -1 // default to -1 to use default value defined in receiver
)

type translator struct {
Expand All @@ -42,7 +41,7 @@
return component.NewIDWithName(t.factory.Type(), t.name)
}

// Translate creates an aws container insights receiver config if either
// Translate creates an aws container insights kueue receiver config if either
// of the sections defined in the services exist.
func (t *translator) Translate(conf *confmap.Conf) (component.Config, error) {
cfg := t.factory.CreateDefaultConfig().(*awscontainerinsightskueuereceiver.Config)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func TestTranslator(t *testing.T) {
},
isSystemd: true,
want: &awscontainerinsightskueuereceiver.Config{
CollectionInterval: 60 * time.Second,
CollectionInterval: defaultMetricsCollectionInterval,
ClusterName: "TestCluster",
},
},
Expand Down
Loading