diff --git a/.chloggen/polish-awscontainerinsightreceiver-readme.yaml b/.chloggen/polish-awscontainerinsightreceiver-readme.yaml new file mode 100755 index 000000000000..fdf78cd11931 --- /dev/null +++ b/.chloggen/polish-awscontainerinsightreceiver-readme.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: receiver/awscontainerinsightreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Polish up awscontainerinsightreceiver README" + +# One or more tracking issues related to the change +issues: [16378] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/.chloggen/prometheusreceiver-shutdown.yaml b/.chloggen/prometheusreceiver-shutdown.yaml new file mode 100755 index 000000000000..7573177e4b7b --- /dev/null +++ b/.chloggen/prometheusreceiver-shutdown.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: prometheusreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Fix prometheus receiver panic on shutdown" + +# One or more tracking issues related to the change +issues: [16469] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/.chloggen/zipkin-shutdown.yaml b/.chloggen/zipkin-shutdown.yaml new file mode 100755 index 000000000000..d780af5f8b77 --- /dev/null +++ b/.chloggen/zipkin-shutdown.yaml @@ -0,0 +1,16 @@ +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: bug_fix + +# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver) +component: zipkinreceiver + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: "Fix zipkinreceiver panic on shutdown" + +# One or more tracking issues related to the change +issues: [16471] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: diff --git a/.github/workflows/build-and-test-windows.yml b/.github/workflows/build-and-test-windows.yml index 6eed52657524..09471abe5503 100644 --- a/.github/workflows/build-and-test-windows.yml +++ b/.github/workflows/build-and-test-windows.yml @@ -35,6 +35,11 @@ jobs: runs-on: windows-latest if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push') }} steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - if: matrix.group == 'receiver-0' @@ -56,7 +61,16 @@ jobs: ~\AppData\Local\go-build key: go-build-cache-${{ runner.os }}-${{ matrix.group }}-go-${{ hashFiles('**/go.sum') }} - name: Run Unit tests - run: make -j2 gotest GROUP=${{ matrix.group }} + run: make -j2 gotest GROUP=${{ matrix.group }} + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + test_framework: golang + test_format: json + test_path: | + ./**/foresight-test*.json windows-unittest: if: ${{ github.actor != 'dependabot[bot]' && (contains(github.event.pull_request.labels.*.name, 'Run Windows') || github.event_name == 'push') }} runs-on: windows-latest diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 45f0541bea5d..92f24296d8f4 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -21,6 +21,11 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor != 'dependabot[bot]' }} steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -75,6 +80,11 @@ jobs: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -122,6 +132,11 @@ jobs: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -180,6 +195,11 @@ jobs: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -207,6 +227,15 @@ jobs: key: go-test-build-${{ runner.os }}-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }} - name: Run Unit Tests run: make gotest GROUP=${{ matrix.group }} + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + test_framework: golang + test_format: json + test_path: | + ./**/foresight-test*.json unittest: if: ${{ always() }} strategy: @@ -231,6 +260,11 @@ jobs: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -247,11 +281,28 @@ jobs: key: go-cache-${{ runner.os }}-${{ hashFiles('**/go.sum') }} - name: Run Integration Tests run: make integration-tests-with-cover + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + test_framework: golang + test_format: json + test_path: | + ./**/foresight-test-report-integration*.json + coverage_format: golang + coverage_path: | + ./**/integration-coverage.txt correctness-traces: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -274,10 +325,24 @@ jobs: run: make install-tools - name: Correctness run: make -C testbed run-correctness-traces-tests + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + test_framework: golang + test_format: json + test_path: | + ./**/foresight-test*.json correctness-metrics: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -300,11 +365,25 @@ jobs: run: make install-tools - name: Correctness run: make -C testbed run-correctness-metrics-tests + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + test_framework: golang + test_format: json + test_path: | + ./**/foresight-test*.json build-examples: runs-on: ubuntu-latest needs: [setup-environment] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Build Examples @@ -339,6 +418,11 @@ jobs: - os: windows arch: ppc64le steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -376,6 +460,11 @@ jobs: matrix: package_type: ["deb", "rpm"] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 with: @@ -418,6 +507,11 @@ jobs: runs-on: windows-latest needs: [cross-compile] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 with: @@ -454,6 +548,11 @@ jobs: runs-on: ubuntu-latest needs: [build-package] steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Download Binaries @@ -473,6 +572,11 @@ jobs: needs: [lint, unittest, integration-tests, build-package] if: (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'open-telemetry/opentelemetry-collector-contrib' steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -538,6 +642,11 @@ jobs: needs: [lint, unittest, integration-tests, build-package] if: startsWith(github.ref, 'refs/tags/v') && github.repository == 'open-telemetry/opentelemetry-collector-contrib' steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index ff9b22c07538..ca8aaf8fdf39 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -14,6 +14,12 @@ jobs: CODEQL_EXTRACTOR_GO_BUILD_TRACING: 'on' steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + - name: Checkout repository uses: actions/checkout@v3 diff --git a/.github/workflows/load-tests.yml b/.github/workflows/load-tests.yml index 1873de356ac5..0838c3876908 100644 --- a/.github/workflows/load-tests.yml +++ b/.github/workflows/load-tests.yml @@ -23,6 +23,11 @@ jobs: outputs: loadtest_matrix: ${{ steps.splitloadtest.outputs.loadtest_matrix }} steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Setup Go @@ -61,6 +66,11 @@ jobs: fail-fast: false matrix: ${{ fromJson(needs.setup-environment.outputs.loadtest_matrix) }} steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - run: sudo chmod 0777 -R /opt @@ -119,6 +129,15 @@ jobs: uses: actions/upload-artifact@v3 with: path: ./*.tar + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + test_framework: JUNIT + test_format: JUNIT + test_path: | + ./testbed/tests/results/junit/*.xml - name: GitHub Issue Generator if: ${{ failure() && github.ref == 'refs/heads/main' }} run: issuegenerator $TEST_RESULTS diff --git a/.github/workflows/prometheus-compliance-tests.yml b/.github/workflows/prometheus-compliance-tests.yml index e44465ad0fdc..7fd464a3e2cb 100644 --- a/.github/workflows/prometheus-compliance-tests.yml +++ b/.github/workflows/prometheus-compliance-tests.yml @@ -20,6 +20,11 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor != 'dependabot[bot]' }} steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 with: @@ -48,5 +53,14 @@ jobs: - name: Copy binary to compliance directory run: mkdir compliance/remote_write_sender/bin && cp opentelemetry-collector-contrib/bin/otelcontribcol_linux_amd64 compliance/remote_write_sender/bin/otelcol_linux_amd64 - name: Run compliance tests - run: go test --tags=compliance -run "TestRemoteWrite/otel/.+" -v ./ + run: go test -v -json --tags=compliance -run "TestRemoteWrite/otel/.+" ./ > ./test-report.json working-directory: compliance/remote_write_sender + - name: Analyze Test and/or Coverage Results + if: always() + uses: runforesight/foresight-test-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} + working_directory: compliance/remote_write_sender + test_framework: golang + test_format: json + test_path: ./test-report.json diff --git a/.github/workflows/tracegen.yml b/.github/workflows/tracegen.yml index 05440928a68c..02b042b40c43 100644 --- a/.github/workflows/tracegen.yml +++ b/.github/workflows/tracegen.yml @@ -15,6 +15,11 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor != 'dependabot[bot]' }} steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Build tracegen @@ -30,6 +35,11 @@ jobs: permissions: packages: write steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Login to GitHub Container Registry @@ -51,6 +61,11 @@ jobs: permissions: packages: write steps: + - name: Collect Workflow Telemetry + if: always() + uses: runforesight/foresight-workflow-kit-action@v1 + with: + api_key: ${{ secrets.FORESIGHT_API_KEY }} - name: Checkout Repo uses: actions/checkout@v3 - name: Set Release Tag diff --git a/Makefile.Common b/Makefile.Common index db0de5ec3111..4d2edc4e7a21 100644 --- a/Makefile.Common +++ b/Makefile.Common @@ -19,6 +19,7 @@ LINT=golangci-lint IMPI=impi # BUILD_TYPE should be one of (dev, release). BUILD_TYPE?=release +RUNNING_ON_GITHUB_ACTION=$(GITHUB_ACTIONS) ALL_PKG_DIRS := $(shell $(GOCMD) list -f '{{ .Dir }}' ./... | sort) @@ -54,18 +55,30 @@ common: checklicense impi lint misspell .PHONY: test test: - $(GOTEST) $(GOTEST_OPT) ./... - + if [ "$(RUNNING_ON_GITHUB_ACTION)" = "true" ]; then \ + $(GOTEST) $(GOTEST_OPT) ./... -json > ./foresight-test-report.json; \ + else \ + $(GOTEST) $(GOTEST_OPT) ./...; \ + fi + .PHONY: do-unit-tests-with-cover do-unit-tests-with-cover: @echo "running $(GOCMD) unit test ./... + coverage in `pwd`" - @$(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) ./... + @if [ "$(RUNNING_ON_GITHUB_ACTION)" = "true" ]; then \ + $(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) ./... -json > ./foresight-test-report-unit-tests-with-cover.json; \ + else \ + $(GOTEST) $(GOTEST_OPT_WITH_COVERAGE) ./...; \ + fi $(GOCMD) tool cover -html=coverage.txt -o coverage.html .PHONY: do-integration-tests-with-cover do-integration-tests-with-cover: @echo "running $(GOCMD) integration test ./... + coverage in `pwd`" - @$(GOTEST) $(GOTEST_OPT_WITH_INTEGRATION) ./... + @if [ "$(RUNNING_ON_GITHUB_ACTION)" = "true" ]; then \ + $(GOTEST) $(GOTEST_OPT_WITH_INTEGRATION) ./... -json > ./foresight-test-report-integration-tests-with-cover.json; \ + else \ + $(GOTEST) $(GOTEST_OPT_WITH_INTEGRATION) ./...; \ + fi @if [ -e integration-coverage.txt ]; then \ $(GOCMD) tool cover -html=integration-coverage.txt -o integration-coverage.html; \ fi diff --git a/receiver/awscontainerinsightreceiver/README.md b/receiver/awscontainerinsightreceiver/README.md index ab90715383bb..9727647c9a0b 100644 --- a/receiver/awscontainerinsightreceiver/README.md +++ b/receiver/awscontainerinsightreceiver/README.md @@ -273,8 +273,8 @@ spec: mountPath: /var/lib/docker readOnly: true - name: containerdsock - mountPath: /run/containerd/containerd.sock - readOnly: true + mountPath: /run/containerd/containerd.sock + readOnly: true - name: sys mountPath: /sys readOnly: true @@ -307,8 +307,8 @@ spec: hostPath: path: /var/lib/docker - name: containerdsock - hostPath: - path: /run/containerd/containerd.sock + hostPath: + path: /run/containerd/containerd.sock - name: sys hostPath: path: /sys diff --git a/receiver/prometheusreceiver/metrics_receiver.go b/receiver/prometheusreceiver/metrics_receiver.go index 3e58b968076a..2473ea1d4a16 100644 --- a/receiver/prometheusreceiver/metrics_receiver.go +++ b/receiver/prometheusreceiver/metrics_receiver.go @@ -312,8 +312,12 @@ func gcInterval(cfg *config.Config) time.Duration { // Shutdown stops and cancels the underlying Prometheus scrapers. func (r *pReceiver) Shutdown(context.Context) error { - r.cancelFunc() - r.scrapeManager.Stop() + if r.cancelFunc != nil { + r.cancelFunc() + } + if r.scrapeManager != nil { + r.scrapeManager.Stop() + } close(r.targetAllocatorStop) return nil } diff --git a/receiver/zipkinreceiver/trace_receiver.go b/receiver/zipkinreceiver/trace_receiver.go index 7f8565e60324..adce923fc9c0 100644 --- a/receiver/zipkinreceiver/trace_receiver.go +++ b/receiver/zipkinreceiver/trace_receiver.go @@ -162,7 +162,10 @@ func (zr *zipkinReceiver) v2ToTraceSpans(blob []byte, hdr http.Header) (reqs ptr // giving it a chance to perform any necessary clean-up and shutting down // its HTTP server. func (zr *zipkinReceiver) Shutdown(context.Context) error { - err := zr.server.Close() + var err error + if zr.server != nil { + err = zr.server.Close() + } zr.shutdownWG.Wait() return err } diff --git a/testbed/runtests.sh b/testbed/runtests.sh index 863ced876cba..1c0a6221a1c8 100755 --- a/testbed/runtests.sh +++ b/testbed/runtests.sh @@ -14,7 +14,7 @@ TEST_COLORIZE="${SED} 's/PASS/${PASS_COLOR}/' | ${SED} 's/FAIL/${FAIL_COLOR}/'" mkdir -p results/junit -RUN_TESTBED=1 go test -v ${TEST_ARGS} 2>&1 | tee results/testoutput.log | bash -c "${TEST_COLORIZE}" +RUN_TESTBED=1 go test -v ${TEST_ARGS} 2>&1 | tee results/testoutput.log | bash -c "${TEST_COLORIZE}" -json > ./foresight-test-report.json testStatus=${PIPESTATUS[0]}