diff --git a/.github/workflows/dependency-updates-post-processing.yaml b/.github/workflows/dependency-updates-post-processing.yaml index 6d8556ee0d..47f50db2d2 100644 --- a/.github/workflows/dependency-updates-post-processing.yaml +++ b/.github/workflows/dependency-updates-post-processing.yaml @@ -9,6 +9,7 @@ on: jobs: dependency-updates-post-processing: name: "Dependency Updates Post-Processing" + if: "!contains(github.event.pull_request.labels.*.name, 'skip-dependency-postprocessing')" runs-on: ubuntu-latest container: image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main diff --git a/.github/workflows/linters.yaml b/.github/workflows/linters.yaml index 1996c0edff..b41c7b904e 100644 --- a/.github/workflows/linters.yaml +++ b/.github/workflows/linters.yaml @@ -6,40 +6,24 @@ jobs: linters: name: reviewdog runs-on: ubuntu-latest - container: - image: ghcr.io/cloudfoundry/app-autoscaler-release-tools:main steps: - name: Checkout uses: actions/checkout@v4 - name: Trust my checkout run: git config --global --add safe.directory "${GITHUB_WORKSPACE}" - - name: make build-all - run: | - make build-all - - - name: get golangci-lint version - id: get-golangci-lint-version + - name: Install devbox + uses: jetify-com/devbox-install-action@a03caf5813591bc882139eba6ae947930a83a427 # v0.11.0 + with: + enable-cache: 'true' + - name: Make devbox shellenv available run: | - version=v$(grep golangci-lint .tool-versions | cut -d " " -f 2 ) - echo "golangci-lint version from .tool-versions: '${version}'" - echo "version=${version}" >> "$GITHUB_OUTPUT"; + eval "$(devbox shellenv)" + printenv >> $GITHUB_ENV - - name: get go version - id: get-golang-version + - name: Run Go linter run: | - version="$(grep "golang " .tool-versions| cut -f 2 -d " ")" - echo "Go version from .tool-versions: '${version}'" - echo "version=${version}" >> "$GITHUB_OUTPUT"; - - - name: Set up Ruby - uses: ruby/setup-ruby@v1 - with: - # runs 'bundle install' and caches installed gems automatically - bundler-cache: true - env: - # Needed for self-hosted runner - ImageOS: ubuntu22 + make lint-go - name: shellcheck uses: reviewdog/action-shellcheck@v1 @@ -63,53 +47,3 @@ jobs: uses: reviewdog/action-markdownlint@v0 with: reporter: github-pr-review - - - name: lint acceptance - uses: reviewdog/action-golangci-lint@v2 - with: - workdir: src/acceptance - go_version: ${{ steps.get-golang-version.outputs.version }} - golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }} - reporter: github-pr-review - filter_mode: nofilter - fail_on_error: true - - - name: lint go test app - uses: reviewdog/action-golangci-lint@v2 - with: - workdir: src/acceptance/assets/app/go_app - go_version: ${{ steps.get-golang-version.outputs.version }} - golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }} - reporter: github-pr-review - filter_mode: nofilter - fail_on_error: true - - - name: lint autoscaler - uses: reviewdog/action-golangci-lint@v2 - with: - workdir: src/autoscaler - go_version: ${{ steps.get-golang-version.outputs.version }} - golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }} - reporter: github-pr-review - filter_mode: nofilter - fail_on_error: true - - - name: lint changelog - uses: reviewdog/action-golangci-lint@v2 - with: - workdir: src/changelog - go_version: ${{ steps.get-golang-version.outputs.version }} - golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }} - reporter: github-pr-review - filter_mode: nofilter - fail_on_error: true - - - name: lint changeloglockcleaner - uses: reviewdog/action-golangci-lint@v2 - with: - workdir: src/changeloglockcleaner - go_version: ${{ steps.get-golang-version.outputs.version }} - golangci_lint_version: ${{ steps.get-golangci-lint-version.outputs.version }} - reporter: github-pr-review - filter_mode: nofilter - fail_on_error: true diff --git a/.tool-versions b/.tool-versions index ad10f4f5bb..ef3a37fa0b 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,4 +1,4 @@ -act 0.2.64 +act 0.2.63 actionlint 1.7.1 bosh 7.3.1 credhub 2.9.29 @@ -8,7 +8,7 @@ direnv 2.34.0 gcloud 473.0.0 ginkgo 2.20.0 golang 1.22.2 -golangci-lint 1.59.1 +golangci-lint 1.60.3 java temurin-21.0.3+9.0.LTS make 4.4 maven 3.8.6 diff --git a/Makefile b/Makefile index 7d0ef2115b..9ef065ae77 100644 --- a/Makefile +++ b/Makefile @@ -58,7 +58,7 @@ target/init-db-${db_type}: @touch $@ .PHONY: clean-autoscaler clean-java clean-vendor clean-acceptance -clean: clean-vendor clean-autoscaler clean-java clean-targets clean-scheduler clean-certs clean-bosh-release clean-build clean-acceptance +clean: clean-vendor clean-autoscaler clean-java clean-targets clean-scheduler clean-certs clean-bosh-release clean-build clean-acceptance ## Clean all build and test artifacts @make stop-db db_type=mysql @make stop-db db_type=postgres clean-build: @@ -94,7 +94,7 @@ clean-acceptance: build: $(all_modules) build-tests: build-test build-test: $(addprefix test_,$(go_modules)) -build-all: build build-test build-test-app +build-all: build build-test build-test-app ## Build all modules and tests db: target/db target/db: @echo "# building $@" @@ -124,7 +124,7 @@ src/scheduler/src/test/resources/certs: .PHONY: test test-autoscaler test-scheduler test-changelog test-changeloglockcleaner -test: test-autoscaler test-scheduler test-changelog test-changeloglockcleaner test-acceptance-unit +test: test-autoscaler test-scheduler test-changelog test-changeloglockcleaner test-acceptance-unit ## Run all unit tests test-autoscaler: check-db_type init-db test-certs @echo ' - using DBURL=${DBURL} TEST=${TEST}' @make --directory='./src/autoscaler' test DBURL='${DBURL}' TEST='${TEST}' @@ -218,32 +218,35 @@ stop-db: check-db_type @docker rm -f ${db_type} &> /dev/null || echo " - we could not stop and remove docker named '${db_type}'" .PHONY: integration -integration: build init-db test-certs +integration: build init-db test-certs ## Run all integration tests @echo " - using DBURL=${DBURL}" @make --directory='./src/autoscaler' integration DBURL="${DBURL}" +.PHONY: lint +lint: lint-go lint-ruby lint-actions lint-markdown ## Run all linters + .PHONY:lint $(addprefix lint_,$(go_modules)) -lint: $(addprefix lint_,$(go_modules)) rubocop +lint-go: build-all $(addprefix lint_,$(go_modules)) -rubocop: +lint-ruby: @echo " - ruby scripts" @bundle install @bundle exec rubocop ${RUBOCOP_OPTS} ./spec ./packages -.PHONY: markdownlint -markdownlint: markdownlint-cli +.PHONY: lint-markdown +lint-markdown: @echo " - linting markdown files" - @markdownlint . + @markdownlint-cli2 . .PHONY: lint-actions lint-actions: @echo " - linting GitHub actions" - go run github.com/rhysd/actionlint/cmd/actionlint@latest + actionlint $(addprefix lint_,$(go_modules)): lint_%: @echo " - linting: $(patsubst lint_%,%,$@)" - @pushd src/$(patsubst lint_%,%,$@) >/dev/null && go run github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCI_LINT_VERSION} run --config ${lint_config} ${OPTS} --timeout 5m + @pushd src/$(patsubst lint_%,%,$@) >/dev/null && golangci-lint run --config ${lint_config} ${OPTS} --timeout 5m .PHONY: spec-test spec-test: @@ -326,12 +329,8 @@ workspace: uaac: which uaac || gem install cf-uaac -.PHONY: markdownlint-cli -markdownlint-cli: - which markdownlint || npm install -g --omit=dev markdownlint-cli - .PHONY: deploy-autoscaler deploy-register-cf deploy-autoscaler-bosh deploy-cleanup -deploy-autoscaler: go-mod-vendor uaac db scheduler deploy-autoscaler-bosh deploy-register-cf +deploy-autoscaler: go-mod-vendor uaac db scheduler deploy-autoscaler-bosh deploy-register-cf ## Deploy autoscaler to OSS dev environment deploy-register-cf: echo " - registering broker with cf" ${CI_DIR}/autoscaler/scripts/register-broker.sh @@ -376,7 +375,7 @@ build-acceptance-tests: @make --directory='./src/acceptance' build_tests .PHONY: acceptance-tests -acceptance-tests: build-test-app acceptance-tests-config +acceptance-tests: build-test-app acceptance-tests-config ## Run acceptance tests against OSS dev environment (requrires a previous deployment of the autoscaler) @make --directory='./src/acceptance' run-acceptance-tests .PHONY: acceptance-cleanup acceptance-cleanup: @@ -390,7 +389,7 @@ cleanup-concourse: @${CI_DIR}/autoscaler/scripts/cleanup-concourse.sh .PHONY: cf-login -cf-login: +cf-login: ## Login to OSS CF dev environment @${CI_DIR}/autoscaler/scripts/cf-login.sh .PHONY: setup-performance @@ -457,3 +456,5 @@ deploy-apps: echo " - deploying apps" DEBUG="${DEBUG}" ${CI_DIR}/autoscaler/scripts/deploy-apps.sh +help: ## Show this help + @grep --extended-regexp --no-filename '\s##\s' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' diff --git a/devbox.json b/devbox.json index ca6c88335d..64cb7fa400 100644 --- a/devbox.json +++ b/devbox.json @@ -5,13 +5,11 @@ "path:.#log-cache-cli-plugin": "", "path:.#cloud-mta-build-tool": "", "path:.#uaac": "", - "act": "0.2.64", "actionlint": "1.7.1", "bosh-cli": "7.3.1", "bundix": "latest", "cloudfoundry-cli": "8.7.11", "coreutils": "latest", - "credhub-cli": "2.9.35", "delve": "latest", "direnv": "2.34.0", "fly": "7.10.0", @@ -20,7 +18,6 @@ "gnumake": "4.4", "gnutar": "latest", "go-tools": "latest", - "golangci-lint": "1.59.1", "gopls": "latest", "gum": "0.13.0", "jq": "latest", @@ -37,8 +34,12 @@ "swagger-cli": "latest", "which": "latest", "yq-go": "4.44.2", - "google-cloud-sdk": "latest", "go": "1.22.2", + "credhub-cli": "2.9.29", + "markdownlint-cli2": "latest", + "act": "0.2.63", + "google-cloud-sdk": "latest", + "golangci-lint": "1.60.3", "temurin-bin-21": "latest", "ruby": "latest" }, diff --git a/devbox.lock b/devbox.lock index 047ab26bed..e5cae626ab 100644 --- a/devbox.lock +++ b/devbox.lock @@ -1,51 +1,51 @@ { "lockfile_version": "1", "packages": { - "act@0.2.64": { - "last_modified": "2024-07-31T08:48:38Z", - "resolved": "github:NixOS/nixpkgs/c3392ad349a5227f4a3464dce87bcc5046692fce#act", + "act@0.2.63": { + "last_modified": "2024-06-12T20:55:33Z", + "resolved": "github:NixOS/nixpkgs/a9858885e197f984d92d7fe64e9fff6b2e488d40#act", "source": "devbox-search", - "version": "0.2.64", + "version": "0.2.63", "systems": { "aarch64-darwin": { "outputs": [ { "name": "out", - "path": "/nix/store/wyhhhm5zc4jim1w3j3rv4jb38jr6zdd8-act-0.2.64", + "path": "/nix/store/98mhl0n5ki8xmd5fc3hnwmd7cxz51vcb-act-0.2.63", "default": true } ], - "store_path": "/nix/store/wyhhhm5zc4jim1w3j3rv4jb38jr6zdd8-act-0.2.64" + "store_path": "/nix/store/98mhl0n5ki8xmd5fc3hnwmd7cxz51vcb-act-0.2.63" }, "aarch64-linux": { "outputs": [ { "name": "out", - "path": "/nix/store/pi0l9m8glx5ks77207y9gf91vl5kgf9p-act-0.2.64", + "path": "/nix/store/9lgr8kbjd2hvaxslr51qp1n5qnxp27wl-act-0.2.63", "default": true } ], - "store_path": "/nix/store/pi0l9m8glx5ks77207y9gf91vl5kgf9p-act-0.2.64" + "store_path": "/nix/store/9lgr8kbjd2hvaxslr51qp1n5qnxp27wl-act-0.2.63" }, "x86_64-darwin": { "outputs": [ { "name": "out", - "path": "/nix/store/v36y1fr82wyk7mb295ipc62wr0xpfkjy-act-0.2.64", + "path": "/nix/store/86rnzcmj40xfd9akmfgv3421zpsxfvi6-act-0.2.63", "default": true } ], - "store_path": "/nix/store/v36y1fr82wyk7mb295ipc62wr0xpfkjy-act-0.2.64" + "store_path": "/nix/store/86rnzcmj40xfd9akmfgv3421zpsxfvi6-act-0.2.63" }, "x86_64-linux": { "outputs": [ { "name": "out", - "path": "/nix/store/6964bamczx2ffxh3rswx3yxgyb71b80n-act-0.2.64", + "path": "/nix/store/qjy3wsbk0jwrn6ghmyz2cwk5nf9kaxw5-act-0.2.63", "default": true } ], - "store_path": "/nix/store/6964bamczx2ffxh3rswx3yxgyb71b80n-act-0.2.64" + "store_path": "/nix/store/qjy3wsbk0jwrn6ghmyz2cwk5nf9kaxw5-act-0.2.63" } } }, @@ -313,51 +313,51 @@ } } }, - "credhub-cli@2.9.35": { - "last_modified": "2024-08-14T11:41:26Z", - "resolved": "github:NixOS/nixpkgs/0cb2fd7c59fed0cd82ef858cbcbdb552b9a33465#credhub-cli", + "credhub-cli@2.9.29": { + "last_modified": "2024-05-29T10:04:41Z", + "resolved": "github:NixOS/nixpkgs/ac82a513e55582291805d6f09d35b6d8b60637a1#credhub-cli", "source": "devbox-search", - "version": "2.9.35", + "version": "2.9.29", "systems": { "aarch64-darwin": { "outputs": [ { "name": "out", - "path": "/nix/store/2xkv0vlafk8zgzjpz3yjagbgyv5kawkn-credhub-cli-2.9.35", + "path": "/nix/store/20xi78w44q6wn4847jrrlmxddyjycbrn-credhub-cli-2.9.29", "default": true } ], - "store_path": "/nix/store/2xkv0vlafk8zgzjpz3yjagbgyv5kawkn-credhub-cli-2.9.35" + "store_path": "/nix/store/20xi78w44q6wn4847jrrlmxddyjycbrn-credhub-cli-2.9.29" }, "aarch64-linux": { "outputs": [ { "name": "out", - "path": "/nix/store/r0kkggv2kbdma8l2n177nl0sw4lwvqr5-credhub-cli-2.9.35", + "path": "/nix/store/5hv8vj4dhy521m49sc4wwmaz2q319z9a-credhub-cli-2.9.29", "default": true } ], - "store_path": "/nix/store/r0kkggv2kbdma8l2n177nl0sw4lwvqr5-credhub-cli-2.9.35" + "store_path": "/nix/store/5hv8vj4dhy521m49sc4wwmaz2q319z9a-credhub-cli-2.9.29" }, "x86_64-darwin": { "outputs": [ { "name": "out", - "path": "/nix/store/wkgc414d175cv1pa3h257pm264ayk8if-credhub-cli-2.9.35", + "path": "/nix/store/c5d2ggn5c819spywi74pzksbzds9ryym-credhub-cli-2.9.29", "default": true } ], - "store_path": "/nix/store/wkgc414d175cv1pa3h257pm264ayk8if-credhub-cli-2.9.35" + "store_path": "/nix/store/c5d2ggn5c819spywi74pzksbzds9ryym-credhub-cli-2.9.29" }, "x86_64-linux": { "outputs": [ { "name": "out", - "path": "/nix/store/zkmy2g042p75p3i6qib6s1589qymrg3k-credhub-cli-2.9.35", + "path": "/nix/store/3y6r6lgrbaq8521hk3zbalf3gz3albcg-credhub-cli-2.9.29", "default": true } ], - "store_path": "/nix/store/zkmy2g042p75p3i6qib6s1589qymrg3k-credhub-cli-2.9.35" + "store_path": "/nix/store/3y6r6lgrbaq8521hk3zbalf3gz3albcg-credhub-cli-2.9.29" } } }, @@ -853,51 +853,51 @@ } } }, - "golangci-lint@1.59.1": { - "last_modified": "2024-07-31T08:48:38Z", - "resolved": "github:NixOS/nixpkgs/c3392ad349a5227f4a3464dce87bcc5046692fce#golangci-lint", + "golangci-lint@1.60.3": { + "last_modified": "2024-08-27T08:49:48Z", + "resolved": "github:NixOS/nixpkgs/a6292e34000dc93d43bccf78338770c1c5ec8a99#golangci-lint", "source": "devbox-search", - "version": "1.59.1", + "version": "1.60.3", "systems": { "aarch64-darwin": { "outputs": [ { "name": "out", - "path": "/nix/store/k3rnfx753gnx5v8l3i4sx1g1al2ds0di-golangci-lint-1.59.1", + "path": "/nix/store/fvbi7pzail2vs96g6khy6r7xif900fqz-golangci-lint-1.60.3", "default": true } ], - "store_path": "/nix/store/k3rnfx753gnx5v8l3i4sx1g1al2ds0di-golangci-lint-1.59.1" + "store_path": "/nix/store/fvbi7pzail2vs96g6khy6r7xif900fqz-golangci-lint-1.60.3" }, "aarch64-linux": { "outputs": [ { "name": "out", - "path": "/nix/store/29908ar68rrr9jzdhzcrlkbfk30gnihf-golangci-lint-1.59.1", + "path": "/nix/store/8lff7iyx0d3r2w7i1gd2rbacxhbadqfm-golangci-lint-1.60.3", "default": true } ], - "store_path": "/nix/store/29908ar68rrr9jzdhzcrlkbfk30gnihf-golangci-lint-1.59.1" + "store_path": "/nix/store/8lff7iyx0d3r2w7i1gd2rbacxhbadqfm-golangci-lint-1.60.3" }, "x86_64-darwin": { "outputs": [ { "name": "out", - "path": "/nix/store/v7882fqgdy46a7l432q11f3xmbln80rc-golangci-lint-1.59.1", + "path": "/nix/store/yfqq3qrszh5gb61kfnhl723c1mqn81wl-golangci-lint-1.60.3", "default": true } ], - "store_path": "/nix/store/v7882fqgdy46a7l432q11f3xmbln80rc-golangci-lint-1.59.1" + "store_path": "/nix/store/yfqq3qrszh5gb61kfnhl723c1mqn81wl-golangci-lint-1.60.3" }, "x86_64-linux": { "outputs": [ { "name": "out", - "path": "/nix/store/1m1i9zhrgdw2192803n6wf2k7g86y6d5-golangci-lint-1.59.1", + "path": "/nix/store/w01f9xdl47bf7d94hjma50c8ng1q712d-golangci-lint-1.60.3", "default": true } ], - "store_path": "/nix/store/1m1i9zhrgdw2192803n6wf2k7g86y6d5-golangci-lint-1.59.1" + "store_path": "/nix/store/w01f9xdl47bf7d94hjma50c8ng1q712d-golangci-lint-1.60.3" } } }, @@ -1177,6 +1177,54 @@ } } }, + "markdownlint-cli2@latest": { + "last_modified": "2024-08-14T11:41:26Z", + "resolved": "github:NixOS/nixpkgs/0cb2fd7c59fed0cd82ef858cbcbdb552b9a33465#markdownlint-cli2", + "source": "devbox-search", + "version": "0.13.0", + "systems": { + "aarch64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/j1qj9par93gh0v3l61nwqr1jwkgk6qlw-markdownlint-cli2-0.13.0", + "default": true + } + ], + "store_path": "/nix/store/j1qj9par93gh0v3l61nwqr1jwkgk6qlw-markdownlint-cli2-0.13.0" + }, + "aarch64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/hz82753mm6virrr4adl1f6dwbg0z1qbh-markdownlint-cli2-0.13.0", + "default": true + } + ], + "store_path": "/nix/store/hz82753mm6virrr4adl1f6dwbg0z1qbh-markdownlint-cli2-0.13.0" + }, + "x86_64-darwin": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/w7qxcwmcaj34x58rda0zjxmblj0h1834-markdownlint-cli2-0.13.0", + "default": true + } + ], + "store_path": "/nix/store/w7qxcwmcaj34x58rda0zjxmblj0h1834-markdownlint-cli2-0.13.0" + }, + "x86_64-linux": { + "outputs": [ + { + "name": "out", + "path": "/nix/store/a0znzws3mmpdg2yi9mf375np3g21xrzp-markdownlint-cli2-0.13.0", + "default": true + } + ], + "store_path": "/nix/store/a0znzws3mmpdg2yi9mf375np3g21xrzp-markdownlint-cli2-0.13.0" + } + } + }, "maven@3.8.6": { "last_modified": "2023-06-18T07:20:12Z", "resolved": "github:NixOS/nixpkgs/4d887ae7666a6ffb79e1767d8fd417daf9e4220f#maven", @@ -1666,7 +1714,6 @@ }, "ruby@latest": { "last_modified": "2024-08-14T11:41:26Z", - "plugin_version": "0.0.2", "resolved": "github:NixOS/nixpkgs/0cb2fd7c59fed0cd82ef858cbcbdb552b9a33465#ruby_3_3", "source": "devbox-search", "version": "3.3.4", diff --git a/packages/eventgenerator/spec b/packages/eventgenerator/spec index b1545179ec..2083d76652 100644 --- a/packages/eventgenerator/spec +++ b/packages/eventgenerator/spec @@ -8,6 +8,8 @@ files: - autoscaler/* - autoscaler/vendor/* - autoscaler/eventgenerator/db/* +- autoscaler/vendor/google.golang.org/genproto/googleapis/api/* +- autoscaler/vendor/google.golang.org/protobuf/types/descriptorpb/* - autoscaler/cf/* # gosub - autoscaler/collection/* # gosub - autoscaler/db/* # gosub @@ -27,10 +29,10 @@ files: - autoscaler/routes/* # gosub - autoscaler/vendor/code.cloudfoundry.org/cfhttp/v2/* # gosub - autoscaler/vendor/code.cloudfoundry.org/clock/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-log-cache/v2/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-log-cache/v2/internal/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-log-cache/v3/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-log-cache/v3/internal/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2/* # gosub - autoscaler/vendor/code.cloudfoundry.org/lager/v3/* # gosub - autoscaler/vendor/code.cloudfoundry.org/lager/v3/internal/truncate/* # gosub - autoscaler/vendor/code.cloudfoundry.org/tlsconfig/* # gosub @@ -72,9 +74,18 @@ files: - autoscaler/vendor/github.com/jackc/puddle/v2/internal/genstack/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/reflectx/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/fse/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/huff0/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/cpuinfo/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/snapref/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/internal/xxhash/* # gosub - autoscaler/vendor/github.com/munnerz/goautoneg/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/idgenerator/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/model/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/collectors/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/internal/* # gosub @@ -146,7 +157,6 @@ files: - autoscaler/vendor/golang.org/x/text/unicode/bidi/* # gosub - autoscaler/vendor/golang.org/x/text/unicode/norm/* # gosub - autoscaler/vendor/golang.org/x/text/width/* # gosub -- autoscaler/vendor/google.golang.org/genproto/googleapis/api/* # gosub - autoscaler/vendor/google.golang.org/genproto/googleapis/api/annotations/* # gosub - autoscaler/vendor/google.golang.org/genproto/googleapis/api/httpbody/* # gosub - autoscaler/vendor/google.golang.org/genproto/googleapis/rpc/status/* # gosub @@ -166,7 +176,9 @@ files: - autoscaler/vendor/google.golang.org/grpc/credentials/insecure/* # gosub - autoscaler/vendor/google.golang.org/grpc/encoding/* # gosub - autoscaler/vendor/google.golang.org/grpc/encoding/proto/* # gosub +- autoscaler/vendor/google.golang.org/grpc/experimental/stats/* # gosub - autoscaler/vendor/google.golang.org/grpc/grpclog/* # gosub +- autoscaler/vendor/google.golang.org/grpc/grpclog/internal/* # gosub - autoscaler/vendor/google.golang.org/grpc/health/grpc_health_v1/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/backoff/* # gosub @@ -189,11 +201,13 @@ files: - autoscaler/vendor/google.golang.org/grpc/internal/resolver/passthrough/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/resolver/unix/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/serviceconfig/* # gosub +- autoscaler/vendor/google.golang.org/grpc/internal/stats/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/status/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/syscall/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/transport/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/transport/networktype/* # gosub - autoscaler/vendor/google.golang.org/grpc/keepalive/* # gosub +- autoscaler/vendor/google.golang.org/grpc/mem/* # gosub - autoscaler/vendor/google.golang.org/grpc/metadata/* # gosub - autoscaler/vendor/google.golang.org/grpc/peer/* # gosub - autoscaler/vendor/google.golang.org/grpc/resolver/* # gosub @@ -232,7 +246,6 @@ files: - autoscaler/vendor/google.golang.org/protobuf/reflect/protoregistry/* # gosub - autoscaler/vendor/google.golang.org/protobuf/runtime/protoiface/* # gosub - autoscaler/vendor/google.golang.org/protobuf/runtime/protoimpl/* # gosub -- autoscaler/vendor/google.golang.org/protobuf/types/descriptorpb/* # gosub - autoscaler/vendor/google.golang.org/protobuf/types/known/anypb/* # gosub - autoscaler/vendor/google.golang.org/protobuf/types/known/durationpb/* # gosub - autoscaler/vendor/google.golang.org/protobuf/types/known/fieldmaskpb/* # gosub diff --git a/packages/golangapiserver/spec b/packages/golangapiserver/spec index a984b58a25..e1c978652b 100644 --- a/packages/golangapiserver/spec +++ b/packages/golangapiserver/spec @@ -76,6 +76,13 @@ files: - autoscaler/vendor/github.com/jackc/puddle/v2/internal/genstack/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/reflectx/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/fse/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/huff0/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/cpuinfo/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/snapref/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/internal/xxhash/* # gosub - autoscaler/vendor/github.com/mattn/go-colorable/* # gosub - autoscaler/vendor/github.com/mattn/go-isatty/* # gosub - autoscaler/vendor/github.com/munnerz/goautoneg/* # gosub @@ -107,6 +114,8 @@ files: - autoscaler/vendor/github.com/pivotal-cf/brokerapi/v11/internal/blog/* # gosub - autoscaler/vendor/github.com/pivotal-cf/brokerapi/v11/middlewares/* # gosub - autoscaler/vendor/github.com/pivotal-cf/brokerapi/v11/utils/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/collectors/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/internal/* # gosub @@ -227,5 +236,7 @@ files: - autoscaler/vendor/google.golang.org/protobuf/runtime/protoiface/* # gosub - autoscaler/vendor/google.golang.org/protobuf/runtime/protoimpl/* # gosub - autoscaler/vendor/google.golang.org/protobuf/types/known/timestamppb/* # gosub +- autoscaler/vendor/gopkg.in/errgo.v2/errors/* # gosub +- autoscaler/vendor/gopkg.in/errgo.v2/fmt/errors/* # gosub - autoscaler/vendor/gopkg.in/yaml.v2/* # gosub - autoscaler/vendor/gopkg.in/yaml.v3/* # gosub diff --git a/packages/metricsforwarder/spec b/packages/metricsforwarder/spec index 411094f8a3..9541b95fa5 100644 --- a/packages/metricsforwarder/spec +++ b/packages/metricsforwarder/spec @@ -29,9 +29,9 @@ files: - autoscaler/vendor/code.cloudfoundry.org/cfhttp/v2/* # gosub - autoscaler/vendor/code.cloudfoundry.org/clock/* # gosub - autoscaler/vendor/code.cloudfoundry.org/go-diodes/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v9/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v9/rfc5424/* # gosub -- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v10/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v10/rfc5424/* # gosub +- autoscaler/vendor/code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2/* # gosub - autoscaler/vendor/code.cloudfoundry.org/go-metric-registry/* # gosub - autoscaler/vendor/code.cloudfoundry.org/lager/v3/* # gosub - autoscaler/vendor/code.cloudfoundry.org/lager/v3/internal/truncate/* # gosub @@ -88,6 +88,8 @@ files: - autoscaler/vendor/github.com/openzipkin/zipkin-go/idgenerator/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/model/* # gosub - autoscaler/vendor/github.com/patrickmn/go-cache/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/collectors/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/internal/* # gosub @@ -180,7 +182,9 @@ files: - autoscaler/vendor/google.golang.org/grpc/credentials/insecure/* # gosub - autoscaler/vendor/google.golang.org/grpc/encoding/* # gosub - autoscaler/vendor/google.golang.org/grpc/encoding/proto/* # gosub +- autoscaler/vendor/google.golang.org/grpc/experimental/stats/* # gosub - autoscaler/vendor/google.golang.org/grpc/grpclog/* # gosub +- autoscaler/vendor/google.golang.org/grpc/grpclog/internal/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/backoff/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/balancer/gracefulswitch/* # gosub @@ -202,11 +206,13 @@ files: - autoscaler/vendor/google.golang.org/grpc/internal/resolver/passthrough/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/resolver/unix/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/serviceconfig/* # gosub +- autoscaler/vendor/google.golang.org/grpc/internal/stats/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/status/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/syscall/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/transport/* # gosub - autoscaler/vendor/google.golang.org/grpc/internal/transport/networktype/* # gosub - autoscaler/vendor/google.golang.org/grpc/keepalive/* # gosub +- autoscaler/vendor/google.golang.org/grpc/mem/* # gosub - autoscaler/vendor/google.golang.org/grpc/metadata/* # gosub - autoscaler/vendor/google.golang.org/grpc/peer/* # gosub - autoscaler/vendor/google.golang.org/grpc/resolver/* # gosub diff --git a/packages/operator/spec b/packages/operator/spec index d5d678c02c..df2d29b993 100644 --- a/packages/operator/spec +++ b/packages/operator/spec @@ -55,9 +55,18 @@ files: - autoscaler/vendor/github.com/jackc/puddle/v2/internal/genstack/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/reflectx/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/fse/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/huff0/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/cpuinfo/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/snapref/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/internal/xxhash/* # gosub - autoscaler/vendor/github.com/munnerz/goautoneg/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/idgenerator/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/model/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/collectors/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/internal/* # gosub diff --git a/packages/scalingengine/spec b/packages/scalingengine/spec index 4bac7005dc..293a9cd454 100644 --- a/packages/scalingengine/spec +++ b/packages/scalingengine/spec @@ -67,6 +67,13 @@ files: - autoscaler/vendor/github.com/jackc/puddle/v2/internal/genstack/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/* # gosub - autoscaler/vendor/github.com/jmoiron/sqlx/reflectx/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/fse/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/huff0/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/cpuinfo/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/internal/snapref/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/* # gosub +- autoscaler/vendor/github.com/klauspost/compress/zstd/internal/xxhash/* # gosub - autoscaler/vendor/github.com/mattn/go-colorable/* # gosub - autoscaler/vendor/github.com/mattn/go-isatty/* # gosub - autoscaler/vendor/github.com/munnerz/goautoneg/* # gosub @@ -89,6 +96,8 @@ files: - autoscaler/vendor/github.com/ogen-go/ogen/validate/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/idgenerator/* # gosub - autoscaler/vendor/github.com/openzipkin/zipkin-go/model/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/* # gosub +- autoscaler/vendor/github.com/prometheus/client_golang/internal/github.com/golang/gddo/httputil/header/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/collectors/* # gosub - autoscaler/vendor/github.com/prometheus/client_golang/prometheus/internal/* # gosub diff --git a/renovate.json b/renovate.json index 74347833a5..e62414466b 100644 --- a/renovate.json +++ b/renovate.json @@ -61,7 +61,8 @@ "groupName": "Cloud Foundry Logging and Metrics", "matchPackageNames": [ "/loggregator/", - "/log-cache/" + "/log-cache/", + "/loggregator-agent-release/" ] } ], diff --git a/src/acceptance/assets/app/go_app/internal/app/cpu.go b/src/acceptance/assets/app/go_app/internal/app/cpu.go index 35733cb307..e194ec6f89 100644 --- a/src/acceptance/assets/app/go_app/internal/app/cpu.go +++ b/src/acceptance/assets/app/go_app/internal/app/cpu.go @@ -13,7 +13,7 @@ import ( //counterfeiter:generate . CPUWaster type CPUWaster interface { - UseCPU(utilisation uint64, duration time.Duration) + UseCPU(utilisation int64, duration time.Duration) IsRunning() bool StopTest() } @@ -31,15 +31,15 @@ func CPUTests(logger logr.Logger, r *gin.RouterGroup, cpuTest CPUWaster) *gin.Ro Error(c, http.StatusConflict, "CPU test is already running") return } - var utilization uint64 - var minutes uint64 + var utilization int64 + var minutes int64 var err error - utilization, err = strconv.ParseUint(c.Param("utilization"), 10, 64) + utilization, err = strconv.ParseInt(c.Param("utilization"), 10, 64) if err != nil { Error(c, http.StatusBadRequest, "invalid utilization: %s", err.Error()) return } - if minutes, err = strconv.ParseUint(c.Param("minutes"), 10, 64); err != nil { + if minutes, err = strconv.ParseInt(c.Param("minutes"), 10, 64); err != nil { Error(c, http.StatusBadRequest, "invalid minutes: %s", err.Error()) return } @@ -62,7 +62,7 @@ func CPUTests(logger logr.Logger, r *gin.RouterGroup, cpuTest CPUWaster) *gin.Ro return r } -func (m *ConcurrentBusyLoopCPUWaster) UseCPU(utilisation uint64, duration time.Duration) { +func (m *ConcurrentBusyLoopCPUWaster) UseCPU(utilisation int64, duration time.Duration) { m.startTest() for utilisation > 0 { @@ -71,7 +71,7 @@ func (m *ConcurrentBusyLoopCPUWaster) UseCPU(utilisation uint64, duration time.D utilisation = utilisation - perGoRoutineUtilisation // the core cpu wasting goroutine - go func(util uint64) { + go func(util int64) { // to achieve a desired utilisation, we run a busy loop for a certain percentage of time and then wait for the remainder // concretely, we split a second into two parts: one busy loop and one sleep // we repeat this "second" until the test is stopped diff --git a/src/acceptance/assets/app/go_app/internal/app/cpu_test.go b/src/acceptance/assets/app/go_app/internal/app/cpu_test.go index 7541a2bd0f..f423da7dbf 100644 --- a/src/acceptance/assets/app/go_app/internal/app/cpu_test.go +++ b/src/acceptance/assets/app/go_app/internal/app/cpu_test.go @@ -21,7 +21,7 @@ var _ = Describe("CPU tests", func() { Get("/cpu/invalid/4"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid utilization: strconv.ParseUint: parsing \"invalid\": invalid syntax"}}`). + Body(`{"error":{"description":"invalid utilization: strconv.ParseInt: parsing \"invalid\": invalid syntax"}}`). End() }) It("should err if cpu out of bounds", func() { @@ -29,7 +29,7 @@ var _ = Describe("CPU tests", func() { Get("/cpu/100001010101010249032897287298719874687936483275648273632429479827398798271/4"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid utilization: strconv.ParseUint: parsing \"100001010101010249032897287298719874687936483275648273632429479827398798271\": value out of range"}}`). + Body(`{"error":{"description":"invalid utilization: strconv.ParseInt: parsing \"100001010101010249032897287298719874687936483275648273632429479827398798271\": value out of range"}}`). End() }) It("should err if cpu not an int", func() { @@ -37,7 +37,7 @@ var _ = Describe("CPU tests", func() { Get("/cpu/5/invalid"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid minutes: strconv.ParseUint: parsing \"invalid\": invalid syntax"}}`). + Body(`{"error":{"description":"invalid minutes: strconv.ParseInt: parsing \"invalid\": invalid syntax"}}`). End() }) It("should return ok and sleep correctDuration", func() { @@ -51,7 +51,7 @@ var _ = Describe("CPU tests", func() { Eventually(func() int { return fakeCPUWaster.UseCPUCallCount() }).Should(Equal(1)) utilization, duration := fakeCPUWaster.UseCPUArgsForCall(0) Expect(duration).Should(Equal(4 * time.Minute)) - Expect(utilization).Should(Equal(uint64(5))) + Expect(utilization).Should(Equal(int64(5))) }) }) @@ -59,7 +59,7 @@ var _ = Describe("CPU tests", func() { Context("ConcurrentBusyLoopCPUWaster", func() { Context("UseCPU", FlakeAttempts(3), func() { DescribeTable("should use cpu", - func(utilisation uint64, duration time.Duration) { + func(utilisation int64, duration time.Duration) { oldCpu := getTotalCPUUsage("before test") By("wasting cpu time") @@ -86,11 +86,11 @@ var _ = Describe("CPU tests", func() { } Expect(newCpu - oldCpu).To(BeNumerically("~", expectedCPUUsage, tolerance)) }, - Entry("25% for 10 seconds", uint64(25), time.Second*10), - Entry("50% for 10 seconds", uint64(50), time.Second*10), - Entry("100% for 10 seconds", uint64(100), time.Second*10), - Entry("200% for 10 seconds", uint64(200), time.Second*10), - Entry("400% for 10 seconds", uint64(400), time.Second*10), + Entry("25% for 10 seconds", int64(25), time.Second*10), + Entry("50% for 10 seconds", int64(50), time.Second*10), + Entry("100% for 10 seconds", int64(100), time.Second*10), + Entry("200% for 10 seconds", int64(200), time.Second*10), + Entry("400% for 10 seconds", int64(400), time.Second*10), ) }) }) @@ -107,6 +107,6 @@ func getTotalCPUUsage(action string) time.Duration { return cpuTotalDuration } -func multiplyDurationByPercentage(duration time.Duration, percentage uint64) time.Duration { +func multiplyDurationByPercentage(duration time.Duration, percentage int64) time.Duration { return time.Duration(float64(duration) * float64(percentage) / 100) } diff --git a/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go b/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go index b295a7c096..26d919ab8c 100644 --- a/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go +++ b/src/acceptance/assets/app/go_app/internal/app/custom_metrics.go @@ -169,8 +169,7 @@ func getCFInstanceIdentityCertificateClient() (*http.Client, error) { caCertPool := x509.NewCertPool() caCertPool.AppendCertsFromPEM(caCertBytes) - /* #nosec G402 -- test app that shall run on dev foundations without proper certs */ - //nolint:gosec // #nosec G402 -- due to https://github.com/securego/gosec/issues/1105 + //#nosec G402 -- test app that shall run on dev foundations without proper certs tlsConfig := &tls.Config{ Certificates: []tls.Certificate{cert}, InsecureSkipVerify: true, diff --git a/src/acceptance/assets/app/go_app/internal/app/memory.go b/src/acceptance/assets/app/go_app/internal/app/memory.go index 0893a37261..27e51be3c7 100644 --- a/src/acceptance/assets/app/go_app/internal/app/memory.go +++ b/src/acceptance/assets/app/go_app/internal/app/memory.go @@ -24,7 +24,7 @@ const ( //counterfeiter:generate . MemoryGobbler type MemoryGobbler interface { - UseMemory(numBytes uint64) + UseMemory(numBytes int64) Sleep(sleepTime time.Duration) IsRunning() bool StopTest() @@ -44,15 +44,15 @@ func MemoryTests(logger logr.Logger, r *gin.RouterGroup, memoryTest MemoryGobble Error(c, http.StatusConflict, "memory test is already running") return } - var memoryMiB uint64 - var minutes uint64 + var memoryMiB int64 + var minutes int64 var err error - memoryMiB, err = strconv.ParseUint(c.Param("memoryMiB"), 10, 64) + memoryMiB, err = strconv.ParseInt(c.Param("memoryMiB"), 10, 64) if err != nil { Error(c, http.StatusBadRequest, "invalid memoryMiB: %s", err.Error()) return } - if minutes, err = strconv.ParseUint(c.Param("minutes"), 10, 64); err != nil { + if minutes, err = strconv.ParseInt(c.Param("minutes"), 10, 64); err != nil { Error(c, http.StatusBadRequest, "invalid minutes: %s", err.Error()) return } @@ -97,12 +97,12 @@ func Error(c *gin.Context, status int, descriptionf string, args ...any) { const chunkSize = 4 * Kibi -func (m *ListBasedMemoryGobbler) UseMemory(numBytes uint64) { +func (m *ListBasedMemoryGobbler) UseMemory(numBytes int64) { m.mu.Lock() defer m.mu.Unlock() m.isRunning = true m.used = list.New() - used := uint64(0) + used := int64(0) for used <= numBytes { m.used.PushBack(bytes.Repeat([]byte("X"), chunkSize)) // The bytes need to be non-zero to force memory allocation used += chunkSize diff --git a/src/acceptance/assets/app/go_app/internal/app/memory_test.go b/src/acceptance/assets/app/go_app/internal/app/memory_test.go index 854f62ebbd..82dc1e6d23 100644 --- a/src/acceptance/assets/app/go_app/internal/app/memory_test.go +++ b/src/acceptance/assets/app/go_app/internal/app/memory_test.go @@ -1,6 +1,7 @@ package app_test import ( + "math" "net/http" "runtime" "time" @@ -22,7 +23,7 @@ var _ = Describe("Memory tests", func() { Get("/memory/invalid/4"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid memoryMiB: strconv.ParseUint: parsing \"invalid\": invalid syntax"}}`). + Body(`{"error":{"description":"invalid memoryMiB: strconv.ParseInt: parsing \"invalid\": invalid syntax"}}`). End() }) It("should err if memory out of bounds", func() { @@ -30,7 +31,7 @@ var _ = Describe("Memory tests", func() { Get("/memory/100001010101010249032897287298719874687936483275648273632429479827398798271/4"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid memoryMiB: strconv.ParseUint: parsing \"100001010101010249032897287298719874687936483275648273632429479827398798271\": value out of range"}}`). + Body(`{"error":{"description":"invalid memoryMiB: strconv.ParseInt: parsing \"100001010101010249032897287298719874687936483275648273632429479827398798271\": value out of range"}}`). End() }) It("should err if memory not an int", func() { @@ -38,7 +39,7 @@ var _ = Describe("Memory tests", func() { Get("/memory/5/invalid"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid minutes: strconv.ParseUint: parsing \"invalid\": invalid syntax"}}`). + Body(`{"error":{"description":"invalid minutes: strconv.ParseInt: parsing \"invalid\": invalid syntax"}}`). End() }) It("should return ok and sleep correctDuration", func() { @@ -55,7 +56,7 @@ var _ = Describe("Memory tests", func() { // http-features (i.e. returing http-status-code 202 etc.) which would involve a lot of // new lines of code. Eventually(func() int { return fakeMemoryTest.UseMemoryCallCount() }).Should(Equal(1)) - Expect(fakeMemoryTest.UseMemoryArgsForCall(0)).To(Equal(uint64(5 * app.Mebi))) + Expect(fakeMemoryTest.UseMemoryArgsForCall(0)).To(Equal(int64(5 * app.Mebi))) Eventually(func() int { return fakeMemoryTest.SleepCallCount() }).Should(Equal(1)) Expect(fakeMemoryTest.SleepArgsForCall(0)).To(Equal(4 * time.Minute)) Eventually(func() int { return fakeMemoryTest.StopTestCallCount() }).Should(Equal(1)) @@ -63,7 +64,7 @@ var _ = Describe("Memory tests", func() { }) Context("memTest info tests", func() { It("should gobble memory and release when stopped", func() { - var allocInMebi uint64 = 50 * app.Mebi + var allocInMebi int64 = 50 * app.Mebi oldMem := getTotalMemoryUsage("before memTest info test") @@ -95,7 +96,7 @@ var _ = Describe("Memory tests", func() { }) }) -func getTotalMemoryUsage(action string) uint64 { +func getTotalMemoryUsage(action string) int64 { GinkgoHelper() runtime.GC() @@ -106,7 +107,7 @@ func getTotalMemoryUsage(action string) uint64 { result := m.Alloc GinkgoWriter.Printf("total memory usage %s: %d MiB\n", action, result/app.Mebi) - return result + return clampUint64ToInt64(result) } // HeapInuse minus HeapAlloc estimates the amount of memory @@ -114,7 +115,7 @@ func getTotalMemoryUsage(action string) uint64 { // not currently being used. This is an upper bound on // fragmentation, but in general this memory can be reused // efficiently. -func getMemorySlack() uint64 { +func getMemorySlack() int64 { runtime.GC() var ms runtime.MemStats runtime.ReadMemStats(&ms) @@ -123,5 +124,16 @@ func getMemorySlack() uint64 { GinkgoWriter.Printf("slack: %d MiB\n", slack/app.Mebi) - return slack + return clampUint64ToInt64(slack) +} + +func clampUint64ToInt64(value uint64) int64 { + var result int64 + + if value > math.MaxInt64 { + result = math.MaxInt64 + } else { + result = int64(value) //#nosec G115 -- https://github.com/securego/gosec/issues/1187 + } + return result } diff --git a/src/acceptance/assets/app/go_app/internal/app/responsetime.go b/src/acceptance/assets/app/go_app/internal/app/responsetime.go index b42a87c12b..cd97101a11 100644 --- a/src/acceptance/assets/app/go_app/internal/app/responsetime.go +++ b/src/acceptance/assets/app/go_app/internal/app/responsetime.go @@ -20,9 +20,9 @@ var _ TimeWaster = Sleeper{} func ResponseTimeTests(logger logr.Logger, r *gin.RouterGroup, timeWaster TimeWaster) *gin.RouterGroup { r.GET("/slow/:delayInMS", func(c *gin.Context) { - var milliseconds uint64 + var milliseconds int64 var err error - if milliseconds, err = strconv.ParseUint(c.Param("delayInMS"), 10, 64); err != nil { + if milliseconds, err = strconv.ParseInt(c.Param("delayInMS"), 10, 64); err != nil { Error(c, http.StatusBadRequest, "invalid milliseconds: %s", err.Error()) return } diff --git a/src/acceptance/assets/app/go_app/internal/app/responsetime_test.go b/src/acceptance/assets/app/go_app/internal/app/responsetime_test.go index bf0f00d076..0c64906eb8 100644 --- a/src/acceptance/assets/app/go_app/internal/app/responsetime_test.go +++ b/src/acceptance/assets/app/go_app/internal/app/responsetime_test.go @@ -19,7 +19,7 @@ var _ = Describe("Responsetime tests", func() { Get("/responsetime/slow/yes"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid milliseconds: strconv.ParseUint: parsing \"yes\": invalid syntax"}}`). + Body(`{"error":{"description":"invalid milliseconds: strconv.ParseInt: parsing \"yes\": invalid syntax"}}`). End() }) It("should err if memory out of bounds", func() { @@ -27,7 +27,7 @@ var _ = Describe("Responsetime tests", func() { Get("/responsetime/slow/100001010101010249032897287298719874687936483275648273632429479827398798271"). Expect(GinkgoT()). Status(http.StatusBadRequest). - Body(`{"error":{"description":"invalid milliseconds: strconv.ParseUint: parsing \"100001010101010249032897287298719874687936483275648273632429479827398798271\": value out of range"}}`). + Body(`{"error":{"description":"invalid milliseconds: strconv.ParseInt: parsing \"100001010101010249032897287298719874687936483275648273632429479827398798271\": value out of range"}}`). End() }) diff --git a/src/acceptance/assets/app/go_app/internal/custommetrics/basic_auth_transport.go b/src/acceptance/assets/app/go_app/internal/custommetrics/basic_auth_transport.go index e0f311562d..22abb1addb 100644 --- a/src/acceptance/assets/app/go_app/internal/custommetrics/basic_auth_transport.go +++ b/src/acceptance/assets/app/go_app/internal/custommetrics/basic_auth_transport.go @@ -25,8 +25,7 @@ func (bat *BasicAuthTransport) Client() *http.Client { } func NewBasicAuthTransport(credentials CustomMetricsCredentials) *BasicAuthTransport { - /* #nosec G402 -- test app that shall run on dev foundations without proper certs */ - //nolint:gosec // #nosec G402 -- due to https://github.com/securego/gosec/issues/1105 + //#nosec G402 -- test app that shall run on dev foundations without proper certs tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } diff --git a/src/autoscaler/api/broker/broker.go b/src/autoscaler/api/broker/broker.go index c3bd81b975..05d15baada 100644 --- a/src/autoscaler/api/broker/broker.go +++ b/src/autoscaler/api/broker/broker.go @@ -737,7 +737,7 @@ func (b *Broker) planDefinitionExceeded(policy *models.ScalingPolicy, planID str return apiresponses.NewFailureResponse(errors.New("error validating policy"), http.StatusInternalServerError, "failed to check policy for plan adherence") } if !ok { - b.logger.Error("policy did not adhere to plan", fmt.Errorf(checkResult), lager.Data{"instanceID": instanceID, "policy": policy}) + b.logger.Error("policy did not adhere to plan", errors.New(checkResult), lager.Data{"instanceID": instanceID, "policy": policy}) return apiresponses.NewFailureResponse(fmt.Errorf("error: policy did not adhere to plan: %s", checkResult), http.StatusBadRequest, "policy did not adhere to plan") } return nil diff --git a/src/autoscaler/api/config/config.go b/src/autoscaler/api/config/config.go index a9a286f4a9..33ae26ca4f 100644 --- a/src/autoscaler/api/config/config.go +++ b/src/autoscaler/api/config/config.go @@ -11,6 +11,7 @@ import ( "golang.org/x/crypto/bcrypt" "github.com/xeipuuv/gojsonschema" + "gopkg.in/errgo.v2/fmt/errors" "gopkg.in/yaml.v3" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/db" @@ -267,7 +268,7 @@ func (c *Config) Validate() error { } } errString += "}" - return fmt.Errorf(errString) + return errors.New(errString) } return nil diff --git a/src/autoscaler/api/policyvalidator/policy_validator.go b/src/autoscaler/api/policyvalidator/policy_validator.go index 966107234b..6f55d2c0ef 100644 --- a/src/autoscaler/api/policyvalidator/policy_validator.go +++ b/src/autoscaler/api/policyvalidator/policy_validator.go @@ -415,7 +415,7 @@ func (pv *PolicyValidator) validateOverlappingInRecurringSchedules(policy *model recScheds := policy.Schedules.RecurringSchedules for scheduleIndexB := 0; scheduleIndexB < length-1; scheduleIndexB++ { for scheduleIndexA := scheduleIndexB + 1; scheduleIndexA < length; scheduleIndexA++ { - if (recScheds[scheduleIndexA].DaysOfWeek != nil && len(recScheds[scheduleIndexA].DaysOfWeek) > 0) && (recScheds[scheduleIndexB].DaysOfWeek != nil && len(recScheds[scheduleIndexB].DaysOfWeek) > 0) { + if (len(recScheds[scheduleIndexA].DaysOfWeek) > 0) && (len(recScheds[scheduleIndexB].DaysOfWeek) > 0) { if hasIntersection(recScheds[scheduleIndexA].DaysOfWeek, recScheds[scheduleIndexB].DaysOfWeek) { if compareTimesGTEQ(recScheds[scheduleIndexB].EndTime, recScheds[scheduleIndexA].StartTime) && compareTimesGTEQ(recScheds[scheduleIndexA].EndTime, recScheds[scheduleIndexB].StartTime) && compareDatesGTEQ(recScheds[scheduleIndexB].EndDate, recScheds[scheduleIndexA].StartDate) && compareDatesGTEQ(recScheds[scheduleIndexA].EndDate, recScheds[scheduleIndexB].StartDate) { @@ -432,7 +432,7 @@ func (pv *PolicyValidator) validateOverlappingInRecurringSchedules(policy *model } } - if (recScheds[scheduleIndexA].DaysOfMonth != nil && len(recScheds[scheduleIndexA].DaysOfMonth) > 0) && (recScheds[scheduleIndexB].DaysOfMonth != nil && len(recScheds[scheduleIndexB].DaysOfMonth) > 0) { + if (len(recScheds[scheduleIndexA].DaysOfMonth) > 0) && (len(recScheds[scheduleIndexB].DaysOfMonth) > 0) { if hasIntersection(recScheds[scheduleIndexA].DaysOfMonth, recScheds[scheduleIndexB].DaysOfMonth) { if compareTimesGTEQ(recScheds[scheduleIndexB].EndTime, recScheds[scheduleIndexA].StartTime) && compareTimesGTEQ(recScheds[scheduleIndexA].EndTime, recScheds[scheduleIndexB].StartTime) && compareDatesGTEQ(recScheds[scheduleIndexB].EndDate, recScheds[scheduleIndexA].StartDate) && compareDatesGTEQ(recScheds[scheduleIndexA].EndDate, recScheds[scheduleIndexB].StartDate) { diff --git a/src/autoscaler/cf/oauth.go b/src/autoscaler/cf/oauth.go index 8fe6c938dc..f5c37196e7 100644 --- a/src/autoscaler/cf/oauth.go +++ b/src/autoscaler/cf/oauth.go @@ -17,8 +17,8 @@ const ( ) var ( - ErrUnauthorized = fmt.Errorf(http.StatusText(http.StatusUnauthorized)) - ErrInvalidTokenFormat = fmt.Errorf("Invalid token format") + ErrUnauthorized = errors.New(http.StatusText(http.StatusUnauthorized)) + ErrInvalidTokenFormat = errors.New("invalid token format") ) func (c *Client) IsUserSpaceDeveloper(userToken string, appId Guid) (bool, error) { diff --git a/src/autoscaler/envelopeprocessor/envelope_processor.go b/src/autoscaler/envelopeprocessor/envelope_processor.go index f24a064b76..78686d544e 100644 --- a/src/autoscaler/envelopeprocessor/envelope_processor.go +++ b/src/autoscaler/envelopeprocessor/envelope_processor.go @@ -8,7 +8,7 @@ import ( "time" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3" "golang.org/x/exp/maps" ) @@ -112,7 +112,7 @@ func getResponsetimeInstanceMetrics(envelopes []*loggregator_v2.Envelope, appID responseTimeMetric := models.AppInstanceMetric{ AppId: appID, - InstanceIndex: uint32(instanceIndex), + InstanceIndex: instanceIndex, Name: models.MetricNameResponseTime, Unit: models.UnitMilliseconds, Value: fmt.Sprintf("%d", int64(math.Ceil(float64(sumResponseTime)/float64(numReq*1000*1000)))), @@ -145,7 +145,7 @@ func getThroughputInstanceMetrics(envelopes []*loggregator_v2.Envelope, appID st throughputMetric := models.AppInstanceMetric{ AppId: appID, - InstanceIndex: uint32(instanceIndex), + InstanceIndex: instanceIndex, Name: models.MetricNameThroughput, Unit: models.UnitRPS, Value: fmt.Sprintf("%d", int(math.Ceil(float64(numReq)/collectionInterval.Seconds()))), @@ -196,13 +196,13 @@ func isContainerMetricEnvelope(e *loggregator_v2.Envelope) bool { func processContainerMetrics(e *loggregator_v2.Envelope, currentTimeStamp int64) []models.AppInstanceMetric { var metrics []models.AppInstanceMetric appID := e.SourceId - instanceIndex, _ := strconv.ParseInt(e.InstanceId, 10, 32) + instanceIndex, _ := strconv.ParseUint(e.InstanceId, 10, 64) g := e.GetGauge() timestamp := e.Timestamp baseAppInstanceMetric := models.AppInstanceMetric{ AppId: appID, - InstanceIndex: uint32(instanceIndex), + InstanceIndex: instanceIndex, CollectedAt: currentTimeStamp, Timestamp: timestamp, } @@ -296,12 +296,12 @@ func getCPUEntitlementInstanceMetric(cpuEntitlementValue float64) models.AppInst func processCustomMetrics(e *loggregator_v2.Envelope, currentTimestamp int64) []models.AppInstanceMetric { var metrics []models.AppInstanceMetric - instanceIndex, _ := strconv.ParseInt(e.InstanceId, 10, 32) + instanceIndex, _ := strconv.ParseUint(e.InstanceId, 10, 64) for n, v := range e.GetGauge().GetMetrics() { metrics = append(metrics, models.AppInstanceMetric{ AppId: e.SourceId, - InstanceIndex: uint32(instanceIndex), + InstanceIndex: instanceIndex, CollectedAt: currentTimestamp, Name: n, Unit: v.Unit, diff --git a/src/autoscaler/envelopeprocessor/envelopeprocessor_test.go b/src/autoscaler/envelopeprocessor/envelopeprocessor_test.go index 274712847d..4f46547cb4 100644 --- a/src/autoscaler/envelopeprocessor/envelopeprocessor_test.go +++ b/src/autoscaler/envelopeprocessor/envelopeprocessor_test.go @@ -7,7 +7,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/envelopeprocessor" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3/lagertest" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/src/autoscaler/eventgenerator/aggregator/appManager.go b/src/autoscaler/eventgenerator/aggregator/appManager.go index abdb50b3ec..ccfe7574b1 100644 --- a/src/autoscaler/eventgenerator/aggregator/appManager.go +++ b/src/autoscaler/eventgenerator/aggregator/appManager.go @@ -103,6 +103,7 @@ func (am *AppManager) retrievePolicies() ([]*models.PolicyJson, error) { } func (am *AppManager) isEventgeneratorRespForApp(appID string) bool { + // #nosec G115 -- nodes will be in the range of a dozen max - no need to worry about integer overflow return helpers.FNVHash(appID)%uint32(am.nodeNum) == uint32(am.nodeIndex) } diff --git a/src/autoscaler/eventgenerator/aggregator/metric_poller_test.go b/src/autoscaler/eventgenerator/aggregator/metric_poller_test.go index 396b9f46eb..0becab0103 100644 --- a/src/autoscaler/eventgenerator/aggregator/metric_poller_test.go +++ b/src/autoscaler/eventgenerator/aggregator/metric_poller_test.go @@ -11,8 +11,8 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/eventgenerator/metric" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/testhelpers" - rpc "code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + rpc "code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3/lagertest" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/src/autoscaler/eventgenerator/cmd/eventgenerator/eventgenerator_suite_test.go b/src/autoscaler/eventgenerator/cmd/eventgenerator/eventgenerator_suite_test.go index 584037f2e0..dfd948e126 100644 --- a/src/autoscaler/eventgenerator/cmd/eventgenerator/eventgenerator_suite_test.go +++ b/src/autoscaler/eventgenerator/cmd/eventgenerator/eventgenerator_suite_test.go @@ -2,8 +2,8 @@ package main_test import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/testhelpers" - rpc "code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + rpc "code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/src/autoscaler/eventgenerator/metric/fetcher.go b/src/autoscaler/eventgenerator/metric/fetcher.go index 7886d96d41..98a020fea2 100644 --- a/src/autoscaler/eventgenerator/metric/fetcher.go +++ b/src/autoscaler/eventgenerator/metric/fetcher.go @@ -10,9 +10,9 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/envelopeprocessor" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - logcache "code.cloudfoundry.org/go-log-cache/v2" - "code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + logcache "code.cloudfoundry.org/go-log-cache/v3" + "code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3" ) @@ -116,7 +116,7 @@ func (l *logCacheFetcher) getMetricsPromQLAPI(appId string, metricType string, c return []models.AppInstanceMetric{}, fmt.Errorf("sample does not contain a point") } - instanceId := uint32(instanceIdUInt) + instanceId := instanceIdUInt valueWithoutDecimalsRoundedToCeiling := fmt.Sprintf("%.0f", math.Ceil(point.GetValue())) metrics = append(metrics, models.AppInstanceMetric{ diff --git a/src/autoscaler/eventgenerator/metric/fetcher_factory.go b/src/autoscaler/eventgenerator/metric/fetcher_factory.go index cec264b62e..372117d814 100644 --- a/src/autoscaler/eventgenerator/metric/fetcher_factory.go +++ b/src/autoscaler/eventgenerator/metric/fetcher_factory.go @@ -7,7 +7,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/envelopeprocessor" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/eventgenerator/config" - logcache "code.cloudfoundry.org/go-log-cache/v2" + logcache "code.cloudfoundry.org/go-log-cache/v3" "code.cloudfoundry.org/lager/v3" gogrpc "google.golang.org/grpc" "google.golang.org/grpc/credentials" diff --git a/src/autoscaler/eventgenerator/metric/fetcher_factory_test.go b/src/autoscaler/eventgenerator/metric/fetcher_factory_test.go index 49c0a09975..c408c7f412 100644 --- a/src/autoscaler/eventgenerator/metric/fetcher_factory_test.go +++ b/src/autoscaler/eventgenerator/metric/fetcher_factory_test.go @@ -13,7 +13,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/fakes" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/testhelpers" - logcache "code.cloudfoundry.org/go-log-cache/v2" + logcache "code.cloudfoundry.org/go-log-cache/v3" "code.cloudfoundry.org/lager/v3/lagertest" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -129,5 +129,6 @@ var _ = Describe("logCacheFetcherFactory", func() { func getUnexportedField(name string, client metric.LogCacheClient) interface{} { field := reflect.ValueOf(client).Elem().FieldByName(name) + // #nosec G115 -- test code return reflect.NewAt(field.Type(), unsafe.Pointer(field.UnsafeAddr())).Elem().Interface() } diff --git a/src/autoscaler/eventgenerator/metric/fetcher_test.go b/src/autoscaler/eventgenerator/metric/fetcher_test.go index 96c0a8d4c3..79324454b3 100644 --- a/src/autoscaler/eventgenerator/metric/fetcher_test.go +++ b/src/autoscaler/eventgenerator/metric/fetcher_test.go @@ -10,9 +10,9 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/eventgenerator/metric" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/fakes" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - logcache "code.cloudfoundry.org/go-log-cache/v2" - "code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + logcache "code.cloudfoundry.org/go-log-cache/v3" + "code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3/lagertest" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -77,7 +77,7 @@ var _ = Describe("logCacheFetcher", func() { Expect(err).ToNot(HaveOccurred()) Expect(metrics).To(HaveLen(1)) Expect(metrics[0].AppId).To(Equal("app-id")) - Expect(metrics[0].InstanceIndex).To(Equal(uint32(0))) + Expect(metrics[0].InstanceIndex).To(Equal(uint64(0))) Expect(metrics[0].Name).To(Equal("throughput")) Expect(metrics[0].Unit).To(Equal("rps")) Expect(metrics[0].Value).To(Equal("0")) @@ -178,13 +178,13 @@ var _ = Describe("logCacheFetcher", func() { Expect(err).ToNot(HaveOccurred()) Expect(metrics).To(HaveLen(2)) Expect(metrics[0].AppId).To(Equal("app-id")) - Expect(metrics[0].InstanceIndex).To(Equal(uint32(0))) + Expect(metrics[0].InstanceIndex).To(Equal(uint64(0))) Expect(metrics[0].Name).To(Equal("responsetime")) Expect(metrics[0].Unit).To(Equal("ms")) Expect(metrics[0].Value).To(Equal("200")) Expect(metrics[1].AppId).To(Equal("app-id")) - Expect(metrics[1].InstanceIndex).To(Equal(uint32(1))) + Expect(metrics[1].InstanceIndex).To(Equal(uint64(1))) Expect(metrics[1].Name).To(Equal("responsetime")) Expect(metrics[1].Unit).To(Equal("ms")) Expect(metrics[1].Value).To(Equal("300")) @@ -227,13 +227,13 @@ var _ = Describe("logCacheFetcher", func() { Expect(metrics).To(HaveLen(2)) Expect(metrics[0].AppId).To(Equal("app-id")) - Expect(metrics[0].InstanceIndex).To(Equal(uint32(0))) + Expect(metrics[0].InstanceIndex).To(Equal(uint64(0))) Expect(metrics[0].Name).To(Equal("throughput")) Expect(metrics[0].Unit).To(Equal("rps")) Expect(metrics[0].Value).To(Equal("123")) Expect(metrics[1].AppId).To(Equal("app-id")) - Expect(metrics[1].InstanceIndex).To(Equal(uint32(1))) + Expect(metrics[1].InstanceIndex).To(Equal(uint64(1))) Expect(metrics[1].Name).To(Equal("throughput")) Expect(metrics[1].Unit).To(Equal("rps")) Expect(metrics[1].Value).To(Equal("321")) diff --git a/src/autoscaler/go.mod b/src/autoscaler/go.mod index c6864ecdcb..b54acf36da 100644 --- a/src/autoscaler/go.mod +++ b/src/autoscaler/go.mod @@ -5,11 +5,11 @@ go 1.22.2 require ( code.cloudfoundry.org/cfhttp/v2 v2.1.0 code.cloudfoundry.org/clock v1.2.0 - code.cloudfoundry.org/go-log-cache/v2 v2.0.7 - code.cloudfoundry.org/go-loggregator/v9 v9.2.1 + code.cloudfoundry.org/go-log-cache/v3 v3.0.3 + code.cloudfoundry.org/go-loggregator/v10 v10.0.1 code.cloudfoundry.org/lager/v3 v3.0.3 - code.cloudfoundry.org/loggregator-agent-release/src v0.0.0-20240723222507-f3307e073100 - code.cloudfoundry.org/tlsconfig v0.0.0-20240730181439-b476395a9e4e + code.cloudfoundry.org/loggregator-agent-release/src v0.0.0-20240830083115-70cac7224463 + code.cloudfoundry.org/tlsconfig v0.1.0 github.com/cenkalti/backoff/v4 v4.3.0 github.com/cloud-gov/go-cfenv v1.19.1 github.com/go-chi/chi/v5 v5.1.0 @@ -24,11 +24,11 @@ require ( github.com/jmoiron/sqlx v1.4.0 github.com/maxbrunsfeld/counterfeiter/v6 v6.8.1 github.com/ogen-go/ogen v1.3.0 - github.com/onsi/ginkgo/v2 v2.20.0 - github.com/onsi/gomega v1.34.1 + github.com/onsi/ginkgo/v2 v2.20.2 + github.com/onsi/gomega v1.34.2 github.com/patrickmn/go-cache v2.1.0+incompatible github.com/pivotal-cf/brokerapi/v11 v11.0.4 - github.com/prometheus/client_golang v1.19.1 + github.com/prometheus/client_golang v1.20.2 github.com/rubyist/circuitbreaker v2.2.1+incompatible github.com/steinfletcher/apitest v1.5.16 github.com/stretchr/testify v1.9.0 @@ -45,13 +45,14 @@ require ( golang.org/x/exp v0.0.0-20240823005443-9b4947da3948 golang.org/x/net v0.28.0 golang.org/x/time v0.5.0 - google.golang.org/grpc v1.65.0 + google.golang.org/grpc v1.66.0 + gopkg.in/errgo.v2 v2.1.0 gopkg.in/yaml.v3 v3.0.1 ) require ( - code.cloudfoundry.org/go-diodes v0.0.0-20240604201846-c756bfed2ed3 // indirect - code.cloudfoundry.org/go-metric-registry v0.0.0-20240604201903-7cef498efb7a // indirect + code.cloudfoundry.org/go-diodes v0.0.0-20240813203737-5032edb05ceb // indirect + code.cloudfoundry.org/go-metric-registry v0.0.0-20240828184116-9710cd731bb8 // indirect filippo.io/edwards25519 v1.1.0 // indirect github.com/andybalholm/brotli v1.1.0 // indirect github.com/beorn7/perks v1.0.1 // indirect @@ -69,8 +70,8 @@ require ( github.com/go-logr/stdr v1.2.2 // indirect github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/google/go-cmp v0.6.0 // indirect - github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect + github.com/google/pprof v0.0.0-20240829160300-da1f7e9f2b25 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgservicefile v0.0.0-20231201235250-de7065d80cb9 // indirect @@ -84,7 +85,7 @@ require ( github.com/peterbourgon/g2s v0.0.0-20170223122336-d4e7ad98afea // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/prometheus/client_model v0.6.1 // indirect - github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/common v0.57.0 // indirect github.com/prometheus/procfs v0.15.1 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect @@ -98,8 +99,8 @@ require ( golang.org/x/sys v0.24.0 // indirect golang.org/x/text v0.17.0 // indirect golang.org/x/tools v0.24.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed // indirect google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) diff --git a/src/autoscaler/go.sum b/src/autoscaler/go.sum index ec7a6e569e..765df0339a 100644 --- a/src/autoscaler/go.sum +++ b/src/autoscaler/go.sum @@ -596,20 +596,20 @@ code.cloudfoundry.org/cfhttp/v2 v2.1.0 h1:HbQ5H2R+HEKG/rcB6Gk3okeC3h2fAC4PPnLQoM code.cloudfoundry.org/cfhttp/v2 v2.1.0/go.mod h1:k9R36Y/9dUc9OsX4dfDuEjHZ7Q00ttklKQj6HD6h6+U= code.cloudfoundry.org/clock v1.2.0 h1:1swXS7yPmQmhAdkTb1nJ2c0geOdf4LvibUleNCo2HjA= code.cloudfoundry.org/clock v1.2.0/go.mod h1:foDbmVp5RIuIGlota90ot4FkJtx5m4+oKoWiVuu2FDg= -code.cloudfoundry.org/go-diodes v0.0.0-20240604201846-c756bfed2ed3 h1:4WCYwJmqSfV7ChDohsJB8Z0aDVklIE+n8OTBJxpif0c= -code.cloudfoundry.org/go-diodes v0.0.0-20240604201846-c756bfed2ed3/go.mod h1:8O5g1DEzJU9ktEmykKPhY4mZOM/dBENWVHKVInuuch8= -code.cloudfoundry.org/go-log-cache/v2 v2.0.7 h1:yR/JjQ/RscO1n4xVAT9HDYcpx5ET/3Cq2/RhpJml6ZU= -code.cloudfoundry.org/go-log-cache/v2 v2.0.7/go.mod h1:6KQe2FeeaqRheD5vCvpyTa80YoJojB/r21E54mT97Mc= -code.cloudfoundry.org/go-loggregator/v9 v9.2.1 h1:S6Lgg5UJbhh2bt2TGQxs6R00CF8PrUA3GFPYDxy56Fk= -code.cloudfoundry.org/go-loggregator/v9 v9.2.1/go.mod h1:FTFFruqGeOhVCDFvyLgl8EV8YW63NNwRzLhxJcporu8= -code.cloudfoundry.org/go-metric-registry v0.0.0-20240604201903-7cef498efb7a h1:XpebbxgIBBy7SrwIGW+gREZuAtnJ9PHWC4Y+k7yje2I= -code.cloudfoundry.org/go-metric-registry v0.0.0-20240604201903-7cef498efb7a/go.mod h1:/Be8VtLiCeMUoYdUzFtmW8GGkk89HAy3zD79KUXzbhs= +code.cloudfoundry.org/go-diodes v0.0.0-20240813203737-5032edb05ceb h1:Last39ehN2b866DrM0B5FPIbdBFouL9humzWTqVTEX4= +code.cloudfoundry.org/go-diodes v0.0.0-20240813203737-5032edb05ceb/go.mod h1:PfkH7ePa4EhyC6VRisbZJOaIHhas7ofB0heANM//Z6Y= +code.cloudfoundry.org/go-log-cache/v3 v3.0.3 h1:lmmGxF13Lxxc4bV1BfQkf7i4Dz5VVFPoBHNOp2FHdZg= +code.cloudfoundry.org/go-log-cache/v3 v3.0.3/go.mod h1:fDvHiI+ulXb+DjUjuYy0b6PhgmFv0F8t7HZKITD4xBI= +code.cloudfoundry.org/go-loggregator/v10 v10.0.1 h1:rivqd/B1gjA9ihA4p6K5EijRSyv0cUjfvrp9hMkQ4Ys= +code.cloudfoundry.org/go-loggregator/v10 v10.0.1/go.mod h1:DKE0kBqMXWqAzd8CMl5CAbRFUpWGBWPpmOyY4znP6ts= +code.cloudfoundry.org/go-metric-registry v0.0.0-20240828184116-9710cd731bb8 h1:fMsu3rMA0cQxHBfC4Cc7bckZdcoeycS2+rn1ZJT69zU= +code.cloudfoundry.org/go-metric-registry v0.0.0-20240828184116-9710cd731bb8/go.mod h1:jYL1s2gRoRpXNZ77tPMsNgo3tzn8nVJ/OXDWEbQ7iJU= code.cloudfoundry.org/lager/v3 v3.0.3 h1:/UTmadZfIaKuT/whEinSxK1mzRfNu1uPfvjFfGqiwzM= code.cloudfoundry.org/lager/v3 v3.0.3/go.mod h1:Zn5q1SrIuuHjEUE7xerMKt3ztunrJQCZETAo7rV0CH8= -code.cloudfoundry.org/loggregator-agent-release/src v0.0.0-20240723222507-f3307e073100 h1:ZTOC6LL7s7cRzwwTlPaYRDq6kX+wqerKERGMVk3OI4w= -code.cloudfoundry.org/loggregator-agent-release/src v0.0.0-20240723222507-f3307e073100/go.mod h1:LlTzJMtG7oiiRdtyHjNzH7ylMyGqJK3AFumu4BAE8Sg= -code.cloudfoundry.org/tlsconfig v0.0.0-20240730181439-b476395a9e4e h1:Z18hGYNNUAk/dOqEhJNgRGmvnDGXFS+bJUsp0OgNNms= -code.cloudfoundry.org/tlsconfig v0.0.0-20240730181439-b476395a9e4e/go.mod h1:rzAVGsG1hc6rKuO3zhRZX0rAPtoHLPliSi5478EV6vs= +code.cloudfoundry.org/loggregator-agent-release/src v0.0.0-20240830083115-70cac7224463 h1:j2xyI/nx+9vwSqqOb7Wpif7Kofxwga1Q2vgDTwUVISw= +code.cloudfoundry.org/loggregator-agent-release/src v0.0.0-20240830083115-70cac7224463/go.mod h1:LP1VrJ3A3Pnf1AA3ydWNcDdnzudj4D+wHXXMpUOTROY= +code.cloudfoundry.org/tlsconfig v0.1.0 h1:/SGZk3K7t79cuhSVs/qZXayEnLV1kodmvU3EBcc4E4w= +code.cloudfoundry.org/tlsconfig v0.1.0/go.mod h1:6ymG8DjGLta+bnqdpUmdv88Ikje2VvOTq+8drVe4pUU= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA= filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4= @@ -817,8 +817,8 @@ github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLe github.com/google/pprof v0.0.0-20210601050228-01bbb1931b22/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210609004039-a478d1d731e9/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8 h1:FKHo8hFI3A+7w0aUQuYXQ+6EN5stWmeY/AZqtM8xk9k= -github.com/google/pprof v0.0.0-20240727154555-813a5fbdbec8/go.mod h1:K1liHPHnj73Fdn/EKuT8nrFqBihUSKXoLYU0BuatOYo= +github.com/google/pprof v0.0.0-20240829160300-da1f7e9f2b25 h1:sEDPKUw6iPjczdu33njxFjO6tYa9bfc0z/QyB/zSsBw= +github.com/google/pprof v0.0.0-20240829160300-da1f7e9f2b25/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -847,8 +847,8 @@ github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWS github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0/go.mod h1:hgWBS7lorOAVIJEQMi4ZsPv9hVvWI6+ch50m39Pf2Ks= github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3/go.mod h1:o//XUCC/F+yRGJoPO/VU0GSB0f8Nhgmxx0VIRUvaC0w= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 h1:bkypFPDjIYGfCYD5mRBvpqxfYX1YCS1PXdKYWi8FsN0= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0/go.mod h1:P+Lt/0by1T8bfcF3z737NnSbmxQAppXMRziHUxPOC8k= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0 h1:asbCHRVmodnJTuQ3qamDwqVOIjwqUPTYmYuemVOx+Ys= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.22.0/go.mod h1:ggCgvZ2r7uOoQjOyu2Y1NhHmEPPzzuhWgcza5M1Ji1I= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= @@ -894,6 +894,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/lyft/protoc-gen-star v0.6.0/go.mod h1:TGAoBVkt8w7MPG72TrKIu85MIdXwDuzJYeZuUPFPNwA= @@ -939,8 +941,8 @@ github.com/onsi/ginkgo/v2 v2.9.0/go.mod h1:4xkjoL/tZv4SMWeww56BU5kAt19mVB47gTWxm github.com/onsi/ginkgo/v2 v2.9.1/go.mod h1:FEcmzVcCHl+4o9bQZVab+4dC9+j+91t2FHSzmGAPfuo= github.com/onsi/ginkgo/v2 v2.9.2/go.mod h1:WHcJJG2dIlcCqVfBAwUCrJxSPFb6v4azBwgxeMeDuts= github.com/onsi/ginkgo/v2 v2.9.4/go.mod h1:gCQYp2Q+kSoIj7ykSVb9nskRSsR6PUj4AiLywzIhbKM= -github.com/onsi/ginkgo/v2 v2.20.0 h1:PE84V2mHqoT1sglvHc8ZdQtPcwmvvt29WLEEO3xmdZw= -github.com/onsi/ginkgo/v2 v2.20.0/go.mod h1:lG9ey2Z29hR41WMVthyJBGUBcBhGOtoPF2VFMvBXFCI= +github.com/onsi/ginkgo/v2 v2.20.2 h1:7NVCeyIWROIAheY21RLS+3j2bb52W0W82tkberYytp4= +github.com/onsi/ginkgo/v2 v2.20.2/go.mod h1:K9gyxPIlb+aIvnZ8bd9Ak+YP18w3APlR+5coaZoE2ag= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= @@ -955,8 +957,8 @@ github.com/onsi/gomega v1.27.1/go.mod h1:aHX5xOykVYzWOV4WqQy0sy8BQptgukenXpCXfad github.com/onsi/gomega v1.27.3/go.mod h1:5vG284IBtfDAmDyrK+eGyZmUgUlmi+Wngqo557cZ6Gw= github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= github.com/onsi/gomega v1.27.6/go.mod h1:PIQNjfQwkP3aQAH7lf7j87O/5FiNr+ZR8+ipb+qQlhg= -github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= -github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= +github.com/onsi/gomega v1.34.2 h1:pNCwDkzrsv7MS9kpaQvVb1aVLahQXyJ/Tv5oAZMI3i8= +github.com/onsi/gomega v1.34.2/go.mod h1:v1xfxRgk0KIsG+QOdm7p8UosrOzPYRo60fd3B/1Dukc= github.com/openzipkin/zipkin-go v0.4.2 h1:zjqfqHjUpPmB3c1GlCvvgsM1G4LkvqQbBDueDOCg/jA= github.com/openzipkin/zipkin-go v0.4.2/go.mod h1:ZeVkFjuuBiSy13y8vpSDCjMi9GoI3hPpCJSBx/EYFhY= github.com/patrickmn/go-cache v2.1.0+incompatible h1:HRMgzkcYKYpi3C8ajMPV8OFXaaRUnok+kx1WdO15EQc= @@ -977,15 +979,15 @@ github.com/pkg/sftp v1.10.1/go.mod h1:lYOWFsE0bwd1+KfKJaKeuokY15vzFx25BLbzYYoAxZ github.com/pkg/sftp v1.13.1/go.mod h1:3HaPG6Dq1ILlpPZRO0HVMrsydcdLt6HRDccSgb87qRg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.19.1 h1:wZWJDwK+NameRJuPGDhlnFgx8e8HN3XHQeLaYJFJBOE= -github.com/prometheus/client_golang v1.19.1/go.mod h1:mP78NwGzrVks5S2H6ab8+ZZGJLZUq1hoULYBAYBw1Ho= +github.com/prometheus/client_golang v1.20.2 h1:5ctymQzZlyOON1666svgwn3s6IKWgfbjsejTMiXIyjg= +github.com/prometheus/client_golang v1.20.2/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= -github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= -github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= +github.com/prometheus/common v0.57.0 h1:Ro/rKjwdq9mZn1K5QPctzh+MA4Lp0BuYk5ZZEVhoNcY= +github.com/prometheus/common v0.57.0/go.mod h1:7uRPFSUTbfZWsJ7MHY56sqt7hLQu3bxXHDnNhl8E9qI= github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -1673,10 +1675,10 @@ google.golang.org/genproto v0.0.0-20230323212658-478b75c54725/go.mod h1:UUQDJDOl google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= google.golang.org/genproto v0.0.0-20230331144136-dcfb400f0633/go.mod h1:UUQDJDOlWu4KYeJZffbWgBkS1YFobzKbLVfK69pe0Ak= google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1/go.mod h1:nKE/iIaLqn2bQwXBg8f1g2Ylh6r5MN5CmZvuzZCgsCU= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d h1:kHjw/5UfflP/L5EbledDrcG4C2597RtymmGRZvHiCuY= -google.golang.org/genproto/googleapis/api v0.0.0-20240711142825-46eb208f015d/go.mod h1:mw8MG/Qz5wfgYr6VqVCiZcHe/GJEfI+oGGDCohaVgB0= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d h1:JU0iKnSg02Gmb5ZdV8nYsKEKsP6o/FGVWTrw4i1DA9A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240711142825-46eb208f015d/go.mod h1:Ue6ibwXGpU+dqIcODieyLOcgj7z8+IcskoNIgZxtrFY= +google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed h1:3RgNmBoI9MZhsj3QxC+AP/qQhNwpCLOvYDYYsFrhFt0= +google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:OCdP9MfskevB/rbYvHTsXTtKC+3bHWajPdoKgjcYkfo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed h1:J6izYgfBXAI3xTKLgxzTmUltdYaLsuBxFCgDHWJ/eXg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240827150818-7e3bb234dfed/go.mod h1:UqMtugtsSgubUsoxbuAoiCXvqvErP7Gf0so0mK9tHxU= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -1719,8 +1721,8 @@ google.golang.org/grpc v1.52.3/go.mod h1:pu6fVzoFb+NBYNAvQL08ic+lvB2IojljRYuun5v google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw= google.golang.org/grpc v1.54.0/go.mod h1:PUSEXI6iWghWaB6lXM4knEgpJNu2qUcKfDtNci3EC2g= google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8= -google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= -google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/grpc v1.66.0 h1:DibZuoBznOxbDQxRINckZcUvnCEvrW9pcWIE2yF9r1c= +google.golang.org/grpc v1.66.0/go.mod h1:s3/l6xSSCURdVfAnL+TqCNMyTDAGN6+lZeVxnZR128Y= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/grpc/examples v0.0.0-20230512210959-5dcfb37c0b43/go.mod h1:irORyHPQXotoshbRTZVFvPDcfTfFHL23efQeop+H45M= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= @@ -1746,6 +1748,7 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= diff --git a/src/autoscaler/integration/integration_logcache_eventgenerator_scalingengine_test.go b/src/autoscaler/integration/integration_logcache_eventgenerator_scalingengine_test.go index 73e46d3afc..19dd87cbdc 100644 --- a/src/autoscaler/integration/integration_logcache_eventgenerator_scalingengine_test.go +++ b/src/autoscaler/integration/integration_logcache_eventgenerator_scalingengine_test.go @@ -6,8 +6,8 @@ import ( "time" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - rpc "code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + rpc "code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) diff --git a/src/autoscaler/metricsforwarder/forwarder/metric_forwarder.go b/src/autoscaler/metricsforwarder/forwarder/metric_forwarder.go index fef18907e5..edd3569a35 100644 --- a/src/autoscaler/metricsforwarder/forwarder/metric_forwarder.go +++ b/src/autoscaler/metricsforwarder/forwarder/metric_forwarder.go @@ -3,7 +3,7 @@ package forwarder import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/config" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9" + "code.cloudfoundry.org/go-loggregator/v10" "code.cloudfoundry.org/lager/v3" ) diff --git a/src/autoscaler/metricsforwarder/forwarder/metron_emitter.go b/src/autoscaler/metricsforwarder/forwarder/metron_emitter.go index dc37d0fb5d..9019ece0ef 100644 --- a/src/autoscaler/metricsforwarder/forwarder/metron_emitter.go +++ b/src/autoscaler/metricsforwarder/forwarder/metron_emitter.go @@ -4,7 +4,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/helpers" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/config" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9" + "code.cloudfoundry.org/go-loggregator/v10" "code.cloudfoundry.org/lager/v3" ) diff --git a/src/autoscaler/metricsforwarder/forwarder/metron_emitter_test.go b/src/autoscaler/metricsforwarder/forwarder/metron_emitter_test.go index c35b0d5a78..be74511c48 100644 --- a/src/autoscaler/metricsforwarder/forwarder/metron_emitter_test.go +++ b/src/autoscaler/metricsforwarder/forwarder/metron_emitter_test.go @@ -10,7 +10,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/forwarder" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/testhelpers" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/src/autoscaler/metricsforwarder/forwarder/syslog_emitter.go b/src/autoscaler/metricsforwarder/forwarder/syslog_emitter.go index c3e80905b7..5f73cdf002 100644 --- a/src/autoscaler/metricsforwarder/forwarder/syslog_emitter.go +++ b/src/autoscaler/metricsforwarder/forwarder/syslog_emitter.go @@ -8,7 +8,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/config" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3" "code.cloudfoundry.org/loggregator-agent-release/src/pkg/egress" "code.cloudfoundry.org/loggregator-agent-release/src/pkg/egress/syslog" diff --git a/src/autoscaler/metricsforwarder/forwarder/syslog_emitter_test.go b/src/autoscaler/metricsforwarder/forwarder/syslog_emitter_test.go index 5270ef575e..d963b917b9 100644 --- a/src/autoscaler/metricsforwarder/forwarder/syslog_emitter_test.go +++ b/src/autoscaler/metricsforwarder/forwarder/syslog_emitter_test.go @@ -9,7 +9,7 @@ import ( "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/config" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/metricsforwarder/forwarder" "code.cloudfoundry.org/app-autoscaler/src/autoscaler/models" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "code.cloudfoundry.org/lager/v3/lagertest" "code.cloudfoundry.org/loggregator-agent-release/src/pkg/egress/syslog" . "github.com/onsi/ginkgo/v2" diff --git a/src/autoscaler/metricsforwarder/testhelpers/test_helpers.go b/src/autoscaler/metricsforwarder/testhelpers/test_helpers.go index 702be23e44..b8c64e7f8a 100644 --- a/src/autoscaler/metricsforwarder/testhelpers/test_helpers.go +++ b/src/autoscaler/metricsforwarder/testhelpers/test_helpers.go @@ -6,7 +6,7 @@ import ( "net" "os" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "golang.org/x/net/context" "google.golang.org/grpc" diff --git a/src/autoscaler/models/metrics.go b/src/autoscaler/models/metrics.go index 8a45269b4b..797887d513 100644 --- a/src/autoscaler/models/metrics.go +++ b/src/autoscaler/models/metrics.go @@ -27,7 +27,7 @@ const ( type AppInstanceMetric struct { AppId string `json:"app_id" db:"app_id"` - InstanceIndex uint32 `json:"instance_index" db:"instance_index"` + InstanceIndex uint64 `json:"instance_index" db:"instance_index"` CollectedAt int64 `json:"collected_at" db:"collected_at"` Name string `json:"name" db:"name"` Unit string `json:"unit" db:"unit"` diff --git a/src/autoscaler/scalingengine/striped_lock.go b/src/autoscaler/scalingengine/striped_lock.go index baf9a34d7e..5a1ca9cd6a 100644 --- a/src/autoscaler/scalingengine/striped_lock.go +++ b/src/autoscaler/scalingengine/striped_lock.go @@ -30,5 +30,5 @@ func (sl *StripedLock) GetLock(key string) *sync.Mutex { if err != nil { return nil } - return sl.locks[h.Sum32()%uint32(len(sl.locks))] + return sl.locks[int(h.Sum32())%len(sl.locks)] } diff --git a/src/autoscaler/testhelpers/gomega_extensions.go b/src/autoscaler/testhelpers/gomega_extensions.go index a8c41d0e22..596306b676 100644 --- a/src/autoscaler/testhelpers/gomega_extensions.go +++ b/src/autoscaler/testhelpers/gomega_extensions.go @@ -10,34 +10,27 @@ var noOpHandler = func(_ http.ResponseWriter, _ *http.Request) { } func RespondWithMultiple(handlers ...http.HandlerFunc) http.HandlerFunc { - var responseNumber int32 = 0 + var responseNumber int64 = 0 if len(handlers) > 0 { return func(w http.ResponseWriter, req *http.Request) { - responseNum := atomic.LoadInt32(&responseNumber) - handlerNumber := Min(responseNum, int32(len(handlers)-1)) + responseNum := atomic.LoadInt64(&responseNumber) + handlerNumber := min(responseNum, int64(len(handlers)-1)) handlers[handlerNumber](w, req) - atomic.AddInt32(&responseNumber, 1) + atomic.AddInt64(&responseNumber, 1) } } return noOpHandler } func RoundRobinWithMultiple(handlers ...http.HandlerFunc) http.HandlerFunc { - var responseNumber int32 = 0 + var responseNumber int64 = 0 if len(handlers) > 0 { return func(w http.ResponseWriter, req *http.Request) { - handlerNumber := atomic.LoadInt32(&responseNumber) % int32(len(handlers)) + handlerNumber := atomic.LoadInt64(&responseNumber) % int64(len(handlers)) handlers[handlerNumber](w, req) - atomic.AddInt32(&responseNumber, 1) + atomic.AddInt64(&responseNumber, 1) } } return noOpHandler } - -func Min(one, two int32) int32 { - if one < two { - return one - } - return two -} diff --git a/src/autoscaler/testhelpers/log_cache_mock.go b/src/autoscaler/testhelpers/log_cache_mock.go index 4c4ccf18de..6c67afdf5c 100644 --- a/src/autoscaler/testhelpers/log_cache_mock.go +++ b/src/autoscaler/testhelpers/log_cache_mock.go @@ -10,8 +10,8 @@ import ( "strings" "sync" - rpc "code.cloudfoundry.org/go-log-cache/v2/rpc/logcache_v1" - "code.cloudfoundry.org/go-loggregator/v9/rpc/loggregator_v2" + rpc "code.cloudfoundry.org/go-log-cache/v3/rpc/logcache_v1" + "code.cloudfoundry.org/go-loggregator/v10/rpc/loggregator_v2" "golang.org/x/net/context" "google.golang.org/grpc" "google.golang.org/grpc/credentials" diff --git a/src/changelog/github/github.go b/src/changelog/github/github.go index b581c45383..26c5b619b4 100644 --- a/src/changelog/github/github.go +++ b/src/changelog/github/github.go @@ -238,7 +238,7 @@ func (g GitHub) FetchPullRequests(startingCommitSHA, lastCommitSHA string) ([]Pu } } -func (g GitHub) FetchLabelsForPullRequest(owner, repo string, pullRequestNumber int) ([]string, error) { +func (g GitHub) FetchLabelsForPullRequest(owner, repo string, pullRequestNumber int32) ([]string, error) { var PullRequestlabelsQuery struct { Repository struct { PullRequest struct {