Skip to content

Commit

Permalink
Github action to run serverless benchmarks.
Browse files Browse the repository at this point in the history
  • Loading branch information
purple4reina committed Nov 27, 2023
1 parent d12ee08 commit fe7bbdd
Show file tree
Hide file tree
Showing 2 changed files with 78 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/serverless-benchmarks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: "Serverless Benchmarks"

on:
push:
paths:
- 'cmd/serverless/**'
- 'pkg/serverless/**'
- '.github/workflows/serverless-benchmarks.yml'

env:
DD_API_KEY: must-be-set

jobs:
run:
runs-on: ubuntu-latest
steps:
- name: Install Go
uses: actions/setup-go@v4
with:
go-version: stable

- name: Install benchstat
run: |
go install golang.org/x/perf/cmd/benchstat@latest
- name: Checkout datadog-agent repository
uses: actions/checkout@v3
with:
path: go/src/github.com/DataDog/datadog-agent

- name: Checkout datadog-agent base branch
run: |
cd go/src/github.com/DataDog/datadog-agent
git fetch origin $GITHUB_BASE_REF --depth 1
git checkout $GITHUB_BASE_REF
- name: Previous benchmark results
run: |
cd go/src/github.com/DataDog/datadog-agent
#go test -tags=test -run='^$' -bench=StartEndInvocation -count=4 -benchtime=10x -timeout=60m \
# ./pkg/serverless/... | tee previous.txt
- name: Checkout datadog-agent pr branch
run: |
cd go/src/github.com/DataDog/datadog-agent
git fetch origin $GITHUB_SHA --depth 1
git checkout $GITHUB_SHA
- name: Current benchmark results
run: |
cd go/src/github.com/DataDog/datadog-agent
#go test -tags=test -run='^$' -bench=StartEndInvocation -count=4 -benchtime=10x -timeout=60m \
# ./pkg/serverless/... | tee current.txt
- name: Analyze results
id: analyze
run: |
cd go/src/github.com/DataDog/datadog-agent
#go get golang.org/x/perf/cmd/benchstat #@latest
#go install golang.org/x/perf/cmd/benchstat #@latest
benchstat -row /event previous.txt current.txt | tee output.txt
OUTPUT=$(cat output.txt)
echo "analyze=$OUTPUT" >> $GITHUB_OUTPUT
- name: Post comment
uses: marocchino/[email protected]
with:
hide_and_recreate: true
hide_classify: "RESOLVED"
message: |
## Serverless Benchmark Results
```
${{ steps.analyze.outputs.analyze }}
```
1 change: 1 addition & 0 deletions pkg/serverless/daemon/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func (s *StartInvocation) ServeHTTP(w http.ResponseWriter, r *http.Request) {
w.Header().Set(invocationlifecycle.TraceIDHeader, fmt.Sprintf("%v", s.daemon.InvocationProcessor.GetExecutionInfo().TraceID))
w.Header().Set(invocationlifecycle.SamplingPriorityHeader, fmt.Sprintf("%v", s.daemon.InvocationProcessor.GetExecutionInfo().SamplingPriority))
}
time.Sleep(time.Millisecond)
}

// EndInvocation is a route that can be called at the end of an invocation to enable
Expand Down

0 comments on commit fe7bbdd

Please sign in to comment.