From 876442aceff0fae55e59a47aeb7c6bcf4fede8c6 Mon Sep 17 00:00:00 2001 From: Kulwant Singh Date: Fri, 1 Mar 2024 08:36:27 -0800 Subject: [PATCH] Fix hcsshim.ProcessStat undefined issue 1. Add windows build tag to fix building cw agent on Windows 2. Downgrade internal/aws/containerinsight from 0.92 0.89 3. Separate unit tests in util.go specific for Windows 4. Fix util unit tests applicable for Windows 5. Fix goporto issue 6. Fix lint issue --- cmd/configschema/go.mod | 3 +++ cmd/configschema/go.sum | 6 ++++- cmd/otelcontribcol/go.mod | 2 +- go.mod | 2 +- internal/aws/containerinsight/utils_test.go | 12 --------- .../containerinsight/utils_windows_tests.go | 21 +++++++++++++++ internal/aws/k8s/go.mod | 5 +++- internal/aws/k8s/go.sum | 6 +++++ internal/kubelet/client_test.go | 26 ------------------- internal/kubelet/go.mod | 2 +- internal/kubelet/go.sum | 1 - receiver/awscontainerinsightreceiver/go.mod | 2 +- .../cadvisor/extractors/extractorhelpers.go | 2 +- .../k8swindows/extractors/cpu_extractor.go | 8 +++++- .../extractors/cpu_extractor_test.go | 6 +++++ .../k8swindows/extractors/extractor.go | 8 +++++- .../k8swindows/extractors/extractorhelpers.go | 8 +++++- .../extractors/extractorhelpers_test.go | 6 +++++ .../k8swindows/extractors/fs_extractor.go | 5 +++- .../extractors/fs_extractor_test.go | 3 +++ .../k8swindows/extractors/mem_extractor.go | 5 +++- .../extractors/mem_extractor_test.go | 3 +++ .../k8swindows/extractors/net_extractor.go | 5 +++- .../extractors/net_extractor_test.go | 3 +++ .../internal/k8swindows/hcsshim/client.go | 8 +++++- .../internal/k8swindows/hcsshim/hcsshim.go | 5 +++- .../k8swindows/hcsshim/hcsshim_test.go | 6 +++++ .../internal/k8swindows/kubelet/client.go | 2 +- .../internal/k8swindows/kubelet/kubelet.go | 2 +- .../internal/k8swindows/testutils/helpers.go | 2 +- receiver/kubeletstatsreceiver/go.mod | 4 ++- receiver/kubeletstatsreceiver/go.sum | 3 ++- 32 files changed, 123 insertions(+), 59 deletions(-) create mode 100644 internal/aws/containerinsight/utils_windows_tests.go diff --git a/cmd/configschema/go.mod b/cmd/configschema/go.mod index 13786ac1a42a..959c5c580fa1 100644 --- a/cmd/configschema/go.mod +++ b/cmd/configschema/go.mod @@ -243,6 +243,7 @@ require ( github.com/IBM/sarama v1.42.1 // indirect github.com/JohnCGriffin/overflow v0.0.0-20211019200055-46fa312c352c // indirect github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/Microsoft/hcsshim v0.11.4 // indirect github.com/ReneKroon/ttlcache/v2 v2.11.0 // indirect github.com/SAP/go-hdb v1.6.2 // indirect github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2 // indirect @@ -297,8 +298,10 @@ require ( github.com/cloudfoundry-incubator/uaago v0.0.0-20190307164349-8136b7bbe76e // indirect github.com/cncf/udpa/go v0.0.0-20220112060539-c52dc94e7fbe // indirect github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 // indirect + github.com/containerd/cgroups v1.1.0 // indirect github.com/containerd/cgroups/v3 v3.0.2 // indirect github.com/containerd/console v1.0.3 // indirect + github.com/containerd/containerd v1.7.7 // indirect github.com/containerd/ttrpc v1.2.2 // indirect github.com/coreos/go-oidc v2.2.1+incompatible // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect diff --git a/cmd/configschema/go.sum b/cmd/configschema/go.sum index 31cbeb61f85a..00d466f860ab 100644 --- a/cmd/configschema/go.sum +++ b/cmd/configschema/go.sum @@ -225,7 +225,8 @@ github.com/Microsoft/go-winio v0.4.14/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jB github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= -github.com/Microsoft/hcsshim v0.11.1 h1:hJ3s7GbWlGK4YVV92sO88BQSyF4ZLVy7/awqOlPxFbA= +github.com/Microsoft/hcsshim v0.11.4 h1:68vKo2VN8DE9AdN4tnkWnmdhqdbpUFM8OF3Airm7fz8= +github.com/Microsoft/hcsshim v0.11.4/go.mod h1:smjE4dvqPX9Zldna+t5FG3rnoHhaB7QYxPRqGcpAD9w= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/Netflix/go-env v0.0.0-20220526054621-78278af1949d h1:wvStE9wLpws31NiWUx+38wny1msZ/tm+eL5xmm4Y7So= github.com/Netflix/go-env v0.0.0-20220526054621-78278af1949d/go.mod h1:9XMFaCeRyW7fC9XJOWQ+NdAv8VLG7ys7l3x4ozEGLUQ= @@ -455,11 +456,14 @@ github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4 h1:/inchEIKaYC1Akx+H+g github.com/cncf/xds/go v0.0.0-20230607035331-e9ce68804cb4/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/cockroachdb/apd v1.1.0 h1:3LFP3629v+1aKXU5Q37mxmRxX/pIu1nijXydLShEq5I= github.com/cockroachdb/apd v1.1.0/go.mod h1:8Sl8LxpKi29FqWXR16WEFZRNSz3SoPzUzeMeY4+DwBQ= +github.com/containerd/cgroups v1.1.0 h1:v8rEWFl6EoqHB+swVNjVoCJE8o3jX7e8nqBGPLaDFBM= +github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHqJDGwsa1mIw= github.com/containerd/cgroups/v3 v3.0.2 h1:f5WFqIVSgo5IZmtTT3qVBo6TzI1ON6sycSBKkymb9L0= github.com/containerd/cgroups/v3 v3.0.2/go.mod h1:JUgITrzdFqp42uI2ryGA+ge0ap/nxzYgkGmIcetmErE= github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/containerd v1.7.7 h1:QOC2K4A42RQpcrZyptP6z9EJZnlHfHJUfZrAAHe15q4= +github.com/containerd/containerd v1.7.7/go.mod h1:3c4XZv6VeT9qgf9GMTxNTMFxGJrGpI2vz1yk4ye+YY8= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/ttrpc v1.2.2 h1:9vqZr0pxwOF5koz6N0N3kJ0zDHokrcPxIR/ZR2YFtOs= github.com/containerd/ttrpc v1.2.2/go.mod h1:sIT6l32Ph/H9cvnJsfXM5drIVzTr5A2flTf1G5tYZak= diff --git a/cmd/otelcontribcol/go.mod b/cmd/otelcontribcol/go.mod index 3470ebfb2ef5..bbf7730c1350 100644 --- a/cmd/otelcontribcol/go.mod +++ b/cmd/otelcontribcol/go.mod @@ -523,7 +523,7 @@ require ( github.com/nginxinc/nginx-prometheus-exporter v0.8.1-0.20201110005315-f5a5f8086c19 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.89.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.92.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.89.0 // indirect diff --git a/go.mod b/go.mod index d4729392f2ef..9060353233ae 100644 --- a/go.mod +++ b/go.mod @@ -498,7 +498,7 @@ require ( github.com/nginxinc/nginx-prometheus-exporter v0.8.1-0.20201110005315-f5a5f8086c19 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/extension/observer v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.89.0 // indirect - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.92.0 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/cwlogs v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/ecsutil v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.89.0 // indirect diff --git a/internal/aws/containerinsight/utils_test.go b/internal/aws/containerinsight/utils_test.go index e1c782dbcf70..124aa1d22c70 100644 --- a/internal/aws/containerinsight/utils_test.go +++ b/internal/aws/containerinsight/utils_test.go @@ -5,7 +5,6 @@ package containerinsight import ( "fmt" "log" - "os" "strconv" "strings" "testing" @@ -867,14 +866,3 @@ func TestConvertToOTLPMetricsForPodContainerStatusMetrics(t *testing.T) { md = ConvertToOTLPMetrics(fields, tags, zap.NewNop()) checkMetricsAreExpected(t, md, fields, tags, expectedUnits) } - -func TestHostProcessContainer(t *testing.T) { - os.Setenv(RunInContainer, "True") - assert.Equal(t, IsWindowsHostProcessContainer(), false) - - os.Setenv(RunAsHostProcessContainer, "True") - assert.Equal(t, IsWindowsHostProcessContainer(), true) - - os.Unsetenv(RunInContainer) - os.Unsetenv(RunAsHostProcessContainer) -} diff --git a/internal/aws/containerinsight/utils_windows_tests.go b/internal/aws/containerinsight/utils_windows_tests.go new file mode 100644 index 000000000000..59c55b071778 --- /dev/null +++ b/internal/aws/containerinsight/utils_windows_tests.go @@ -0,0 +1,21 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + +package containerinsight // import "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight" + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestHostProcessContainer(t *testing.T) { + t.Setenv(RunInContainer, "True") + assert.Equal(t, IsWindowsHostProcessContainer(), false) + + t.Setenv(RunAsHostProcessContainer, "True") + assert.Equal(t, IsWindowsHostProcessContainer(), true) +} diff --git a/internal/aws/k8s/go.mod b/internal/aws/k8s/go.mod index 9171fdcf1d32..15a5616158cf 100644 --- a/internal/aws/k8s/go.mod +++ b/internal/aws/k8s/go.mod @@ -4,12 +4,12 @@ go 1.20 require ( github.com/aws/aws-sdk-go v1.47.10 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 github.com/stretchr/testify v1.8.4 go.uber.org/zap v1.26.0 k8s.io/api v0.28.3 k8s.io/apimachinery v0.28.3 k8s.io/client-go v0.28.3 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 ) require ( @@ -37,6 +37,7 @@ require ( github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + go.opentelemetry.io/collector/pdata v1.0.0-rcv0018 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/net v0.18.0 // indirect golang.org/x/oauth2 v0.14.0 // indirect @@ -45,6 +46,8 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.4.0 // indirect google.golang.org/appengine v1.6.7 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d // indirect + google.golang.org/grpc v1.59.0 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/internal/aws/k8s/go.sum b/internal/aws/k8s/go.sum index f60cc439eae9..52e81db8f279 100644 --- a/internal/aws/k8s/go.sum +++ b/internal/aws/k8s/go.sum @@ -82,6 +82,8 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/collector/pdata v1.0.0-rcv0018 h1:a2IHOZKphRzPagcvOHQHHUE0DlITFSKlIBwaWhPZpl4= +go.opentelemetry.io/collector/pdata v1.0.0-rcv0018/go.mod h1:oNIcTRyEJYIfMcRYyyh5lquDU0Vl+ktTL6ka+p+dYvg= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= @@ -129,6 +131,10 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.6.7 h1:FZR1q0exgwxzPzp/aF+VccGrSfxfPpkBqjIIEq3ru6c= google.golang.org/appengine v1.6.7/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= +google.golang.org/grpc v1.59.0 h1:Z5Iec2pjwb+LEOqzpB2MR12/eKFhDPhuqW91O+4bwUk= +google.golang.org/grpc v1.59.0/go.mod h1:aUPDwccQo6OTjy7Hct4AfBPD1GptF4fyUjIkQ9YtF98= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= diff --git a/internal/kubelet/client_test.go b/internal/kubelet/client_test.go index 5b960743a53b..ed43f998c7ba 100644 --- a/internal/kubelet/client_test.go +++ b/internal/kubelet/client_test.go @@ -73,32 +73,6 @@ func TestNewTLSClientProvider(t *testing.T) { require.NotNil(t, tcc.RootCAs) } -func TestSAPathInHostProcessContainer(t *testing.T) { - // todo: Remove this workaround func when Windows AMIs has containerd 1.7 which solves upstream bug. - - // Test default SA cert and token. - assert.Equal(t, svcAcctCACertPath, "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt") - assert.Equal(t, svcAcctTokenPath, "/var/run/secrets/kubernetes.io/serviceaccount/token") - - // Test SA cert and token when run inside container. - os.Setenv(containerinsight.RunInContainer, "True") - updateSVCPath() - assert.Equal(t, svcAcctCACertPath, "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt") - assert.Equal(t, svcAcctTokenPath, "/var/run/secrets/kubernetes.io/serviceaccount/token") - - // Test SA cert and token when run inside host process container. - os.Setenv(containerinsight.RunAsHostProcessContainer, "True") - os.Setenv("CONTAINER_SANDBOX_MOUNT_POINT", "test123456") - updateSVCPath() - assert.Equal(t, svcAcctCACertPath, "test123456/var/run/secrets/kubernetes.io/serviceaccount/ca.crt") - assert.Equal(t, svcAcctTokenPath, "test123456/var/run/secrets/kubernetes.io/serviceaccount/token") - - os.Unsetenv("CONTAINER_SANDBOX_MOUNT_POINT") - os.Unsetenv(containerinsight.RunInContainer) - os.Unsetenv(containerinsight.RunAsHostProcessContainer) - updateSVCPath() -} - func TestNewSAClientProvider(t *testing.T) { p, err := NewClientProvider("localhost:9876", &ClientConfig{ APIConfig: k8sconfig.APIConfig{ diff --git a/internal/kubelet/go.mod b/internal/kubelet/go.mod index 0c360e49dda1..5ebcbd19a428 100644 --- a/internal/kubelet/go.mod +++ b/internal/kubelet/go.mod @@ -3,7 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubele go 1.20 require ( - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.92.0 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.89.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.89.0 github.com/stretchr/testify v1.8.4 diff --git a/internal/kubelet/go.sum b/internal/kubelet/go.sum index 43e990b84bda..86eff42702a5 100644 --- a/internal/kubelet/go.sum +++ b/internal/kubelet/go.sum @@ -440,7 +440,6 @@ google.golang.org/genproto v0.0.0-20200212174721-66ed5ce911ce/go.mod h1:55QSHmfG google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200305110556-506484158171/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20230822172742-b8732ec3820d h1:VBu5YqKPv6XiJ199exd8Br+Aetz+o08F+PLMnwJQHAY= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d h1:uvYuEyMHKNt+lT4K3bN6fGswmK8qSvcreM3BwjDh+y4= google.golang.org/genproto/googleapis/rpc v0.0.0-20230822172742-b8732ec3820d/go.mod h1:+Bk1OCOj40wS2hwAMA+aCW9ypzm63QTBBHp6lQ3p+9M= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= diff --git a/receiver/awscontainerinsightreceiver/go.mod b/receiver/awscontainerinsightreceiver/go.mod index 2e978a4a6cd4..1ec4b2aac11f 100644 --- a/receiver/awscontainerinsightreceiver/go.mod +++ b/receiver/awscontainerinsightreceiver/go.mod @@ -9,7 +9,7 @@ require ( github.com/go-kit/log v0.2.1 github.com/google/cadvisor v0.48.1 github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil v0.89.0 - github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.92.0 + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/k8s v0.89.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/metrics v0.89.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.89.0 diff --git a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractorhelpers.go b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractorhelpers.go index b0f6985d102b..066de9381fb3 100644 --- a/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractorhelpers.go +++ b/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors/extractorhelpers.go @@ -1,7 +1,7 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package extractors +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors" import ( "fmt" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor.go index 09b00c540b5f..b4b3ac104524 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor.go @@ -1,4 +1,10 @@ -package extractors +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors" import ( ci "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor_test.go index b172348ac9ab..6a62e55d312d 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/cpu_extractor_test.go @@ -1,3 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + package extractors import ( diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractor.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractor.go index 4ebfa6cf7b1c..a2ad47948244 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractor.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractor.go @@ -1,4 +1,10 @@ -package extractors +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors" import ( "time" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers.go index df888ca3e97c..469c30b9bc46 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers.go @@ -1,4 +1,10 @@ -package extractors +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors" import ( "fmt" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers_test.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers_test.go index c86a2d1c9116..212b76d717a5 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers_test.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/extractorhelpers_test.go @@ -1,3 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + package extractors import ( diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor.go index b77c90ff6db6..ef367cf80e10 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor.go @@ -1,7 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors" +//go:build windows +// +build windows + +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors" import ( ci "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor_test.go index 8ea57e92d8c0..6ea6d7e0fafc 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/fs_extractor_test.go @@ -1,6 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +//go:build windows +// +build windows + package extractors import ( diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor.go index fb8786e4526b..2290dd5641b3 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor.go @@ -1,7 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors" +//go:build windows +// +build windows + +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors" import ( "time" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor_test.go index abf06ae4b438..760973792e5a 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/mem_extractor_test.go @@ -1,6 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +//go:build windows +// +build windows + package extractors import ( diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor.go index 30ec0fa94c30..ca5366c35912 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor.go @@ -1,7 +1,10 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 -package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/cadvisor/extractors" +//go:build windows +// +build windows + +package extractors // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors" import ( "time" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor_test.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor_test.go index 2ad55976c3f5..187132cb1465 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor_test.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/extractors/net_extractor_test.go @@ -1,6 +1,9 @@ // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 +//go:build windows +// +build windows + package extractors import ( diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/client.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/client.go index ec7baf990562..5ba0976fe720 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/client.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/client.go @@ -1,4 +1,10 @@ -package hcsshim +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + +package hcsshim // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim" import ( "fmt" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim.go index eb47bd840d31..011f46614285 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim.go @@ -1,7 +1,10 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + //go:build windows // +build windows -package hcsshim // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8s_windox2" +package hcsshim // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim" import ( "fmt" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim_test.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim_test.go index 39e52a359785..e0bd1af8c0cc 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim_test.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/hcsshim/hcsshim_test.go @@ -1,3 +1,9 @@ +// Copyright The OpenTelemetry Authors +// SPDX-License-Identifier: Apache-2.0 + +//go:build windows +// +build windows + package hcsshim import ( diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/client.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/client.go index d470b2f7175b..2209a9133b36 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/client.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/client.go @@ -1,7 +1,7 @@ //go:build windows // +build windows -package kubelet +package kubelet // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet" import ( "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/stores/kubeletutil" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/kubelet.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/kubelet.go index 1fedf7c02236..cdf0647c8ce9 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/kubelet.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet/kubelet.go @@ -4,7 +4,7 @@ //go:build windows // +build windows -package kubelet // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows" +package kubelet // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/kubelet" import ( "fmt" diff --git a/receiver/awscontainerinsightreceiver/internal/k8swindows/testutils/helpers.go b/receiver/awscontainerinsightreceiver/internal/k8swindows/testutils/helpers.go index 66f828c91ba5..8a2e30014223 100644 --- a/receiver/awscontainerinsightreceiver/internal/k8swindows/testutils/helpers.go +++ b/receiver/awscontainerinsightreceiver/internal/k8swindows/testutils/helpers.go @@ -1,4 +1,4 @@ -package testutils +package testutils // import "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/awscontainerinsightreceiver/internal/k8swindows/testutils" import ( "encoding/json" diff --git a/receiver/kubeletstatsreceiver/go.mod b/receiver/kubeletstatsreceiver/go.mod index 14ddfcda754e..34b76ca1fe0d 100644 --- a/receiver/kubeletstatsreceiver/go.mod +++ b/receiver/kubeletstatsreceiver/go.mod @@ -28,7 +28,6 @@ require ( ) require ( - cloud.google.com/go/compute/metadata v0.2.4-0.20230617002413-005d2dfb6b68 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/Microsoft/go-winio v0.6.1 // indirect github.com/cespare/xxhash/v2 v2.2.0 // indirect @@ -67,6 +66,7 @@ require ( github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mostynb/go-grpc-compression v1.2.2 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/internal/common v0.89.0 // indirect github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.89.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect @@ -124,6 +124,8 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sco replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/kubelet => ../../internal/kubelet +replace github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight => ./../../internal/aws/containerinsight + // openshift removed all tags from their repo, use the pseudoversion from the release-3.9 branch HEAD replace github.com/openshift/api v3.9.0+incompatible => github.com/openshift/api v0.0.0-20180801171038-322a19404e37 diff --git a/receiver/kubeletstatsreceiver/go.sum b/receiver/kubeletstatsreceiver/go.sum index e2949b793bf6..9dec1998a7ad 100644 --- a/receiver/kubeletstatsreceiver/go.sum +++ b/receiver/kubeletstatsreceiver/go.sum @@ -15,7 +15,6 @@ cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNF cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= cloud.google.com/go/compute v1.23.0 h1:tP41Zoavr8ptEqaW6j+LQOnyBBhO7OkOMAGrgLopTwY= cloud.google.com/go/compute/metadata v0.2.4-0.20230617002413-005d2dfb6b68 h1:aRVqY1p2IJaBGStWMsQMpkAa83cPkCDLl80eOj0Rbz4= -cloud.google.com/go/compute/metadata v0.2.4-0.20230617002413-005d2dfb6b68/go.mod h1:1a3eRNYX12fs5UABBIXS8HXVvQbX9hRB/RkEBPORpe8= cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE= cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk= cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I= @@ -253,6 +252,8 @@ github.com/onsi/ginkgo/v2 v2.9.4 h1:xR7vG4IXt5RWx6FfIjyAtsoMAtnc3C/rFXBBd2AjZwE= github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.7.0/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.27.6 h1:ENqfyGeS5AX/rlXDd/ETokDz93u0YufY1Pgxuy/PvWE= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0 h1:RJ4cyDlQsIsIcezZX10wGE/IeIzIMfrhvKUbqN/MOgQ= +github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/containerinsight v0.89.0/go.mod h1:Xg5sUWQEuVshBnsZB7wxGDLf5DfzAqnFZGVbMHvoaj8= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0-rc4 h1:oOxKUJWnFC4YGHCCMNql1x4YaDfYBTS5Y4x/Cgeo1E0=