Skip to content

Commit

Permalink
Remove the poplar dependency from the benchmark module. (#1864)
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewdale authored Oct 14, 2024
1 parent 9f75406 commit b92661a
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 644 deletions.
78 changes: 68 additions & 10 deletions internal/cmd/benchmark/benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"testing"
"time"

"github.com/evergreen-ci/poplar"
"github.com/stretchr/testify/require"
"go.mongodb.org/mongo-driver/v2/bson"
"go.mongodb.org/mongo-driver/v2/mongo"
Expand Down Expand Up @@ -496,8 +495,8 @@ func BenchmarkMultiInsertLargeDocument(b *testing.B) {
benchmarkMultiInsert(b, largeData)
}

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

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

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

test.Metrics = append(test.Metrics,
poplar.TestMetrics{Name: "megabytes_per_second", Type: "THROUGHPUT", Value: megaBytesPerOp})
poplarTestMetrics{Name: "megabytes_per_second", Type: "THROUGHPUT", Value: megaBytesPerOp})
}

if opsPerSecondMin := result.Extra[opsPerSecondMinName]; opsPerSecondMin != 0 {
test.Metrics = append(test.Metrics,
poplar.TestMetrics{Name: opsPerSecondMinName, Type: "THROUGHPUT", Value: opsPerSecondMin})
poplarTestMetrics{Name: opsPerSecondMinName, Type: "THROUGHPUT", Value: opsPerSecondMin})
}

if opsPerSecondMax := result.Extra[opsPerSecondMaxName]; opsPerSecondMax != 0 {
test.Metrics = append(test.Metrics,
poplar.TestMetrics{Name: opsPerSecondMaxName, Type: "THROUGHPUT", Value: opsPerSecondMax})
poplarTestMetrics{Name: opsPerSecondMaxName, Type: "THROUGHPUT", Value: opsPerSecondMax})
}

if opsPerSecondMed := result.Extra[opsPerSecondMedName]; opsPerSecondMed != 0 {
test.Metrics = append(test.Metrics,
poplar.TestMetrics{Name: opsPerSecondMedName, Type: "THROUGHPUT", Value: opsPerSecondMed})
poplarTestMetrics{Name: opsPerSecondMedName, Type: "THROUGHPUT", Value: opsPerSecondMed})
}

