From da7a5d00365ab81c782d6813e9ce622a99f61be8 Mon Sep 17 00:00:00 2001 From: Dmitry Anoshin Date: Mon, 27 Mar 2023 20:11:54 -0700 Subject: [PATCH] [chore] [processor/k8sattributes] Rework Kubernetes e2e tests Update Kubernetes end-to-end tests applying the following enhancements: - Make it possible to run tests locally. Keep only kind cluster and pre-built image as the test prerequisites. - Remove dependency on the helm chart, install only required k8s objects from pre-defined manifests. - Remove the OTLP json files as a medium and send OTLP metrics/traces/logs directly to the consumers spun up in the test. - Remove statically set `k8s.containet.restart_count` attribute to reduce flakiness. Let the processor use the latest container instead. - Combine separate tests for traces, metrics and logs into one to reduce execution time. - Make the test faster by waiting for predefined number of metrics/traces/logs instead of static sleep time. --- .github/workflows/e2e-tests.yml | 69 +- .../e2e/k8s/collector-helm-values.yml | 79 -- .../e2e/k8s/telemetrygen-daemonset.yml | 36 - .../workflows/e2e/k8s/telemetrygen-job.yml | 34 - .../e2e/k8s/telemetrygen-statefulset.yml | 40 - cmd/configschema/go.sum | 4 +- cmd/otelcontribcol/go.sum | 4 +- exporter/datadogexporter/go.mod | 8 +- exporter/datadogexporter/go.sum | 24 +- go.sum | 4 +- processor/k8sattributesprocessor/e2e_test.go | 835 ++++++++++-------- processor/k8sattributesprocessor/go.mod | 29 +- processor/k8sattributesprocessor/go.sum | 88 +- .../testdata/e2e/collector/clusterrole.yaml | 8 + .../e2e/collector/clusterrolebinding.yaml | 12 + .../testdata/e2e/collector/configmap.yaml | 77 ++ .../testdata/e2e/collector/deployment.yaml | 57 ++ .../testdata/e2e/collector/service.yaml | 16 + .../e2e/collector/serviceaccount.yaml | 5 + .../testdata/e2e/telemetrygen/daemonset.yaml | 29 + .../testdata/e2e/telemetrygen/deployment.yaml | 19 +- .../testdata/e2e/telemetrygen/job.yaml | 26 + .../e2e/telemetrygen/statefulset.yaml | 31 + 23 files changed, 892 insertions(+), 642 deletions(-) delete mode 100644 .github/workflows/e2e/k8s/collector-helm-values.yml delete mode 100644 .github/workflows/e2e/k8s/telemetrygen-daemonset.yml delete mode 100644 .github/workflows/e2e/k8s/telemetrygen-job.yml delete mode 100644 .github/workflows/e2e/k8s/telemetrygen-statefulset.yml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/collector/clusterrole.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/collector/clusterrolebinding.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/collector/configmap.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/collector/deployment.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/collector/service.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/collector/serviceaccount.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/telemetrygen/daemonset.yaml rename .github/workflows/e2e/k8s/telemetrygen-deployment.yml => processor/k8sattributesprocessor/testdata/e2e/telemetrygen/deployment.yaml (53%) create mode 100644 processor/k8sattributesprocessor/testdata/e2e/telemetrygen/job.yaml create mode 100644 processor/k8sattributesprocessor/testdata/e2e/telemetrygen/statefulset.yaml diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 94ce47ce85d5..883faf3182d1 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -10,7 +10,9 @@ on: jobs: kubernetes-test: - strategy: + env: + KUBECONFIG: /tmp/kube-config-otelcol-e2e-testing + strategy: matrix: k8s-version: ["v1.26.0", "v1.25.3", "v1.24.7", "v1.23.13"] runs-on: ubuntu-latest @@ -30,78 +32,19 @@ jobs: - name: Install dependencies if: steps.go-cache.outputs.cache-hit != 'true' run: make -j2 gomoddownload - - name: Build Collector - run: make otelcontribcol - name: Build Docker Image run: | make docker-otelcontribcol - docker tag otelcontribcol:latest otel/opentelemetry-collector-contrib-dev:$GITHUB_SHA - - name: Set up Helm - uses: azure/setup-helm@v3.5 - with: - version: v3.9.0 - - name: Set up chart-testing - uses: helm/chart-testing-action@v2.3.1 - name: Create kind cluster uses: helm/kind-action@v1.5.0 with: node_image: kindest/node:${{ matrix.k8s-version }} kubectl_version: ${{ matrix.k8s-version }} - - name: Check kind - run: | - kubectl cluster-info --context kind-chart-testing - kubectl get node - docker ps -a --filter label=io.x-k8s.kind.cluster=chart-testing + cluster_name: kind - name: Kind load image run: | - kind load docker-image otel/opentelemetry-collector-contrib-dev:$GITHUB_SHA --name chart-testing - - name: Add Dependencies - shell: bash - run: | - helm repo add open-telemetry https://open-telemetry.github.io/opentelemetry-helm-charts - - uses: actions/checkout@v3 - with: - repository: 'open-telemetry/opentelemetry-helm-charts' - path: opentelemetry-helm-charts - - name: Helm install collector - run: helm install test --set image.tag=$GITHUB_SHA -f .github/workflows/e2e/k8s/collector-helm-values.yml opentelemetry-helm-charts/charts/opentelemetry-collector - - name: check collector status - run: | - kubectl wait --for=condition=Ready --timeout=60s pod/test-opentelemetry-collector-0 - - name: start telemetrygen job for trace, metric, log - run: | - sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-job.yml | kubectl -n default create -f - - - name: check telemetrygen job status - run: | - kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-traces-job - kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-metrics-job - kubectl wait --for=condition=Complete --timeout=60s job/telemetrygen-logs-job - - name: start telemetrygen statefulset for trace, metric, log - run: | - sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-statefulset.yml | kubectl -n default create -f - - - name: start telemetrygen deployment for trace, metric, log - run: | - sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-deployment.yml | kubectl -n default create -f - - - name: start telemetrygen daemonset for trace, metric, log - run: | - sed 's/DATA_TYPE/traces/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/metrics/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f - - sed 's/DATA_TYPE/logs/g' .github/workflows/e2e/k8s/telemetrygen-daemonset.yml | kubectl -n default create -f - - - name: wait telemetrygen statefulset/deployment/daemonset to generate trace and metric, log - run: | - sleep 30 - - name: copy telemetry trace, metric, log data output - run: | - kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/trace.json processor/k8sattributesprocessor/testdata/trace.json - kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/metric.json processor/k8sattributesprocessor/testdata/metric.json - kubectl cp -c filecp default/test-opentelemetry-collector-0:tmp/log.json processor/k8sattributesprocessor/testdata/log.json - - name: run e2e test to check output + kind load docker-image otelcontribcol:latest --name kind + - name: run e2e tests run: | cd processor/k8sattributesprocessor go test -v --tags=e2e diff --git a/.github/workflows/e2e/k8s/collector-helm-values.yml b/.github/workflows/e2e/k8s/collector-helm-values.yml deleted file mode 100644 index 49f80f6860fe..000000000000 --- a/.github/workflows/e2e/k8s/collector-helm-values.yml +++ /dev/null @@ -1,79 +0,0 @@ -mode: "statefulset" - -presets: - kubernetesAttributes: - enabled: true - -config: - processors: - k8sattributes: - extract: - metadata: - - "k8s.pod.name" - - "k8s.pod.start_time" - - "k8s.pod.uid" - - "k8s.namespace.name" - - "k8s.deployment.name" - - "k8s.replicaset.name" - - "k8s.replicaset.uid" - - "k8s.statefulset.name" - - "k8s.statefulset.uid" - - "k8s.daemonset.name" - - "k8s.daemonset.uid" - - "k8s.cronjob.name" - - "k8s.job.name" - - "k8s.job.uid" - - "k8s.node.name" - - "container.id" - - "container.image.name" - - "container.image.tag" - annotations: - - tag_name: "k8s.annotations.workload" - key: "workload" - from: pod - labels: - - tag_name: "k8s.labels.app" - key: "app" - from: pod - exporters: - logging: {} - file/trace: - path: /tmp/trace.json - file/metric: - path: /tmp/metric.json - file/log: - path: /tmp/log.json - service: - pipelines: - traces: - exporters: - - file/trace - metrics: - exporters: - - file/metric - logs: - exporters: - - file/log - - -image: - repository: otel/opentelemetry-collector-contrib-dev - tag: "latest" - -command: - name: otelcontribcol - -extraVolumes: -- name: filevolume - emptyDir: {} -extraVolumeMounts: -- mountPath: /tmp - name: filevolume - -extraContainers: -- name: filecp - image: busybox - command: ["sh", "-c", "sleep 36000"] - volumeMounts: - - name: filevolume - mountPath: /tmp diff --git a/.github/workflows/e2e/k8s/telemetrygen-daemonset.yml b/.github/workflows/e2e/k8s/telemetrygen-daemonset.yml deleted file mode 100644 index da4a0006f812..000000000000 --- a/.github/workflows/e2e/k8s/telemetrygen-daemonset.yml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: apps/v1 -kind: DaemonSet -metadata: - name: telemetrygen-DATA_TYPE-daemonset -spec: - selector: - matchLabels: - app: telemetrygen-DATA_TYPE-daemonset - template: - metadata: - annotations: - workload: daemonset - labels: - app: telemetrygen-DATA_TYPE-daemonset - spec: - containers: - - command: - - /telemetrygen - - DATA_TYPE - - --otlp-insecure - - --otlp-endpoint=test-opentelemetry-collector:4317 - - --duration=36000s - - --rate=1 - - --otlp-attributes=service.name="test-daemonset" - - --otlp-attributes=k8s.container.name="telemetrygen" - - --otlp-attributes=k8s.container.restart_count="0" - image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest - imagePullPolicy: IfNotPresent - name: telemetrygen - resources: {} - securityContext: {} - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 \ No newline at end of file diff --git a/.github/workflows/e2e/k8s/telemetrygen-job.yml b/.github/workflows/e2e/k8s/telemetrygen-job.yml deleted file mode 100644 index 175641c958f9..000000000000 --- a/.github/workflows/e2e/k8s/telemetrygen-job.yml +++ /dev/null @@ -1,34 +0,0 @@ -apiVersion: batch/v1 -kind: Job -metadata: - name: telemetrygen-DATA_TYPE-job - namespace: default -spec: - template: - metadata: - annotations: - workload: job - labels: - app: telemetrygen-DATA_TYPE - spec: - containers: - - command: - - /telemetrygen - - DATA_TYPE - - --otlp-insecure - - --otlp-endpoint=test-opentelemetry-collector:4317 - - --DATA_TYPE=5 - - --rate=1 - - --otlp-attributes=service.name="test-job" - - --otlp-attributes=k8s.container.name="telemetrygen" - - --otlp-attributes=k8s.container.restart_count="0" - image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest - imagePullPolicy: IfNotPresent - name: telemetrygen - resources: {} - securityContext: {} - dnsPolicy: ClusterFirst - restartPolicy: Never - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 diff --git a/.github/workflows/e2e/k8s/telemetrygen-statefulset.yml b/.github/workflows/e2e/k8s/telemetrygen-statefulset.yml deleted file mode 100644 index af54e36e6eac..000000000000 --- a/.github/workflows/e2e/k8s/telemetrygen-statefulset.yml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: apps/v1 -kind: StatefulSet -metadata: - name: telemetrygen-DATA_TYPE-statefulset - namespace: default -spec: - serviceName: telemetrygen-DATA_TYPE-statefulset - replicas: 1 - selector: - matchLabels: - app: telemetrygen-DATA_TYPE-statefulset - template: - metadata: - metadata: - annotations: - workload: statefulset - labels: - app: telemetrygen-DATA_TYPE-statefulset - spec: - containers: - - command: - - /telemetrygen - - DATA_TYPE - - --otlp-insecure - - --otlp-endpoint=test-opentelemetry-collector:4317 - - --duration=36000s - - --rate=1 - - --otlp-attributes=service.name="test-statefulset" - - --otlp-attributes=k8s.container.name="telemetrygen" - - --otlp-attributes=k8s.container.restart_count="0" - image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest - imagePullPolicy: IfNotPresent - name: telemetrygen - resources: {} - securityContext: {} - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 \ No newline at end of file diff --git a/cmd/configschema/go.sum b/cmd/configschema/go.sum index 396b3da0053f..6cec727c5376 100644 --- a/cmd/configschema/go.sum +++ b/cmd/configschema/go.sum @@ -949,7 +949,7 @@ github.com/esimonov/ifshort v1.0.1/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+ github.com/euank/go-kmsg-parser v2.0.0+incompatible h1:cHD53+PLQuuQyLZeriD1V/esuG4MuU0Pjs5y6iknohY= github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/facebook/time v0.0.0-20220713225404-f7a0d7702d50 h1:3fALCgsB+zI8Bxlv4ph4lCgt1CEQHIdU5sWxbkaMkuc= github.com/facebook/time v0.0.0-20220713225404-f7a0d7702d50/go.mod h1:IQmM+Ezbn5X7gpDO0IjKU5RmW9xT1a19dLp+NbivoXE= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -3531,7 +3531,7 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 h1:umQdVO0Ytx+kYadhuJNjFtDgIsIEBnKrOTvNuu8ClKI= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0/go.mod h1:kx0CSMRpzEZfx/nFH62GLU4stZjparh/BRpM89t4XCQ= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/cmd/otelcontribcol/go.sum b/cmd/otelcontribcol/go.sum index 223d84ea852b..e9aa833afb6c 100644 --- a/cmd/otelcontribcol/go.sum +++ b/cmd/otelcontribcol/go.sum @@ -947,7 +947,7 @@ github.com/esimonov/ifshort v1.0.1/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+ github.com/euank/go-kmsg-parser v2.0.0+incompatible h1:cHD53+PLQuuQyLZeriD1V/esuG4MuU0Pjs5y6iknohY= github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/facebook/time v0.0.0-20220713225404-f7a0d7702d50 h1:3fALCgsB+zI8Bxlv4ph4lCgt1CEQHIdU5sWxbkaMkuc= github.com/facebook/time v0.0.0-20220713225404-f7a0d7702d50/go.mod h1:IQmM+Ezbn5X7gpDO0IjKU5RmW9xT1a19dLp+NbivoXE= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -3526,7 +3526,7 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 h1:umQdVO0Ytx+kYadhuJNjFtDgIsIEBnKrOTvNuu8ClKI= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0/go.mod h1:kx0CSMRpzEZfx/nFH62GLU4stZjparh/BRpM89t4XCQ= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/exporter/datadogexporter/go.mod b/exporter/datadogexporter/go.mod index 892d590fba87..5e81f620b84c 100644 --- a/exporter/datadogexporter/go.mod +++ b/exporter/datadogexporter/go.mod @@ -57,7 +57,7 @@ require ( github.com/DataDog/datadog-go/v5 v5.1.1 // indirect github.com/DataDog/go-tuf v0.3.0--fix-localmeta-fork // indirect github.com/DataDog/zstd v1.5.2 // indirect - github.com/Microsoft/go-winio v0.5.2 // indirect + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/Showmax/go-fqdn v1.0.0 // indirect github.com/antonmedv/expr v1.12.5 // indirect github.com/armon/go-metrics v0.3.10 // indirect @@ -73,7 +73,7 @@ require ( github.com/docker/distribution v2.8.1+incompatible // indirect github.com/docker/docker v23.0.3+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect - github.com/docker/go-units v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect github.com/fatih/color v1.13.0 // indirect @@ -105,7 +105,7 @@ require ( github.com/hashicorp/go-rootcerts v1.0.2 // indirect github.com/hashicorp/golang-lru v0.5.4 // indirect github.com/hashicorp/serf v0.10.1 // indirect - github.com/imdario/mergo v0.3.11 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/inconshreveable/mousetrap v1.0.1 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/josharian/intern v1.0.0 // indirect @@ -171,12 +171,14 @@ require ( go.opentelemetry.io/otel/sdk/metric v0.37.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/atomic v1.10.0 // indirect + golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/oauth2 v0.6.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/term v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.6.0 // indirect gonum.org/v1/gonum v0.12.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect diff --git a/exporter/datadogexporter/go.sum b/exporter/datadogexporter/go.sum index 61a5ac3420f6..6fea9516072f 100644 --- a/exporter/datadogexporter/go.sum +++ b/exporter/datadogexporter/go.sum @@ -87,8 +87,8 @@ github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.12.0 github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.12.0/go.mod h1:91Ho7IS7hEZHulDEI3PpRm1t+oStUt9Sh9ZSV21+k1U= github.com/Microsoft/go-winio v0.5.0/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= github.com/Microsoft/go-winio v0.5.1/go.mod h1:JPGBdM1cNvN/6ISo+n8V5iA4v8pBzdOpzfwIujj1a84= -github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA= -github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/Mottl/ctimefmt v0.0.0-20190803144728-fd2ac23a585a/go.mod h1:eyj2WSIdoPMPs2eNTLpSmM6Nzqo4V80/d6jHpnJ1SAI= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= @@ -175,8 +175,8 @@ github.com/docker/docker v23.0.3+incompatible h1:9GhVsShNWz1hO//9BNg/dpMnZW25Kyd github.com/docker/docker v23.0.3+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -193,7 +193,7 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.m github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= @@ -404,8 +404,8 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc= github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= @@ -498,7 +498,7 @@ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= -github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6 h1:dcztxKSvZ4Id8iPpHERQBbIJfabdt4wUm5qy3wOL2Zc= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -804,6 +804,8 @@ golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hM golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -875,6 +877,7 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1035,6 +1038,8 @@ golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.4.0/go.mod h1:UE5sM2OK9E/d67R0ANs2xJizIymRP5gJU295PvKXxjQ= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1163,11 +1168,12 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 h1:umQdVO0Ytx+kYadhuJNjFtDgIsIEBnKrOTvNuu8ClKI= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0/go.mod h1:kx0CSMRpzEZfx/nFH62GLU4stZjparh/BRpM89t4XCQ= -gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/go.sum b/go.sum index 31782786b49c..5a772d965c5b 100644 --- a/go.sum +++ b/go.sum @@ -951,7 +951,7 @@ github.com/esimonov/ifshort v1.0.1/go.mod h1:yZqNJUrNn20K8Q9n2CrjTKYyVEmX209Hgu+ github.com/euank/go-kmsg-parser v2.0.0+incompatible h1:cHD53+PLQuuQyLZeriD1V/esuG4MuU0Pjs5y6iknohY= github.com/euank/go-kmsg-parser v2.0.0+incompatible/go.mod h1:MhmAMZ8V4CYH4ybgdRwPr2TU5ThnS43puaKEMpja1uw= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= github.com/facebook/time v0.0.0-20220713225404-f7a0d7702d50 h1:3fALCgsB+zI8Bxlv4ph4lCgt1CEQHIdU5sWxbkaMkuc= github.com/facebook/time v0.0.0-20220713225404-f7a0d7702d50/go.mod h1:IQmM+Ezbn5X7gpDO0IjKU5RmW9xT1a19dLp+NbivoXE= github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A= @@ -3534,7 +3534,7 @@ gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0 h1:umQdVO0Ytx+kYadhuJNjFtDgIsIEBnKrOTvNuu8ClKI= gopkg.in/zorkian/go-datadog-api.v2 v2.30.0/go.mod h1:kx0CSMRpzEZfx/nFH62GLU4stZjparh/BRpM89t4XCQ= gotest.tools/v3 v3.0.2/go.mod h1:3SzNCllyD9/Y+b5r9JIKQ474KzkZyqLqEfYqMsX94Bk= -gotest.tools/v3 v3.2.0 h1:I0DwBVMGAx26dttAj1BtJLAkVGncrkkUXfJLC4Flt/I= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/processor/k8sattributesprocessor/e2e_test.go b/processor/k8sattributesprocessor/e2e_test.go index 12ca18938069..f7e815899952 100644 --- a/processor/k8sattributesprocessor/e2e_test.go +++ b/processor/k8sattributesprocessor/e2e_test.go @@ -18,18 +18,37 @@ package k8sattributesprocessor import ( - "bufio" + "bytes" + "context" "fmt" "os" + "path/filepath" "regexp" + "runtime" + "strings" "testing" + "text/template" + "time" + "github.com/docker/docker/api/types" + docker "github.com/docker/docker/client" + "github.com/google/uuid" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "go.opentelemetry.io/collector/component" + "go.opentelemetry.io/collector/component/componenttest" + "go.opentelemetry.io/collector/consumer/consumertest" "go.opentelemetry.io/collector/pdata/pcommon" - "go.opentelemetry.io/collector/pdata/plog" - "go.opentelemetry.io/collector/pdata/pmetric" - "go.opentelemetry.io/collector/pdata/ptrace" + "go.opentelemetry.io/collector/receiver/otlpreceiver" + "go.opentelemetry.io/collector/receiver/receivertest" "go.uber.org/multierr" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/runtime/serializer/yaml" + "k8s.io/client-go/dynamic" + "k8s.io/client-go/tools/clientcmd" ) const ( @@ -38,6 +57,8 @@ const ( exist ) +const testKubeConfig = "/tmp/kube-config-otelcol-e2e-testing" + type expectedValue struct { mode int value string @@ -50,139 +71,374 @@ func newExpectedValue(mode int, value string) *expectedValue { } } -func TestTraceE2E(t *testing.T) { +// TestE2E tests the k8s attributes processor with a real k8s cluster. +// The test requires a prebuilt otelcontribcol image uploaded to a kind k8s cluster defined in +// `/tmp/kube-config-otelcol-e2e-testing`. Run the following command prior to running the test locally: +// +// kind create cluster --kubeconfig=/tmp/kube-config-otelcol-e2e-testing +// make docker-otelcontribcol +// KUBECONFIG=/tmp/kube-config-otelcol-e2e-testing kind load docker-image otelcontribcol:latest +func TestE2E(t *testing.T) { + kubeConfig, err := clientcmd.BuildConfigFromFlags("", testKubeConfig) + require.NoError(t, err) + dynamicClient, err := dynamic.NewForConfig(kubeConfig) + require.NoError(t, err) + + testID := uuid.NewString()[:8] + collectorObjs := createCollectorObjects(t, dynamicClient, testID) + telemetryGenObjs := createTelemetryGenObjects(t, dynamicClient, testID) + defer func() { + for _, obj := range append(collectorObjs, telemetryGenObjs...) { + require.NoErrorf(t, deleteObject(dynamicClient, obj), "failed to delete object %s", obj.GetName()) + } + }() + + metricsConsumer := new(consumertest.MetricsSink) + tracesConsumer := new(consumertest.TracesSink) + logsConsumer := new(consumertest.LogsSink) + wantEntries := 128 // Minimal number of metrics/traces/logs to wait for. + waitForData(t, wantEntries, metricsConsumer, tracesConsumer, logsConsumer) + tcs := []struct { - name string - service string - attrs map[string]*expectedValue + name string + dataType component.DataType + service string + attrs map[string]*expectedValue }{ { - name: "job", - service: "test-job", + name: "traces-job", + dataType: component.DataTypeTraces, + service: "test-traces-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "traces-statefulset", + dataType: component.DataTypeTraces, + service: "test-traces-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "traces-deployment", + dataType: component.DataTypeTraces, + service: "test-traces-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-deployment"), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "traces-daemonset", + dataType: component.DataTypeTraces, + service: "test-traces-daemonset", attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-traces-job-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.job.name": newExpectedValue(equal, "telemetrygen-traces-job"), - "k8s.job.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "job"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-traces"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-traces-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-traces-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), }, }, { - name: "statefulset", - service: "test-statefulset", + name: "metrics-job", + dataType: component.DataTypeMetrics, + service: "test-metrics-job", attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(equal, "telemetrygen-traces-statefulset-0"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-traces-statefulset"), - "k8s.statefulset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-traces-statefulset"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), }, }, { - name: "deployment", - service: "test-deployment", + name: "metrics-statefulset", + dataType: component.DataTypeMetrics, + service: "test-metrics-statefulset", attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-traces-deployment-[a-z0-9]*-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-traces-deployment"), - "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-traces-deployment-[a-z0-9]*"), - "k8s.replicaset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "deployment"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-traces-deployment"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), }, }, { - name: "daemonset", - service: "test-daemonset", + name: "metrics-deployment", + dataType: component.DataTypeMetrics, + service: "test-metrics-deployment", attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-traces-daemonset-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-traces-daemonset"), - "k8s.daemonset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-traces-daemonset"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-deployment"), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "metrics-daemonset", + dataType: component.DataTypeMetrics, + service: "test-metrics-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-metrics-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-metrics-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "logs-job", + dataType: component.DataTypeLogs, + service: "test-logs-job", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-job-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.job.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-job"), + "k8s.job.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "job"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-job"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "logs-statefulset", + dataType: component.DataTypeLogs, + service: "test-logs-statefulset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-statefulset-0"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-statefulset"), + "k8s.statefulset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-statefulset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "logs-deployment", + dataType: component.DataTypeLogs, + service: "test-logs-deployment", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-deployment-[a-z0-9]*-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-deployment"), + "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-deployment-[a-z0-9]*"), + "k8s.replicaset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "deployment"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-deployment"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), + }, + }, + { + name: "logs-daemonset", + dataType: component.DataTypeLogs, + service: "test-logs-daemonset", + attrs: map[string]*expectedValue{ + "k8s.pod.name": newExpectedValue(regex, "telemetrygen-"+testID+"-logs-daemonset-[a-z0-9]*"), + "k8s.pod.ip": newExpectedValue(exist, ""), + "k8s.pod.uid": newExpectedValue(exist, ""), + "k8s.pod.start_time": newExpectedValue(exist, ""), + "k8s.node.name": newExpectedValue(exist, ""), + "k8s.namespace.name": newExpectedValue(equal, "default"), + "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-daemonset"), + "k8s.daemonset.uid": newExpectedValue(exist, ""), + "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), + "k8s.labels.app": newExpectedValue(equal, "telemetrygen-"+testID+"-logs-daemonset"), + "k8s.container.name": newExpectedValue(equal, "telemetrygen"), + "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), + "container.image.tag": newExpectedValue(equal, "latest"), + "container.id": newExpectedValue(exist, ""), }, }, } for _, tc := range tcs { t.Run(tc.name, func(t *testing.T) { - scanSpanForAttributes(t, tc.service, tc.attrs) + switch tc.dataType { + case component.DataTypeTraces: + scanTracesForAttributes(t, tracesConsumer, tc.service, tc.attrs) + case component.DataTypeMetrics: + scanMetricsForAttributes(t, metricsConsumer, tc.service, tc.attrs) + case component.DataTypeLogs: + scanLogsForAttributes(t, logsConsumer, tc.service, tc.attrs) + default: + t.Fatalf("unknown data type %s", tc.dataType) + } }) } } -func scanSpanForAttributes(t *testing.T, expectedService string, kvs map[string]*expectedValue) { - - f, _ := os.Open("./testdata/trace.json") - defer f.Close() - - scanner := bufio.NewScanner(f) - const maxCapacity int = 8388608 - buf := make([]byte, maxCapacity) - scanner.Buffer(buf, maxCapacity) - - unmarshaler := ptrace.JSONUnmarshaler{} - var err error - for scanner.Scan() { - traces, serr := unmarshaler.UnmarshalTraces(scanner.Bytes()) - if serr != nil { - continue - } - - len := traces.ResourceSpans().Len() - for i := 0; i < len; i++ { - resourceSpans := traces.ResourceSpans().At(i) - - service, exist := resourceSpans.Resource().Attributes().Get("service.name") +func scanTracesForAttributes(t *testing.T, ts *consumertest.TracesSink, expectedService string, + kvs map[string]*expectedValue) { + // Iterate over the received set of traces starting from the most recent entries due to a bug in the processor: + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/18892 + // TODO: Remove the reverse loop once it's fixed. All the metrics should be properly annotated. + for i := len(ts.AllTraces()) - 1; i >= 0; i-- { + traces := ts.AllTraces()[i] + for i := 0; i < traces.ResourceSpans().Len(); i++ { + resource := traces.ResourceSpans().At(i).Resource() + service, exist := resource.Attributes().Get("service.name") assert.Equal(t, true, exist, "span do not has 'service.name' attribute in resource") + if service.AsString() != expectedService { + continue + } + assert.NoError(t, resourceHasAttributes(resource, kvs)) + return + } + } + t.Fatalf("no spans found for service %s", expectedService) +} +func scanMetricsForAttributes(t *testing.T, ms *consumertest.MetricsSink, expectedService string, + kvs map[string]*expectedValue) { + // Iterate over the received set of metrics starting from the most recent entries due to a bug in the processor: + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/18892 + // TODO: Remove the reverse loop once it's fixed. All the metrics should be properly annotated. + for i := len(ms.AllMetrics()) - 1; i >= 0; i-- { + metrics := ms.AllMetrics()[i] + for i := 0; i < metrics.ResourceMetrics().Len(); i++ { + resource := metrics.ResourceMetrics().At(i).Resource() + service, exist := resource.Attributes().Get("service.name") + assert.Equal(t, true, exist, "metric do not has 'service.name' attribute in resource") if service.AsString() != expectedService { continue } - err = resourceHasAttributes(resourceSpans.Resource(), kvs) + assert.NoError(t, resourceHasAttributes(resource, kvs)) + return } } - assert.NoError(t, err) + t.Fatalf("no metric found for service %s", expectedService) +} +func scanLogsForAttributes(t *testing.T, ls *consumertest.LogsSink, expectedService string, + kvs map[string]*expectedValue) { + // Iterate over the received set of logs starting from the most recent entries due to a bug in the processor: + // https://github.com/open-telemetry/opentelemetry-collector-contrib/issues/18892 + // TODO: Remove the reverse loop once it's fixed. All the metrics should be properly annotated. + for i := len(ls.AllLogs()) - 1; i >= 0; i-- { + logs := ls.AllLogs()[i] + for i := 0; i < logs.ResourceLogs().Len(); i++ { + resource := logs.ResourceLogs().At(i).Resource() + service, exist := resource.Attributes().Get("service.name") + assert.Equal(t, true, exist, "log do not has 'service.name' attribute in resource") + if service.AsString() != expectedService { + continue + } + assert.NoError(t, resourceHasAttributes(resource, kvs)) + return + } + } + t.Fatalf("no logs found for service %s", expectedService) } func resourceHasAttributes(resource pcommon.Resource, kvs map[string]*expectedValue) error { @@ -222,272 +478,147 @@ func resourceHasAttributes(resource pcommon.Resource, kvs map[string]*expectedVa return err } -func TestMetricE2E(t *testing.T) { - tcs := []struct { - name string - service string - attrs map[string]*expectedValue - }{ - { - name: "job", - service: "test-job", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-metrics-job-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.job.name": newExpectedValue(equal, "telemetrygen-metrics-job"), - "k8s.job.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "job"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-metrics"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - { - name: "statefulset", - service: "test-statefulset", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(equal, "telemetrygen-metrics-statefulset-0"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-metrics-statefulset"), - "k8s.statefulset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-metrics-statefulset"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - { - name: "deployment", - service: "test-deployment", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-metrics-deployment-[a-z0-9]*-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-metrics-deployment"), - "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-metrics-deployment-[a-z0-9]*"), - "k8s.replicaset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "deployment"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-metrics-deployment"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - { - name: "daemonset", - service: "test-daemonset", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-metrics-daemonset-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-metrics-daemonset"), - "k8s.daemonset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-metrics-daemonset"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - scanMetricForAttributes(t, tc.service, tc.attrs) - }) +func createCollectorObjects(t *testing.T, client *dynamic.DynamicClient, testID string) []*unstructured.Unstructured { + manifestsDir := filepath.Join(".", "testdata", "e2e", "collector") + manifestFiles, err := os.ReadDir(manifestsDir) + require.NoErrorf(t, err, "failed to read collector manifests directory %s", manifestsDir) + host := hostEndpoint(t) + var podNamespace string + var podLabels map[string]any + createdObjs := make([]*unstructured.Unstructured, 0, len(manifestFiles)) + for _, manifestFile := range manifestFiles { + tmpl := template.Must(template.New(manifestFile.Name()).ParseFiles(filepath.Join(manifestsDir, manifestFile.Name()))) + manifest := &bytes.Buffer{} + require.NoError(t, tmpl.Execute(manifest, map[string]string{ + "Name": "otelcol-" + testID, + "HostEndpoint": host, + })) + obj, err := createObject(client, manifest.Bytes()) + require.NoErrorf(t, err, "failed to create collector object from manifest %s", manifestFile.Name()) + if obj.GetKind() == "Deployment" { + podNamespace = obj.GetNamespace() + selector := obj.Object["spec"].(map[string]any)["selector"] + podLabels = selector.(map[string]any)["matchLabels"].(map[string]any) + } + createdObjs = append(createdObjs, obj) } -} -func scanMetricForAttributes(t *testing.T, expectedService string, kvs map[string]*expectedValue) { + waitForCollectorToStart(t, client, podNamespace, podLabels) - f, _ := os.Open("./testdata/metric.json") - defer f.Close() - - scanner := bufio.NewScanner(f) - const maxCapacity int = 8388608 - buf := make([]byte, maxCapacity) - scanner.Buffer(buf, maxCapacity) + return createdObjs +} - unmarshaler := pmetric.JSONUnmarshaler{} - var err error - for scanner.Scan() { - metrics, serr := unmarshaler.UnmarshalMetrics(scanner.Bytes()) - if serr != nil { - continue +func waitForCollectorToStart(t *testing.T, client *dynamic.DynamicClient, podNamespace string, podLabels map[string]any) { + podGVR := schema.GroupVersionResource{Version: "v1", Resource: "pods"} + listOptions := metav1.ListOptions{LabelSelector: selectorFromMap(podLabels).String()} + podTimeoutMinutes := 3 + var podPhase string + require.Eventually(t, func() bool { + list, err := client.Resource(podGVR).Namespace(podNamespace).List(context.Background(), listOptions) + require.NoError(t, err, "failed to list collector pods") + if len(list.Items) == 0 { + return false } + podPhase = list.Items[0].Object["status"].(map[string]interface{})["phase"].(string) + return podPhase == "Running" + }, time.Duration(podTimeoutMinutes)*time.Minute, 50*time.Millisecond, + "collector pod haven't started within %d minutes, latest pod phase is %s", podTimeoutMinutes, podPhase) +} - len := metrics.ResourceMetrics().Len() - for i := 0; i < len; i++ { - resourceMetrics := metrics.ResourceMetrics().At(i) - - service, exist := resourceMetrics.Resource().Attributes().Get("service.name") - assert.Equal(t, true, exist, "metric do not has 'service.name' attribute in resource") +func selectorFromMap(labelMap map[string]any) labels.Selector { + labelStringMap := make(map[string]string) + for key, value := range labelMap { + labelStringMap[key] = value.(string) + } + labelSet := labels.Set(labelStringMap) + return labelSet.AsSelector() +} - if service.AsString() != expectedService { - continue - } - err = resourceHasAttributes(resourceMetrics.Resource(), kvs) +func createTelemetryGenObjects(t *testing.T, client *dynamic.DynamicClient, testID string) []*unstructured.Unstructured { + manifestsDir := filepath.Join(".", "testdata", "e2e", "telemetrygen") + manifestFiles, err := os.ReadDir(manifestsDir) + require.NoErrorf(t, err, "failed to read telemetrygen manifests directory %s", manifestsDir) + createdObjs := make([]*unstructured.Unstructured, 0, len(manifestFiles)) + for _, manifestFile := range manifestFiles { + tmpl := template.Must(template.New(manifestFile.Name()).ParseFiles(filepath.Join(manifestsDir, manifestFile.Name()))) + for _, dataType := range []string{"metrics", "logs", "traces"} { + manifest := &bytes.Buffer{} + require.NoError(t, tmpl.Execute(manifest, map[string]string{ + "Name": "telemetrygen-" + testID, + "DataType": dataType, + "OTLPEndpoint": "otelcol-" + testID + ":4317", + })) + obj, err := createObject(client, manifest.Bytes()) + require.NoErrorf(t, err, "failed to create telemetrygen object from manifest %s", manifestFile.Name()) + createdObjs = append(createdObjs, obj) } } - assert.NoError(t, err) - + return createdObjs } -func TestLogE2E(t *testing.T) { - tcs := []struct { - name string - service string - attrs map[string]*expectedValue - }{ - { - name: "job", - service: "test-job", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-logs-job-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.job.name": newExpectedValue(equal, "telemetrygen-logs-job"), - "k8s.job.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "job"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-logs"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - { - name: "statefulset", - service: "test-statefulset", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(equal, "telemetrygen-logs-statefulset-0"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.statefulset.name": newExpectedValue(equal, "telemetrygen-logs-statefulset"), - "k8s.statefulset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "statefulset"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-logs-statefulset"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - { - name: "deployment", - service: "test-deployment", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-logs-deployment-[a-z0-9]*-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.deployment.name": newExpectedValue(equal, "telemetrygen-logs-deployment"), - "k8s.replicaset.name": newExpectedValue(regex, "telemetrygen-logs-deployment-[a-z0-9]*"), - "k8s.replicaset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "deployment"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-logs-deployment"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, - { - name: "daemonset", - service: "test-daemonset", - attrs: map[string]*expectedValue{ - "k8s.pod.name": newExpectedValue(regex, "telemetrygen-logs-daemonset-[a-z0-9]*"), - "k8s.pod.ip": newExpectedValue(exist, ""), - "k8s.pod.uid": newExpectedValue(exist, ""), - "k8s.pod.start_time": newExpectedValue(exist, ""), - "k8s.node.name": newExpectedValue(exist, ""), - "k8s.namespace.name": newExpectedValue(equal, "default"), - "k8s.daemonset.name": newExpectedValue(equal, "telemetrygen-logs-daemonset"), - "k8s.daemonset.uid": newExpectedValue(exist, ""), - "k8s.annotations.workload": newExpectedValue(equal, "daemonset"), - "k8s.labels.app": newExpectedValue(equal, "telemetrygen-logs-daemonset"), - "k8s.container.name": newExpectedValue(equal, "telemetrygen"), - "k8s.container.restart_count": newExpectedValue(equal, "0"), - "container.image.name": newExpectedValue(equal, "ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen"), - "container.image.tag": newExpectedValue(equal, "latest"), - "container.id": newExpectedValue(exist, ""), - }, - }, +func createObject(client *dynamic.DynamicClient, manifest []byte) (*unstructured.Unstructured, error) { + decoder := yaml.NewDecodingSerializer(unstructured.UnstructuredJSONScheme) + obj := &unstructured.Unstructured{} + _, gvk, err := decoder.Decode(manifest, nil, obj) + if err != nil { + return nil, err } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - scanLogForAttributes(t, tc.service, tc.attrs) - }) + gvr := schema.GroupVersionResource{ + Group: gvk.Group, + Version: gvk.Version, + Resource: strings.ToLower(gvk.Kind + "s"), } + return client.Resource(gvr).Namespace(obj.GetNamespace()).Create(context.Background(), obj, metav1.CreateOptions{}) } -func scanLogForAttributes(t *testing.T, expectedService string, kvs map[string]*expectedValue) { - - f, _ := os.Open("./testdata/log.json") - defer f.Close() - - scanner := bufio.NewScanner(f) - const maxCapacity int = 8388608 - buf := make([]byte, maxCapacity) - scanner.Buffer(buf, maxCapacity) - - unmarshaler := plog.JSONUnmarshaler{} - var err error - for scanner.Scan() { - logs, serr := unmarshaler.UnmarshalLogs(scanner.Bytes()) - if serr != nil { - continue - } - - len := logs.ResourceLogs().Len() - for i := 0; i < len; i++ { - resourceLogs := logs.ResourceLogs().At(i) +func deleteObject(client *dynamic.DynamicClient, obj *unstructured.Unstructured) error { + gvk := obj.GroupVersionKind() + gvr := schema.GroupVersionResource{ + Group: gvk.Group, + Version: gvk.Version, + Resource: strings.ToLower(gvk.Kind + "s"), + } + return client.Resource(gvr).Namespace(obj.GetNamespace()).Delete(context.Background(), obj.GetName(), metav1.DeleteOptions{}) +} - service, exist := resourceLogs.Resource().Attributes().Get("service.name") - assert.Equal(t, true, exist, "log do not has 'service.name' attribute in resource") +func waitForData(t *testing.T, entriesNum int, mc *consumertest.MetricsSink, tc *consumertest.TracesSink, lc *consumertest.LogsSink) { + f := otlpreceiver.NewFactory() + cfg := f.CreateDefaultConfig().(*otlpreceiver.Config) + + _, err := f.CreateMetricsReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, mc) + require.NoError(t, err, "failed creating metrics receiver") + _, err = f.CreateTracesReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, tc) + require.NoError(t, err, "failed creating traces receiver") + rcvr, err := f.CreateLogsReceiver(context.Background(), receivertest.NewNopCreateSettings(), cfg, lc) + require.NoError(t, err, "failed creating logs receiver") + require.NoError(t, rcvr.Start(context.Background(), componenttest.NewNopHost())) + defer func() { + assert.NoError(t, rcvr.Shutdown(context.Background())) + }() + + timeoutMinutes := 3 + require.Eventuallyf(t, func() bool { + return len(mc.AllMetrics()) > entriesNum && len(tc.AllTraces()) > entriesNum && len(lc.AllLogs()) > entriesNum + }, time.Duration(timeoutMinutes)*time.Minute, 1*time.Second, + "failed to receive %d entries, received %d metrics, %d traces, %d logs in %d minutes", entriesNum, + len(mc.AllMetrics()), len(tc.AllTraces()), len(lc.AllLogs()), timeoutMinutes) +} - if service.AsString() != expectedService { - continue - } - err = resourceHasAttributes(resourceLogs.Resource(), kvs) - } +func hostEndpoint(t *testing.T) string { + if runtime.GOOS == "darwin" { + return "host.docker.internal" } - assert.NoError(t, err) + client, err := docker.NewClientWithOpts(docker.FromEnv) + require.NoError(t, err) + client.NegotiateAPIVersion(context.Background()) + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + network, err := client.NetworkInspect(ctx, "kind", types.NetworkInspectOptions{}) + require.NoError(t, err) + for _, ipam := range network.IPAM.Config { + return ipam.Gateway + } + require.Fail(t, "failed to find host endpoint") + return "" } diff --git a/processor/k8sattributesprocessor/go.mod b/processor/k8sattributesprocessor/go.mod index 565b27297b3a..0cad8382433a 100644 --- a/processor/k8sattributesprocessor/go.mod +++ b/processor/k8sattributesprocessor/go.mod @@ -3,6 +3,8 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sat go 1.19 require ( + github.com/docker/docker v23.0.2+incompatible + github.com/google/uuid v1.3.0 github.com/open-telemetry/opentelemetry-collector-contrib/internal/k8sconfig v0.75.0 github.com/stretchr/testify v1.8.2 go.opencensus.io v0.24.0 @@ -11,6 +13,8 @@ require ( go.opentelemetry.io/collector/confmap v0.75.0 go.opentelemetry.io/collector/consumer v0.75.0 go.opentelemetry.io/collector/pdata v1.0.0-rc9 + go.opentelemetry.io/collector/receiver v0.75.0 + go.opentelemetry.io/collector/receiver/otlpreceiver v0.75.0 go.opentelemetry.io/collector/semconv v0.75.0 go.uber.org/multierr v1.11.0 go.uber.org/zap v1.24.0 @@ -20,50 +24,68 @@ require ( ) require ( + github.com/Microsoft/go-winio v0.6.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect + github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/emicklei/go-restful/v3 v3.9.0 // indirect - github.com/evanphx/json-patch v4.12.0+incompatible // indirect + github.com/evanphx/json-patch v5.6.0+incompatible // indirect + github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/go-logr/logr v1.2.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/swag v0.19.14 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect + github.com/golang/snappy v0.0.4 // indirect github.com/google/gnostic v0.5.7-v3refs // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/imdario/mergo v0.3.11 // indirect + github.com/imdario/mergo v0.3.13 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/klauspost/compress v1.16.3 // indirect github.com/knadh/koanf v1.5.0 // indirect - github.com/kr/pretty v0.3.0 // indirect github.com/mailru/easyjson v0.7.6 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/morikuni/aec v1.0.0 // indirect + github.com/mostynb/go-grpc-compression v1.1.17 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/opencontainers/go-digest v1.0.0 // indirect + github.com/opencontainers/image-spec v1.0.2 // indirect github.com/openshift/api v3.9.0+incompatible // indirect github.com/openshift/client-go v0.0.0-20210521082421-73d9475a9142 // indirect github.com/pelletier/go-toml v1.9.4 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect + github.com/rs/cors v1.8.3 // indirect github.com/spf13/pflag v1.0.5 // indirect + go.opentelemetry.io/collector/exporter v0.75.0 // indirect go.opentelemetry.io/collector/featuregate v0.75.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 // indirect go.opentelemetry.io/otel v1.14.0 // indirect go.opentelemetry.io/otel/metric v0.37.0 // indirect go.opentelemetry.io/otel/trace v1.14.0 // indirect go.uber.org/atomic v1.10.0 // indirect + golang.org/x/mod v0.8.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/oauth2 v0.6.0 // indirect golang.org/x/sys v0.6.0 // indirect golang.org/x/term v0.6.0 // indirect golang.org/x/text v0.8.0 // indirect golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.6.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect google.golang.org/grpc v1.54.0 // indirect @@ -72,6 +94,7 @@ require ( gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.4.0 // indirect k8s.io/klog/v2 v2.80.1 // indirect k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect diff --git a/processor/k8sattributesprocessor/go.sum b/processor/k8sattributesprocessor/go.sum index f08e387975a5..9d35bbc90a3a 100644 --- a/processor/k8sattributesprocessor/go.sum +++ b/processor/k8sattributesprocessor/go.sum @@ -9,9 +9,12 @@ cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6T cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= +cloud.google.com/go v0.105.0 h1:DNtEKRBAAzeS4KyIory52wWHuClNaXJ5x1F7xa4q+5Y= cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o= cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE= cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc= +cloud.google.com/go/compute v1.15.1 h1:7UGq3QknM33pw5xATlpzeoomNxsacIVvTqTTvbfajmE= +cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= 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= @@ -20,7 +23,9 @@ cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIA cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw= cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohlUTyfDhBk= +contrib.go.opencensus.io/exporter/prometheus v0.4.2 h1:sqfsYl5GIY/L570iT+l93ehxaWJs2/OwXtiWwew3oAg= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24= github.com/Azure/go-autorest/autorest v0.11.12/go.mod h1:eipySxLmqSyC5s5k1CLupqet0PSENBEDP93LQ9a8QYw= github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A= @@ -30,6 +35,8 @@ github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZ github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= +github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ= github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= @@ -57,22 +64,36 @@ github.com/aws/smithy-go v1.8.0/go.mod h1:SObp3lf9smib00L/v3U2eAKG8FyQ7iLrJnQiAm github.com/benbjohnson/clock v1.3.0 h1:ip6w0uFQkncKQ979AypyG0ER7mqUSBdKLOgAle/AT8A= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= +github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= +github.com/cncf/xds/go v0.0.0-20210805033703-aa0b78936158/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20210922020428-25de7278fc84/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= +github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= +github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/docker v23.0.2+incompatible h1:q81C2qQ/EhPm8COZMUGOQYh4qLv4Xu6CXELJ3WK/mlU= +github.com/docker/docker v23.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= +github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= @@ -83,15 +104,20 @@ github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.4/go.mod h1:6rpuAdCZL397s3pYoYcLgu1mIlRU8Am5FuJP05cCM98= +github.com/envoyproxy/go-control-plane v0.9.9-0.20201210154907-fd9021fe5dad/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= github.com/envoyproxy/go-control-plane v0.9.9-0.20210217033140-668b12f5399d/go.mod h1:cXg6YxExXjJnVBQHBLXeUAgxn2UodCpnH306RInaBQk= +github.com/envoyproxy/go-control-plane v0.9.10-0.20210907150352-cf90f659a021/go.mod h1:AFq3mo9L8Lqqiid3OhADV3RfLJnjiw63cSpi+fDTRC0= github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/evanphx/json-patch v4.9.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= -github.com/evanphx/json-patch v4.12.0+incompatible h1:4onqiflcdA9EOZ4RxV643DvftH5pOlLGNtQ5lPWQu84= -github.com/evanphx/json-patch v4.12.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= +github.com/evanphx/json-patch v5.6.0+incompatible h1:jBYDEEiFBPxA0v50tFdvOzQQTCvpL6mnFh5mB2/l16U= +github.com/evanphx/json-patch v5.6.0+incompatible/go.mod h1:50XU6AFN0ol/bzJsmQLiYLvXMP4fmwYFNcr97nuDLSk= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= +github.com/felixge/httpsnoop v1.0.3/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= github.com/form3tech-oss/jwt-go v3.2.2+incompatible/go.mod h1:pbq4aXjuKjdthFRnoDwaVPLA+WlJuPGy+QneDUgJi2k= +github.com/frankban/quicktest v1.14.0/go.mod h1:NeW+ay9A/U67EYXNFA1nPE8e/tnQv/09mUdL/ijj8og= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -103,16 +129,21 @@ github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2 github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= +github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-ldap/ldap v3.0.2+incompatible/go.mod h1:qfd9rJvER9Q0/D/Sqn1DfHRoBp40uXYvFoEVrNEPqRc= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= +github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7sIas= github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v0.4.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU= github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-openapi/jsonpointer v0.19.2/go.mod h1:3akKfEdA7DF1sugOqz1dVQHBcuDBPKZGEoHC/NkiQRg= github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= @@ -162,6 +193,8 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= +github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= @@ -193,6 +226,7 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg= github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk= github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg= @@ -239,8 +273,8 @@ github.com/hjson/hjson-go/v4 v4.0.0/go.mod h1:KaYt3bTw3zhBjYqnXkYywcYctk0A2nxeEF github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imdario/mergo v0.3.5/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJh5FfA= -github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA= -github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= @@ -259,6 +293,9 @@ github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7V github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= +github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY= +github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/knadh/koanf v1.5.0 h1:q2TSd/3Pyc/5yP9ldIrSdIz26MCcyNQzW0pEAugLPNs= github.com/knadh/koanf v1.5.0/go.mod h1:Hgyjp4y8v44hpZtPzs7JZfRAW5AhN7KfZcwv1RYggDs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -288,6 +325,7 @@ github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcME github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= +github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -307,6 +345,8 @@ github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA= +github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -314,6 +354,10 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= +github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= +github.com/mostynb/go-grpc-compression v1.1.17 h1:N9t6taOJN3mNTTi0wDf4e3lp/G/ON1TP67Pn0vTUA9I= +github.com/mostynb/go-grpc-compression v1.1.17/go.mod h1:FUSBr0QjKqQgoDG/e0yiqlR6aqyXC39+g/hFLDfSsEY= github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= @@ -331,6 +375,10 @@ github.com/onsi/ginkgo/v2 v2.4.0 h1:+Ig9nvqgS5OBSACXNk15PLdp0U9XPYROt9CFzVdFGIs= 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.23.0 h1:/oxKu9c2HVap+F3PfKort2Hw5DEU+HGlW8n+tguWsys= +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.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/openshift/api v0.0.0-20180801171038-322a19404e37 h1:05irGU4HK4IauGGDbsk+ZHrm1wOzMLYjMlfaiqMrBYc= github.com/openshift/api v0.0.0-20180801171038-322a19404e37/go.mod h1:dh9o4Fs58gpFXGSYfnVxGR9PnV53I8TW84pQaJDdGiY= github.com/openshift/api v0.0.0-20210521075222-e273a339932a/go.mod h1:izBmoXbUu3z5kUa4FjZhvekTsyzIWiOoaIgJiZBBMQs= @@ -344,6 +392,7 @@ github.com/pelletier/go-toml v1.9.4 h1:tjENF6MfZAg8e4ZmZTeWaWiT2vXtsoO6+iuOjFhEC github.com/pelletier/go-toml v1.9.4/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/peterbourgon/diskv v2.0.1+incompatible/go.mod h1:uqqh8zWWbv1HBMNONnaR/tNboyR3/BZd58JJSHlUSCU= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= +github.com/pierrec/lz4/v4 v4.1.15/go.mod h1:gZWDp/Ze/IJXGXf23ltt2EXimqmTUXEy0GFuRQyBid4= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= @@ -356,23 +405,30 @@ github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXP github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= github.com/prometheus/client_golang v1.11.1/go.mod h1:Z6t4BnS23TR94PD6BsDNk8yVqroYurpAkEiz0P2BEV0= +github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9VFqTh1DIvc= +github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA= +github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5mo= +github.com/prometheus/statsd_exporter v0.22.7 h1:7Pji/i2GuhK6Lu7DHrtTkFmNBCudCPT1pX2CziuyQR0= github.com/rhnvrm/simples3 v0.6.1/go.mod h1:Y+3vYm2V7Y4VijFoJHHTrja6OgPrJ2cBti8dPGkC3sA= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= +github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= +github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/columnize v2.1.0+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/ryanuber/go-glob v1.0.0/go.mod h1:807d1WSdnB0XRJzKNil9Om6lcp/3a0v4qIHxIXzX/Yc= @@ -421,18 +477,32 @@ go.opentelemetry.io/collector/confmap v0.75.0 h1:yvtrXWKbYVXm8LRHi2aQyrSkN+ildMQ go.opentelemetry.io/collector/confmap v0.75.0/go.mod h1:T1I41gDZxvpIqUmyNziFMGBwixEsX6qNiwMY5apG5Gk= go.opentelemetry.io/collector/consumer v0.75.0 h1:f+j560Enwrh1JHY+/dfVwidn9G/f+w0ZOx70tc0UTtg= go.opentelemetry.io/collector/consumer v0.75.0/go.mod h1:ilbTs6xKJO+eknSor/9Q0CMed7mDSByOIbSh5khVFWY= +go.opentelemetry.io/collector/exporter v0.75.0 h1:ZOeUHUoRAstIS7xPh+vZ1a/6YO3cITJI0Ed1+XG8foA= +go.opentelemetry.io/collector/exporter v0.75.0/go.mod h1:wYSNU8OwTmnrgTK5bk84H++Ieqv4d+GVMR92wBsolJQ= go.opentelemetry.io/collector/featuregate v0.75.0 h1:543kdhXh7/dHTwpHsjv+lgIz73RJD2lCkLrFi4UjZjk= go.opentelemetry.io/collector/featuregate v0.75.0/go.mod h1:pmVMr98Ps6QKyEHiVPN7o3Qd8K//M2NapfOv5BMWvA0= go.opentelemetry.io/collector/pdata v1.0.0-rc9 h1:K1GND9w4hOMVE4lLpGt+0KvjIBcbsR54ZsijEyUQFFI= go.opentelemetry.io/collector/pdata v1.0.0-rc9/go.mod h1:olBmmDzT077Jyag/kVDAaG9OFkzLF6zSm8mfufL4HW4= +go.opentelemetry.io/collector/receiver v0.75.0 h1:ZgoShBSTprt7vExTLtXTmEH05qIHU3tORhBWyk0PuB4= +go.opentelemetry.io/collector/receiver v0.75.0/go.mod h1:MADsPYeztg9cGUZIjmv5ayzntt69blxfmmZHlgdM1Aw= +go.opentelemetry.io/collector/receiver/otlpreceiver v0.75.0 h1:VXOt3k/zB/R2SxFNJQTDWm/KifCMW60m8Q3O5E2TV2c= +go.opentelemetry.io/collector/receiver/otlpreceiver v0.75.0/go.mod h1:DjuZIm8UHX5i3YEQFPi0XWbdNOSwFO9Xnm+WaB5wXzc= go.opentelemetry.io/collector/semconv v0.75.0 h1:zIlZk+zh1bgc3VKE1PZEmhOaVa4tQHZMcFFUXmGekVs= go.opentelemetry.io/collector/semconv v0.75.0/go.mod h1:xt8oDOiwa1jy24tGUo8+SzpphI7ZredS2WM/0m8rtTA= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0 h1:5jD3teb4Qh7mx/nfzq4jO2WFFpvXD0vYWFDrdvNWmXk= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.40.0/go.mod h1:UMklln0+MRhZC4e3PwmN3pCtq4DyIadWw4yikh6bNrw= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0 h1:lE9EJyw3/JhrjWH/hEy9FptnalDQgj7vpbgC2KCCCxE= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.40.0/go.mod h1:pcQ3MM3SWvrA71U4GDqv9UFDJ3HQsW7y5ZO3tDTlUdI= go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/exporters/prometheus v0.37.0 h1:NQc0epfL0xItsmGgSXgfbH2C1fq2VLXkZoDFsfRNHpc= go.opentelemetry.io/otel/metric v0.37.0 h1:pHDQuLQOZwYD+Km0eb657A25NaRzy0a+eLyKfDXedEs= go.opentelemetry.io/otel/metric v0.37.0/go.mod h1:DmdaHfGt54iV6UKxsV9slj2bBRJcKC1B1uvDLIioc1s= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/sdk/metric v0.37.0 h1:haYBBtZZxiI3ROwSmkZnI+d0+AVzBWeviuYQDeBWosU= go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= +go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= @@ -486,6 +556,8 @@ golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.1-0.20200828183125-ce943fd02449/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.8.0 h1:LUYupSeNrTNCGzR/hVBk2NHZO4hXcVaW1k4Qx7rjPx8= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -535,6 +607,7 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -645,6 +718,8 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.6.0 h1:BOw41kyTf3PuCW1pVQf8+Cyg8pMlkYB1oo9iJ6D/lKM= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -703,7 +778,9 @@ google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8 google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.33.2/go.mod h1:JMHMWHQWaTccqQQlmk3MJZS+GWXOdAesneDmEnv2fbc= +google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= +google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= google.golang.org/grpc v1.54.0 h1:EhTqbhiYeixwWQtAEZAxmV9MGqcjEU2mFx52xCzNyag= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -746,8 +823,11 @@ gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= +gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/processor/k8sattributesprocessor/testdata/e2e/collector/clusterrole.yaml b/processor/k8sattributesprocessor/testdata/e2e/collector/clusterrole.yaml new file mode 100644 index 000000000000..85dbf82fccc2 --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/collector/clusterrole.yaml @@ -0,0 +1,8 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ .Name }} +rules: + - apiGroups: [""] + resources: ["pods", "namespaces"] + verbs: ["get", "watch", "list"] diff --git a/processor/k8sattributesprocessor/testdata/e2e/collector/clusterrolebinding.yaml b/processor/k8sattributesprocessor/testdata/e2e/collector/clusterrolebinding.yaml new file mode 100644 index 000000000000..b792cc6309de --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/collector/clusterrolebinding.yaml @@ -0,0 +1,12 @@ +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ .Name }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ .Name }} +subjects: + - kind: ServiceAccount + name: {{ .Name }} + namespace: default diff --git a/processor/k8sattributesprocessor/testdata/e2e/collector/configmap.yaml b/processor/k8sattributesprocessor/testdata/e2e/collector/configmap.yaml new file mode 100644 index 000000000000..d18d592b22d3 --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/collector/configmap.yaml @@ -0,0 +1,77 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Name }}-config + namespace: default +data: + relay: | + exporters: + otlp: + endpoint: {{ .HostEndpoint }}:4317 + tls: + insecure: true + extensions: + health_check: {} + processors: + k8sattributes: + extract: + annotations: + - from: pod + key: workload + tag_name: k8s.annotations.workload + labels: + - from: pod + key: app + tag_name: k8s.labels.app + metadata: + - k8s.pod.name + - k8s.pod.start_time + - k8s.pod.uid + - k8s.namespace.name + - k8s.deployment.name + - k8s.replicaset.name + - k8s.replicaset.uid + - k8s.statefulset.name + - k8s.statefulset.uid + - k8s.daemonset.name + - k8s.daemonset.uid + - k8s.cronjob.name + - k8s.job.name + - k8s.job.uid + - k8s.node.name + - container.id + - container.image.name + - container.image.tag + pod_association: + - sources: + - from: connection + receivers: + otlp: + protocols: + grpc: + endpoint: ${MY_POD_IP}:4317 + service: + extensions: + - health_check + pipelines: + logs: + exporters: + - otlp + processors: + - k8sattributes + receivers: + - otlp + metrics: + exporters: + - otlp + processors: + - k8sattributes + receivers: + - otlp + traces: + exporters: + - otlp + processors: + - k8sattributes + receivers: + - otlp diff --git a/processor/k8sattributesprocessor/testdata/e2e/collector/deployment.yaml b/processor/k8sattributesprocessor/testdata/e2e/collector/deployment.yaml new file mode 100644 index 000000000000..f7f21c5d4856 --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/collector/deployment.yaml @@ -0,0 +1,57 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ .Name }} + namespace: default +spec: + replicas: 1 + selector: + matchLabels: + app.kubernetes.io/name: opentelemetry-collector + app.kubernetes.io/instance: {{ .Name }} + template: + metadata: + labels: + app.kubernetes.io/name: opentelemetry-collector + app.kubernetes.io/instance: {{ .Name }} + spec: + serviceAccountName: {{ .Name }} + containers: + - name: opentelemetry-collector + command: + - /otelcontribcol + - --config=/conf/relay.yaml + image: "otelcontribcol:latest" + imagePullPolicy: Never + ports: + - name: otlp + containerPort: 4317 + protocol: TCP + env: + - name: MY_POD_IP + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: status.podIP + livenessProbe: + httpGet: + path: / + port: 13133 + readinessProbe: + httpGet: + path: / + port: 13133 + resources: + limits: + cpu: 128m + memory: 256Mi + volumeMounts: + - mountPath: /conf + name: opentelemetry-collector-configmap + volumes: + - name: opentelemetry-collector-configmap + configMap: + name: {{ .Name }}-config + items: + - key: relay + path: relay.yaml diff --git a/processor/k8sattributesprocessor/testdata/e2e/collector/service.yaml b/processor/k8sattributesprocessor/testdata/e2e/collector/service.yaml new file mode 100644 index 000000000000..1bbfffb99197 --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/collector/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Name }} + namespace: default +spec: + type: ClusterIP + ports: + - name: otlp + port: 4317 + targetPort: 4317 + protocol: TCP + appProtocol: grpc + selector: + app.kubernetes.io/name: opentelemetry-collector + app.kubernetes.io/instance: {{ .Name }} diff --git a/processor/k8sattributesprocessor/testdata/e2e/collector/serviceaccount.yaml b/processor/k8sattributesprocessor/testdata/e2e/collector/serviceaccount.yaml new file mode 100644 index 000000000000..bdb3a8dd1b8f --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/collector/serviceaccount.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ .Name }} + namespace: default diff --git a/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/daemonset.yaml b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/daemonset.yaml new file mode 100644 index 000000000000..d89d22c53878 --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/daemonset.yaml @@ -0,0 +1,29 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ .Name }}-{{ .DataType }}-daemonset + namespace: default +spec: + selector: + matchLabels: + app: {{ .Name }}-{{ .DataType }}-daemonset + template: + metadata: + annotations: + workload: daemonset + labels: + app: {{ .Name }}-{{ .DataType }}-daemonset + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --duration=36000s + - --rate=1 + - --otlp-attributes=service.name="test-{{ .DataType }}-daemonset" + - --otlp-attributes=k8s.container.name="telemetrygen" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + name: telemetrygen + restartPolicy: Always diff --git a/.github/workflows/e2e/k8s/telemetrygen-deployment.yml b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/deployment.yaml similarity index 53% rename from .github/workflows/e2e/k8s/telemetrygen-deployment.yml rename to processor/k8sattributesprocessor/testdata/e2e/telemetrygen/deployment.yaml index 7de27065706a..43cc0665d383 100644 --- a/.github/workflows/e2e/k8s/telemetrygen-deployment.yml +++ b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/deployment.yaml @@ -1,38 +1,31 @@ apiVersion: apps/v1 kind: Deployment metadata: - name: telemetrygen-DATA_TYPE-deployment + name: {{ .Name }}-{{ .DataType }}-deployment namespace: default spec: replicas: 1 selector: matchLabels: - app: telemetrygen-DATA_TYPE-deployment + app: {{ .Name }}-{{ .DataType }}-deployment template: metadata: annotations: workload: deployment labels: - app: telemetrygen-DATA_TYPE-deployment + app: {{ .Name }}-{{ .DataType }}-deployment spec: containers: - command: - /telemetrygen - - DATA_TYPE + - {{ .DataType }} - --otlp-insecure - - --otlp-endpoint=test-opentelemetry-collector:4317 + - --otlp-endpoint={{ .OTLPEndpoint }} - --duration=36000s - --rate=1 - - --otlp-attributes=service.name="test-deployment" + - --otlp-attributes=service.name="test-{{ .DataType }}-deployment" - --otlp-attributes=k8s.container.name="telemetrygen" - - --otlp-attributes=k8s.container.restart_count="0" image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest imagePullPolicy: IfNotPresent name: telemetrygen - resources: {} - securityContext: {} - dnsPolicy: ClusterFirst restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 \ No newline at end of file diff --git a/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/job.yaml b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/job.yaml new file mode 100644 index 000000000000..a61e5660462a --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/job.yaml @@ -0,0 +1,26 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: {{ .Name }}-{{ .DataType}}-job + namespace: default +spec: + template: + metadata: + annotations: + workload: job + labels: + app: {{ .Name }}-{{ .DataType }}-job + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --{{ .DataType }}=60 + - --rate=1 + - --otlp-attributes=service.name="test-{{ .DataType }}-job" + - --otlp-attributes=k8s.container.name="telemetrygen" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + name: telemetrygen + restartPolicy: Never diff --git a/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/statefulset.yaml b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/statefulset.yaml new file mode 100644 index 000000000000..b23c4e4ee508 --- /dev/null +++ b/processor/k8sattributesprocessor/testdata/e2e/telemetrygen/statefulset.yaml @@ -0,0 +1,31 @@ +apiVersion: apps/v1 +kind: StatefulSet +metadata: + name: {{ .Name }}-{{ .DataType }}-statefulset + namespace: default +spec: + serviceName: {{ .Name }}-{{ .DataType }}-statefulset + replicas: 1 + selector: + matchLabels: + app: {{ .Name }}-{{ .DataType }}-statefulset + template: + metadata: + annotations: + workload: statefulset + labels: + app: {{ .Name }}-{{ .DataType }}-statefulset + spec: + containers: + - command: + - /telemetrygen + - {{ .DataType }} + - --otlp-insecure + - --otlp-endpoint={{ .OTLPEndpoint }} + - --duration=36000s + - --rate=1 + - --otlp-attributes=service.name="test-{{ .DataType }}-statefulset" + - --otlp-attributes=k8s.container.name="telemetrygen" + image: ghcr.io/open-telemetry/opentelemetry-collector-contrib/telemetrygen:latest + name: telemetrygen + restartPolicy: Always