Skip to content

Commit b92661a

Browse files
authored
Remove the poplar dependency from the benchmark module. (#1864)
1 parent 9f75406 commit b92661a

File tree

3 files changed

+69
-644
lines changed

3 files changed

+69
-644
lines changed

internal/cmd/benchmark/benchmark_test.go

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import (
2323
"testing"
2424
"time"
2525

26-
"github.com/evergreen-ci/poplar"
2726
"github.com/stretchr/testify/require"
2827
"go.mongodb.org/mongo-driver/v2/bson"
2928
"go.mongodb.org/mongo-driver/v2/mongo"
@@ -496,8 +495,8 @@ func BenchmarkMultiInsertLargeDocument(b *testing.B) {
496495
benchmarkMultiInsert(b, largeData)
497496
}
498497

499-
func runBenchmark(name string, fn func(*testing.B)) (poplar.Test, error) {
500-
test := poplar.Test{
498+
func runBenchmark(name string, fn func(*testing.B)) (poplarTest, error) {
499+
test := poplarTest{
501500
ID: fmt.Sprintf("%d", time.Now().UnixMilli()),
502501
CreatedAt: time.Now(),
503502
}
@@ -510,7 +509,7 @@ func runBenchmark(name string, fn func(*testing.B)) (poplar.Test, error) {
510509

511510
test.CompletedAt = test.CreatedAt.Add(result.T)
512511

513-
test.Metrics = []poplar.TestMetrics{
512+
test.Metrics = []poplarTestMetrics{
514513
{Name: "total_time_seconds", Type: "SUM", Value: result.T.Seconds()},
515514
{Name: "iterations", Type: "SUM", Value: result.N},
516515
{Name: "allocated_bytes_per_op", Type: "MEAN", Value: result.AllocedBytesPerOp()},
@@ -525,25 +524,25 @@ func runBenchmark(name string, fn func(*testing.B)) (poplar.Test, error) {
525524
megaBytesPerOp := (float64(result.Bytes) / 1024 / 1024) / float64(result.NsPerOp()) * 1e9
526525

527526
test.Metrics = append(test.Metrics,
528-
poplar.TestMetrics{Name: "megabytes_per_second", Type: "THROUGHPUT", Value: megaBytesPerOp})
527+
poplarTestMetrics{Name: "megabytes_per_second", Type: "THROUGHPUT", Value: megaBytesPerOp})
529528
}
530529

531530
if opsPerSecondMin := result.Extra[opsPerSecondMinName]; opsPerSecondMin != 0 {
532531
test.Metrics = append(test.Metrics,
533-
poplar.TestMetrics{Name: opsPerSecondMinName, Type: "THROUGHPUT", Value: opsPerSecondMin})
532+
poplarTestMetrics{Name: opsPerSecondMinName, Type: "THROUGHPUT", Value: opsPerSecondMin})
534533
}
535534

536535
if opsPerSecondMax := result.Extra[opsPerSecondMaxName]; opsPerSecondMax != 0 {
537536
test.Metrics = append(test.Metrics,
538-
poplar.TestMetrics{Name: opsPerSecondMaxName, Type: "THROUGHPUT", Value: opsPerSecondMax})
537+
poplarTestMetrics{Name: opsPerSecondMaxName, Type: "THROUGHPUT", Value: opsPerSecondMax})
539538
}
540539

541540
if opsPerSecondMed := result.Extra[opsPerSecondMedName]; opsPerSecondMed != 0 {
542541
test.Metrics = append(test.Metrics,
543-
poplar.TestMetrics{Name: opsPerSecondMedName, Type: "THROUGHPUT", Value: opsPerSecondMed})
542+
poplarTestMetrics{Name: opsPerSecondMedName, Type: "THROUGHPUT", Value: opsPerSecondMed})
544543
}
545544

546-
test.Info = poplar.TestInfo{
545+
test.Info = poplarTestInfo{
547546
TestName: name,
548547
}
549548

@@ -586,7 +585,7 @@ func TestRunAllBenchmarks(t *testing.T) {
586585
{name: "BenchmarkMultiInsertLargeDocument", benchmark: BenchmarkMultiInsertLargeDocument},
587586
}
588587

589-
results := make([]poplar.Test, len(cases))
588+
results := make([]poplarTest, len(cases))
590589
for i := range cases {
591590
t.Run(cases[i].name, func(t *testing.T) {
592591
var err error
@@ -610,3 +609,62 @@ func TestRunAllBenchmarks(t *testing.T) {
610609
err = os.WriteFile(filepath.Join(filepath.Dir(testdataDir(t)), defaultOutputFileName), evgOutput, 0644)
611610
require.NoError(t, err, "failed to write results")
612611
}
612+
613+
// poplarTest was copied from
614+
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L38
615+
type poplarTest struct {
616+
ID string `bson:"_id" json:"id" yaml:"id"`
617+
Info poplarTestInfo `bson:"info" json:"info" yaml:"info"`
618+
CreatedAt time.Time `bson:"created_at" json:"created_at" yaml:"created_at"`
619+
CompletedAt time.Time `bson:"completed_at" json:"completed_at" yaml:"completed_at"`
620+
Artifacts []poplarTestArtifact `bson:"artifacts" json:"artifacts" yaml:"artifacts"`
621+
Metrics []poplarTestMetrics `bson:"metrics" json:"metrics" yaml:"metrics"`
622+
SubTests []poplarTest `bson:"sub_tests" json:"sub_tests" yaml:"sub_tests"`
623+
}
624+
625+
// poplarTestInfo was copied from
626+
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L52
627+
type poplarTestInfo struct {
628+
TestName string `bson:"test_name" json:"test_name" yaml:"test_name"`
629+
Trial int `bson:"trial" json:"trial" yaml:"trial"`
630+
Parent string `bson:"parent" json:"parent" yaml:"parent"`
631+
Tags []string `bson:"tags" json:"tags" yaml:"tags"`
632+
Arguments map[string]int32 `bson:"args" json:"args" yaml:"args"`
633+
}
634+
635+
// poplarTestArtifact was copied from
636+
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L62
637+
type poplarTestArtifact struct {
638+
Bucket string `bson:"bucket" json:"bucket" yaml:"bucket"`
639+
Prefix string `bson:"prefix" json:"prefix" yaml:"prefix"`
640+
Permissions string `bson:"permissions" json:"permissions" yaml:"permissions"`
641+
Path string `bson:"path" json:"path" yaml:"path"`
642+
Tags []string `bson:"tags" json:"tags" yaml:"tags"`
643+
CreatedAt time.Time `bson:"created_at" json:"created_at" yaml:"created_at"`
644+
LocalFile string `bson:"local_path,omitempty" json:"local_path,omitempty" yaml:"local_path,omitempty"`
645+
PayloadTEXT bool `bson:"is_text,omitempty" json:"is_text,omitempty" yaml:"is_text,omitempty"`
646+
PayloadFTDC bool `bson:"is_ftdc,omitempty" json:"is_ftdc,omitempty" yaml:"is_ftdc,omitempty"`
647+
PayloadBSON bool `bson:"is_bson,omitempty" json:"is_bson,omitempty" yaml:"is_bson,omitempty"`
648+
PayloadJSON bool `bson:"is_json,omitempty" json:"is_json,omitempty" yaml:"is_json,omitempty"`
649+
PayloadCSV bool `bson:"is_csv,omitempty" json:"is_csv,omitempty" yaml:"is_csv,omitempty"`
650+
DataUncompressed bool `bson:"is_uncompressed" json:"is_uncompressed" yaml:"is_uncompressed"`
651+
DataGzipped bool `bson:"is_gzip,omitempty" json:"is_gzip,omitempty" yaml:"is_gzip,omitempty"`
652+
DataTarball bool `bson:"is_tarball,omitempty" json:"is_tarball,omitempty" yaml:"is_tarball,omitempty"`
653+
EventsRaw bool `bson:"events_raw,omitempty" json:"events_raw,omitempty" yaml:"events_raw,omitempty"`
654+
EventsHistogram bool `bson:"events_histogram,omitempty" json:"events_histogram,omitempty" yaml:"events_histogram,omitempty"`
655+
EventsIntervalSummary bool `bson:"events_interval_summary,omitempty" json:"events_interval_summary,omitempty" yaml:"events_interval_summary,omitempty"`
656+
EventsCollapsed bool `bson:"events_collapsed,omitempty" json:"events_collapsed,omitempty" yaml:"events_collapsed,omitempty"`
657+
ConvertGzip bool `bson:"convert_gzip,omitempty" json:"convert_gzip,omitempty" yaml:"convert_gzip,omitempty"`
658+
ConvertBSON2FTDC bool `bson:"convert_bson_to_ftdc,omitempty" json:"convert_bson_to_ftdc,omitempty" yaml:"convert_bson_to_ftdc,omitempty"`
659+
ConvertJSON2FTDC bool `bson:"convert_json_to_ftdc" json:"convert_json_to_ftdc" yaml:"convert_json_to_ftdc"`
660+
ConvertCSV2FTDC bool `bson:"convert_csv_to_ftdc" json:"convert_csv_to_ftdc" yaml:"convert_csv_to_ftdc"`
661+
}
662+
663+
// poplarTestMetrics was copied from
664+
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L124
665+
type poplarTestMetrics struct {
666+
Name string `bson:"name" json:"name" yaml:"name"`
667+
Version int `bson:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
668+
Type string `bson:"type" json:"type" yaml:"type"`
669+
Value interface{} `bson:"value" json:"value" yaml:"value"`
670+
}

internal/cmd/benchmark/go.mod

Lines changed: 1 addition & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -5,89 +5,22 @@ go 1.18
55
replace go.mongodb.org/mongo-driver/v2 => ../../../
66

77
require (
8-
github.com/evergreen-ci/poplar v0.0.0-20240904151346-8d03d2bacde0
98
github.com/stretchr/testify v1.8.1
109
go.mongodb.org/mongo-driver/v2 v2.0.0-00010101000000-000000000000
1110
)
1211

1312
require (
14-
github.com/PuerkitoBio/rehttp v1.1.0 // indirect
15-
github.com/andygrunwald/go-jira v1.14.0 // indirect
16-
github.com/aws/aws-sdk-go-v2 v1.30.3 // indirect
17-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect
18-
github.com/aws/aws-sdk-go-v2/config v1.27.27 // indirect
19-
github.com/aws/aws-sdk-go-v2/credentials v1.17.27 // indirect
20-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 // indirect
21-
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10 // indirect
22-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect
23-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect
24-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
25-
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.15 // indirect
26-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
27-
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.17 // indirect
28-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 // indirect
29-
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.15 // indirect
30-
github.com/aws/aws-sdk-go-v2/service/s3 v1.58.3 // indirect
31-
github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 // indirect
32-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect
33-
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect
34-
github.com/aws/smithy-go v1.20.3 // indirect
35-
github.com/bluele/slack v0.0.0-20180528010058-b4b4d354a079 // indirect
36-
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
3713
github.com/davecgh/go-spew v1.1.1 // indirect
38-
github.com/dghubble/oauth1 v0.7.1 // indirect
39-
github.com/evergreen-ci/aviation v0.0.0-20240509141021-0e3a1c91cc79 // indirect
40-
github.com/evergreen-ci/birch v0.0.0-20220401151432-c792c3d8e0eb // indirect
41-
github.com/evergreen-ci/gimlet v0.0.0-20220401151443-33c830c51cee // indirect
42-
github.com/evergreen-ci/negroni v1.0.1-0.20211028183800-67b6d7c2c035 // indirect
43-
github.com/evergreen-ci/pail v0.0.0-20240808162451-ba76772cf567 // indirect
44-
github.com/evergreen-ci/utility v0.0.0-20220404192535-d16eb64796e6 // indirect
45-
github.com/fatih/structs v1.1.0 // indirect
46-
github.com/fsnotify/fsnotify v1.5.1 // indirect
47-
github.com/fuyufjh/splunk-hec-go v0.3.4-0.20190414090710-10df423a9f36 // indirect
48-
github.com/go-ole/go-ole v1.2.6 // indirect
49-
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
50-
github.com/golang/protobuf v1.5.3 // indirect
5114
github.com/golang/snappy v0.0.4 // indirect
52-
github.com/google/go-github v17.0.0+incompatible // indirect
53-
github.com/google/go-querystring v1.1.0 // indirect
54-
github.com/google/uuid v1.3.0 // indirect
55-
github.com/gorilla/mux v1.8.0 // indirect
56-
github.com/jpillora/backoff v1.0.0 // indirect
5715
github.com/klauspost/compress v1.13.6 // indirect
58-
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
59-
github.com/mattn/go-xmpp v0.0.0-20210723025538-3871461df959 // indirect
60-
github.com/mongodb/ftdc v0.0.0-20220401165013-13e4af55e809 // indirect
61-
github.com/mongodb/grip v0.0.0-20220401165023-6a1d9bb90c21 // indirect
62-
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 // indirect
63-
github.com/papertrail/go-tail v0.0.0-20180509224916-973c153b0431 // indirect
64-
github.com/phyber/negroni-gzip v1.0.0 // indirect
65-
github.com/pkg/errors v0.9.1 // indirect
6616
github.com/pmezard/go-difflib v1.0.0 // indirect
67-
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
68-
github.com/rs/cors v1.8.2 // indirect
69-
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
70-
github.com/shirou/gopsutil/v3 v3.22.3 // indirect
71-
github.com/tklauser/go-sysconf v0.3.10 // indirect
72-
github.com/tklauser/numcpus v0.4.0 // indirect
73-
github.com/trivago/tgo v1.0.7 // indirect
74-
github.com/urfave/negroni v1.0.0 // indirect
7517
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
7618
github.com/xdg-go/scram v1.1.2 // indirect
7719
github.com/xdg-go/stringprep v1.0.4 // indirect
7820
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
79-
github.com/yusufpapurcu/wmi v1.2.2 // indirect
80-
go.mongodb.org/mongo-driver v1.12.1 // indirect
8121
golang.org/x/crypto v0.27.0 // indirect
82-
golang.org/x/net v0.21.0 // indirect
83-
golang.org/x/oauth2 v0.7.0 // indirect
8422
golang.org/x/sync v0.8.0 // indirect
85-
golang.org/x/sys v0.25.0 // indirect
8623
golang.org/x/text v0.18.0 // indirect
87-
google.golang.org/appengine v1.6.7 // indirect
88-
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
89-
google.golang.org/grpc v1.56.3 // indirect
90-
google.golang.org/protobuf v1.33.0 // indirect
91-
gopkg.in/yaml.v2 v2.4.0 // indirect
24+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
9225
gopkg.in/yaml.v3 v3.0.1 // indirect
9326
)

0 commit comments

Comments
 (0)