test.Info = poplar.TestInfo{
test.Info = poplarTestInfo{
TestName: name,
}

Expand Down Expand Up @@ -586,7 +585,7 @@ func TestRunAllBenchmarks(t *testing.T) {
{name: "BenchmarkMultiInsertLargeDocument", benchmark: BenchmarkMultiInsertLargeDocument},
}

results := make([]poplar.Test, len(cases))
results := make([]poplarTest, len(cases))
for i := range cases {
t.Run(cases[i].name, func(t *testing.T) {
var err error
Expand All @@ -610,3 +609,62 @@ func TestRunAllBenchmarks(t *testing.T) {
err = os.WriteFile(filepath.Join(filepath.Dir(testdataDir(t)), defaultOutputFileName), evgOutput, 0644)
require.NoError(t, err, "failed to write results")
}

// poplarTest was copied from
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L38
type poplarTest struct {
ID string `bson:"_id" json:"id" yaml:"id"`
Info poplarTestInfo `bson:"info" json:"info" yaml:"info"`
CreatedAt time.Time `bson:"created_at" json:"created_at" yaml:"created_at"`
CompletedAt time.Time `bson:"completed_at" json:"completed_at" yaml:"completed_at"`
Artifacts []poplarTestArtifact `bson:"artifacts" json:"artifacts" yaml:"artifacts"`
Metrics []poplarTestMetrics `bson:"metrics" json:"metrics" yaml:"metrics"`
SubTests []poplarTest `bson:"sub_tests" json:"sub_tests" yaml:"sub_tests"`
}

// poplarTestInfo was copied from
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L52
type poplarTestInfo struct {
TestName string `bson:"test_name" json:"test_name" yaml:"test_name"`
Trial int `bson:"trial" json:"trial" yaml:"trial"`
Parent string `bson:"parent" json:"parent" yaml:"parent"`
Tags []string `bson:"tags" json:"tags" yaml:"tags"`
Arguments map[string]int32 `bson:"args" json:"args" yaml:"args"`
}

// poplarTestArtifact was copied from
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L62
type poplarTestArtifact struct {
Bucket string `bson:"bucket" json:"bucket" yaml:"bucket"`
Prefix string `bson:"prefix" json:"prefix" yaml:"prefix"`
Permissions string `bson:"permissions" json:"permissions" yaml:"permissions"`
Path string `bson:"path" json:"path" yaml:"path"`
Tags []string `bson:"tags" json:"tags" yaml:"tags"`
CreatedAt time.Time `bson:"created_at" json:"created_at" yaml:"created_at"`
LocalFile string `bson:"local_path,omitempty" json:"local_path,omitempty" yaml:"local_path,omitempty"`
PayloadTEXT bool `bson:"is_text,omitempty" json:"is_text,omitempty" yaml:"is_text,omitempty"`
PayloadFTDC bool `bson:"is_ftdc,omitempty" json:"is_ftdc,omitempty" yaml:"is_ftdc,omitempty"`
PayloadBSON bool `bson:"is_bson,omitempty" json:"is_bson,omitempty" yaml:"is_bson,omitempty"`
PayloadJSON bool `bson:"is_json,omitempty" json:"is_json,omitempty" yaml:"is_json,omitempty"`
PayloadCSV bool `bson:"is_csv,omitempty" json:"is_csv,omitempty" yaml:"is_csv,omitempty"`
DataUncompressed bool `bson:"is_uncompressed" json:"is_uncompressed" yaml:"is_uncompressed"`
DataGzipped bool `bson:"is_gzip,omitempty" json:"is_gzip,omitempty" yaml:"is_gzip,omitempty"`
DataTarball bool `bson:"is_tarball,omitempty" json:"is_tarball,omitempty" yaml:"is_tarball,omitempty"`
EventsRaw bool `bson:"events_raw,omitempty" json:"events_raw,omitempty" yaml:"events_raw,omitempty"`
EventsHistogram bool `bson:"events_histogram,omitempty" json:"events_histogram,omitempty" yaml:"events_histogram,omitempty"`
EventsIntervalSummary bool `bson:"events_interval_summary,omitempty" json:"events_interval_summary,omitempty" yaml:"events_interval_summary,omitempty"`
EventsCollapsed bool `bson:"events_collapsed,omitempty" json:"events_collapsed,omitempty" yaml:"events_collapsed,omitempty"`
ConvertGzip bool `bson:"convert_gzip,omitempty" json:"convert_gzip,omitempty" yaml:"convert_gzip,omitempty"`
ConvertBSON2FTDC bool `bson:"convert_bson_to_ftdc,omitempty" json:"convert_bson_to_ftdc,omitempty" yaml:"convert_bson_to_ftdc,omitempty"`
ConvertJSON2FTDC bool `bson:"convert_json_to_ftdc" json:"convert_json_to_ftdc" yaml:"convert_json_to_ftdc"`
ConvertCSV2FTDC bool `bson:"convert_csv_to_ftdc" json:"convert_csv_to_ftdc" yaml:"convert_csv_to_ftdc"`
}

// poplarTestMetrics was copied from
// https://github.com/evergreen-ci/poplar/blob/8d03d2bacde0897cedd73ed79ddc167ed1ed4c77/report.go#L124
type poplarTestMetrics struct {
Name string `bson:"name" json:"name" yaml:"name"`
Version int `bson:"version,omitempty" json:"version,omitempty" yaml:"version,omitempty"`
Type string `bson:"type" json:"type" yaml:"type"`
Value interface{} `bson:"value" json:"value" yaml:"value"`
}
69 changes: 1 addition & 68 deletions internal/cmd/benchmark/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,89 +5,22 @@ go 1.18
replace go.mongodb.org/mongo-driver/v2 => ../../../

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

require (
github.com/PuerkitoBio/rehttp v1.1.0 // indirect
github.com/andygrunwald/go-jira v1.14.0 // indirect
github.com/aws/aws-sdk-go-v2 v1.30.3 // indirect
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect
github.com/aws/aws-sdk-go-v2/config v1.27.27 // indirect
github.com/aws/aws-sdk-go-v2/credentials v1.17.27 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.11 // indirect
github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.10 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.15 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.15 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.3 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.3.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.17 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.17.15 // indirect
github.com/aws/aws-sdk-go-v2/service/s3 v1.58.3 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.22.4 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.26.4 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.30.3 // indirect
github.com/aws/smithy-go v1.20.3 // indirect
github.com/bluele/slack v0.0.0-20180528010058-b4b4d354a079 // indirect
github.com/coreos/go-systemd v0.0.0-20191104093116-d3cd4ed1dbcf // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dghubble/oauth1 v0.7.1 // indirect
github.com/evergreen-ci/aviation v0.0.0-20240509141021-0e3a1c91cc79 // indirect
github.com/evergreen-ci/birch v0.0.0-20220401151432-c792c3d8e0eb // indirect
github.com/evergreen-ci/gimlet v0.0.0-20220401151443-33c830c51cee // indirect
github.com/evergreen-ci/negroni v1.0.1-0.20211028183800-67b6d7c2c035 // indirect
github.com/evergreen-ci/pail v0.0.0-20240808162451-ba76772cf567 // indirect
github.com/evergreen-ci/utility v0.0.0-20220404192535-d16eb64796e6 // indirect
github.com/fatih/structs v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/fuyufjh/splunk-hec-go v0.3.4-0.20190414090710-10df423a9f36 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/golang-jwt/jwt v3.2.2+incompatible // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/go-github v17.0.0+incompatible // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/klauspost/compress v1.13.6 // indirect
github.com/lufia/plan9stats v0.0.0-20211012122336-39d0f177ccd0 // indirect
github.com/mattn/go-xmpp v0.0.0-20210723025538-3871461df959 // indirect
github.com/mongodb/ftdc v0.0.0-20220401165013-13e4af55e809 // indirect
github.com/mongodb/grip v0.0.0-20220401165023-6a1d9bb90c21 // indirect
github.com/montanaflynn/stats v0.0.0-20180911141734-db72e6cae808 // indirect
github.com/papertrail/go-tail v0.0.0-20180509224916-973c153b0431 // indirect
github.com/phyber/negroni-gzip v1.0.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 // indirect
github.com/shirou/gopsutil/v3 v3.22.3 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/trivago/tgo v1.0.7 // indirect
github.com/urfave/negroni v1.0.0 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20240726163527-a2c0da244d78 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.mongodb.org/mongo-driver v1.12.1 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sync v0.8.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit b92661a

Please sign in to comment.