Skip to content

Commit

Permalink
Remove data race in shard instrumentation (#1332)
Browse files Browse the repository at this point in the history
The function is already called via a goroutine, and nesting further goroutines with variables outside the scope of the goroutines will cause race conditions, especially since the map is not locked on read/write.

Remove the goroutines within `shardGauges` method, and just run it as a normal loop instead.

Also tidy up some dependencies that are no longer needed.

---------
Co-authored-by: Darwin D Wu <darwin67@users.noreply.github.com>
  • Loading branch information
darwin67 committed May 9, 2024
1 parent 1530a30 commit b92259f
Show file tree
Hide file tree
Showing 40 changed files with 61 additions and 4,371 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/components_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2.4.0
- uses: pnpm/action-setup@v4
with:
version: "8.6.2"
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18"
- run: pnpm install
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "1.21"
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 8.6.2
- name: Build UI
Expand Down Expand Up @@ -58,9 +58,9 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: "1.21"
- name: Build dev server
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/go.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ jobs:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: "1.21"
- name: Lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.1
Expand All @@ -36,6 +36,6 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '1.21'
go-version: "1.21"
- name: Test
run: go test $(go list ./... | grep -v tests) -race -count=1
4 changes: 2 additions & 2 deletions .github/workflows/next.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Sync Staging

on:
push:
branches: [ main ]
branches: [main]

env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
Expand All @@ -17,7 +17,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: echo "GH_TOKEN=${GITHUB_TOKEN}" >> $GITHUB_ENV

- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
ref: main
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/npm_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ on:
push:
branches: [main]
paths:
- 'npm/**'
- "npm/**"
pull_request:
paths:
- 'npm/**'
- "npm/**"

jobs:
install:
Expand All @@ -26,22 +26,22 @@ jobs:
run:
working-directory: npm
steps:
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: 'Get previous version tag'
- name: "Get previous version tag"
id: previoustag
uses: "WyriHaximus/github-action-get-previous-tag@v1"
with:
prefix: v
- id: version
shell: bash
run: |
echo "${{ steps.previoustag.outputs.tag }}" | cut -c2- | tee version.txt
echo "::set-output name=version::$(cat version.txt)"
echo "${{ steps.previoustag.outputs.tag }}" | cut -c2- | tee version.txt
echo "::set-output name=version::$(cat version.txt)"
- run: npm ci
env:
SKIP_POSTINSTALL: 1
Expand All @@ -50,5 +50,5 @@ jobs:
- name: Trigger postinstall
run: npm install --foreground-scripts
env:
DEBUG: 'inngest:*'
DEBUG: "inngest:*"
- run: bin/inngest version
19 changes: 9 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_TOKEN }}
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Go
uses: actions/setup-go@v2
uses: actions/setup-go@v5
with:
go-version: '1.21'
go-version: "1.21"
- name: Install pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: 8.6.2
- name: Set sha
Expand All @@ -34,11 +34,11 @@ jobs:
run: echo "tag=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
uses: goreleaser/goreleaser-action@v5
with:
version: '~> 1.23'
version: "~> 1.23"
args: release --rm-dist --debug
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -51,11 +51,11 @@ jobs:
working-directory: npm
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Node/npm
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 16
- name: Install npm dependencies
Expand All @@ -75,4 +75,3 @@ jobs:
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

6 changes: 3 additions & 3 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name: "Security Scan"
on:
pull_request:
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

jobs:
tests:
Expand All @@ -14,13 +14,13 @@ jobs:
GO111MODULE: on
steps:
- name: Checkout Source
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Run Gosec Security Scanner
uses: securego/gosec@master
with:
# we let the report trigger content trigger a failure using the GitHub Security features.
args: '-no-fail -fmt sarif -out results.sarif ./...'
args: "-no-fail -fmt sarif -out results.sarif ./..."

- name: Upload SARIF file
uses: github/codeql-action/upload-sarif@v2
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ require (
github.com/spf13/viper v1.10.1
github.com/stretchr/testify v1.9.0
github.com/throttled/throttled/v2 v2.11.0
github.com/uber-go/tally/v4 v4.1.4
github.com/vektah/gqlparser/v2 v2.5.1
github.com/xhit/go-str2duration/v2 v2.1.0
go.opentelemetry.io/collector/pdata v1.6.0
Expand Down Expand Up @@ -171,7 +170,6 @@ require (
github.com/subosito/gotenv v1.2.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/twmb/murmur3 v1.1.6 // indirect
github.com/urfave/cli/v2 v2.25.1 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yuin/gopher-lua v1.1.0 // indirect
Expand Down
Loading

0 comments on commit b92259f

Please sign in to comment.