-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #822 from cloudflare/benchmarks
Add benchmark-action/github-action-benchmark
- Loading branch information
Showing
11 changed files
with
117 additions
and
167 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ promql | |
PromQL | ||
PRs | ||
prymitive | ||
samber | ||
SNI | ||
symlink | ||
symlinked | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/pint | ||
/.cover | ||
/memprofile.out | ||
/dist/ | ||
/.vscode/ | ||
/cmd/pint/bench/rules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
REVISION := 31a27fb9e0e778bd8fe6097aa58c8ea598fe9cec | ||
|
||
.PHONE: fetch | ||
fetch: | ||
curl -sL -o archive.tar.gz https://github.com/samber/awesome-prometheus-alerts/archive/$(REVISION).tar.gz | ||
tar -xf archive.tar.gz | ||
rm -fr rules | ||
mv awesome-prometheus-alerts-$(REVISION)/dist/rules rules | ||
rm -fr awesome-prometheus-alerts-$(REVISION) archive.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Benchmark data | ||
|
||
A collection of Prometheus rules copied from | ||
[samber/awesome-prometheus-alerts](https://github.com/samber/awesome-prometheus-alerts) | ||
and used to benchmark pint. | ||
|
||
Run `make fetch` first to download and unpack rules into `rules` folder. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package main | ||
|
||
import ( | ||
"context" | ||
"log/slog" | ||
"testing" | ||
|
||
"github.com/prometheus/client_golang/prometheus" | ||
|
||
"github.com/cloudflare/pint/internal/config" | ||
"github.com/cloudflare/pint/internal/discovery" | ||
"github.com/cloudflare/pint/internal/git" | ||
"github.com/cloudflare/pint/internal/log" | ||
) | ||
|
||
func BenchmarkFindEntries(b *testing.B) { | ||
log.Setup(slog.LevelError, true) | ||
|
||
finder := discovery.NewGlobFinder( | ||
[]string{"bench/rules"}, | ||
git.NewPathFilter(nil, nil, nil), | ||
) | ||
for n := 0; n < b.N; n++ { | ||
_, _ = finder.Find() | ||
} | ||
} | ||
|
||
func BenchmarkCheckRules(b *testing.B) { | ||
log.Setup(slog.LevelError, true) | ||
|
||
finder := discovery.NewGlobFinder( | ||
[]string{"bench/rules"}, | ||
git.NewPathFilter(nil, nil, nil), | ||
) | ||
entries, err := finder.Find() | ||
if err != nil { | ||
b.Errorf("Find() error: %s", err) | ||
b.FailNow() | ||
} | ||
|
||
ctx := context.Background() | ||
cfg, _ := config.Load("", false) | ||
gen := config.NewPrometheusGenerator(cfg, prometheus.NewRegistry()) | ||
for n := 0; n < b.N; n++ { | ||
_, _ = checkRules(ctx, 10, true, gen, cfg, entries) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module _ | ||
|
||
go 1.21.4 | ||
|
||
require golang.org/x/perf v0.0.0-20231127181059-b53752263861 | ||
|
||
require github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 // indirect |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794 h1:xlwdaKcTNVW4PtpQb8aKA4Pjy0CdJHEqvFbAnvR5m2g= | ||
github.com/aclements/go-moremath v0.0.0-20210112150236-f10218a38794/go.mod h1:7e+I0LQFUI9AXWxOfsQROs9xPhoJtbsyWcjJqDd4KPY= | ||
golang.org/x/perf v0.0.0-20231127181059-b53752263861 h1:oWUgm6RG0ZUKQeX7wxjnX+TFCrXDSheBtpiy5vpUdZg= | ||
golang.org/x/perf v0.0.0-20231127181059-b53752263861/go.mod h1:sKqUfjZtdM78wIFCYFnmu2FhhanvRUbp67Zgmj3TZPM= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
//go:build tools | ||
|
||
package tools | ||
|
||
import ( | ||
_ "golang.org/x/perf/cmd/benchstat" | ||
) |