From 4c568e77ec6a82ee979424a8be1b2c6fa6d45954 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Wed, 28 Dec 2022 16:27:25 +0530 Subject: [PATCH 1/5] recordtester: Use random serf memeber for playback if enabled. --- .editorconfig | 4 ++ cmd/recordtester/recordtester.go | 43 ++++++++++++++++--- docker/Dockerfile.record-tester | 2 +- go.mod | 18 +++++++- go.sum | 34 +++++++++++++++ .../recordtester/continuous_record_tester.go | 6 ++- internal/app/recordtester/recordtester_app.go | 15 ++++++- 7 files changed, 111 insertions(+), 11 deletions(-) diff --git a/.editorconfig b/.editorconfig index 158cf3f5..4d2e27ef 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,6 +14,10 @@ end_of_line = lf [Makefile] indent_style = tab +[Dockerfile*] +indent_style = tab +indent_size = 8 + # YAML Files [*.{yml,yaml,sh}] indent_size = 2 diff --git a/cmd/recordtester/recordtester.go b/cmd/recordtester/recordtester.go index 366ddf1b..962232ed 100644 --- a/cmd/recordtester/recordtester.go +++ b/cmd/recordtester/recordtester.go @@ -16,6 +16,7 @@ import ( "time" "github.com/golang/glog" + serfClient "github.com/hashicorp/serf/client" api "github.com/livepeer/go-api-client" "github.com/livepeer/joy4/format" "github.com/livepeer/livepeer-data/pkg/client" @@ -36,6 +37,23 @@ func init() { rand.Seed(time.Now().UnixNano()) } +func getSerfMembers(serfRPCAddr string) ([]serfClient.Member, error) { + if serfRPCAddr == "" { + return nil, nil + } + rpcClient, err := serfClient.NewRPCClient(serfRPCAddr) + if err != nil { + glog.Error(err) + return nil, err + } + members, err := rpcClient.Members() + if err != nil { + glog.Error(err) + return nil, err + } + return members, nil +} + func main() { flag.Set("logtostderr", "true") vFlag := flag.Lookup("v") @@ -51,6 +69,7 @@ func main() { taskPollDuration := fs.Duration("task-poll-dur", 15*time.Second, "How long to wait between polling for task status") apiToken := fs.String("api-token", "", "Token of the Livepeer API to be used") apiServer := fs.String("api-server", "livepeer.com", "Server of the Livepeer API to be used") + serfRPCAddr := fs.String("serf-rpc-addr", "", "Serf RPC address for fetching serf members (replaces `--ingest` flag)") ingestStr := fs.String("ingest", "", "Ingest server info in JSON format including ingest and playback URLs. Should follow Livepeer API schema") analyzerServers := fs.String("analyzer-servers", "", "Comma-separated list of base URLs to connect for the Stream Health Analyzer API (defaults to --api-server)") fileArg := fs.String("file", "bbb_sunflower_1080p_30fps_normal_t02.mp4", "File to stream") @@ -125,10 +144,10 @@ func main() { // model.ProfilesNum = int(*profiles) if *testDuration == 0 { - glog.Fatalf("-test-dur should be specified") + glog.Fatal("--test-dur should be specified") } if *apiToken == "" { - glog.Fatalf("-api-token should be specified") + glog.Fatal("--api-token should be specified") } if fileName, err = utils.GetFile(*fileArg, strings.ReplaceAll(hostName, ".", "_")); err != nil { @@ -143,10 +162,22 @@ func main() { var ingest *api.Ingest if *ingestStr != "" { if err := json.Unmarshal([]byte(*ingestStr), &ingest); err != nil { - glog.Fatalf("Error parsing -ingest argument: %v", err) + glog.Fatalf("Error parsing --ingest argument: %v", err) } } + serfMembers, err := getSerfMembers(*serfRPCAddr) + if err != nil { + glog.Fatalf("failed to process serf members: %w", err) + } + serfOptions := &recordtester.SerfOptions{ + UseSerf: false, + SerfMembers: serfMembers, + } + if serfMembers != nil { + serfOptions.UseSerf = true + } + var lapi *api.Client var createdAPIStreams []string cleanup := func(fn, fa string) { @@ -232,7 +263,7 @@ func main() { start := time.Now() for i := 0; i < *sim; i++ { - rt := recordtester.NewRecordTester(gctx, rtOpts) + rt := recordtester.NewRecordTester(gctx, rtOpts, serfOptions) eses = append(eses, 0) testers = append(testers, rt) wg.Add(1) @@ -287,7 +318,7 @@ func main() { PagerDutyLowUrgency: *pagerDutyLowUrgency, VodTesterOptions: vtOpts, } - cvt := vodtester.NewContinuousVodTester(egCtx, cvtOpts) + cvt := vodtester.NewContinuousVodTester(egCtx, cvtOpts, serfOptions) return cvt.Start(fileName, *vodImportUrl, *testDuration, *taskPollDuration, *continuousTest) }) } @@ -298,7 +329,7 @@ func main() { return } // just one stream - rt := recordtester.NewRecordTester(gctx, rtOpts) + rt := recordtester.NewRecordTester(gctx, rtOpts, serfOptions) es, err := rt.Start(fileName, *testDuration, *pauseDuration) exit(es, fileName, *fileArg, err) } diff --git a/docker/Dockerfile.record-tester b/docker/Dockerfile.record-tester index c59e0ec9..dad34fbb 100644 --- a/docker/Dockerfile.record-tester +++ b/docker/Dockerfile.record-tester @@ -21,7 +21,7 @@ FROM --platform=$TARGETPLATFORM debian:stretch-slim WORKDIR /root -RUN apt update && \ +RUN apt update && \ apt install -yqq ca-certificates curl && \ apt clean diff --git a/go.mod b/go.mod index 7b3c756b..6c4d9d12 100644 --- a/go.mod +++ b/go.mod @@ -97,7 +97,7 @@ require ( golang.org/x/mod v0.5.1 // indirect golang.org/x/oauth2 v0.0.0-20210427180440-81ed05c6b58c // indirect golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f - golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 // indirect + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 // indirect golang.org/x/tools v0.1.9 // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.6.7 // indirect @@ -111,9 +111,25 @@ require ( require ( github.com/eventials/go-tus v0.0.0-20220610120217-05d0564bb571 // indirect + github.com/hashicorp/serf v0.10.1 github.com/tomnomnom/linkheader v0.0.0-20180905144013-02ca5825eb80 // indirect ) +require ( + github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da // indirect + github.com/google/btree v1.0.0 // indirect + github.com/hashicorp/errwrap v1.0.0 // indirect + github.com/hashicorp/go-immutable-radix v1.0.0 // indirect + github.com/hashicorp/go-msgpack v0.5.3 // indirect + github.com/hashicorp/go-multierror v1.1.0 // indirect + github.com/hashicorp/go-sockaddr v1.0.0 // indirect + github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/logutils v1.0.0 // indirect + github.com/hashicorp/memberlist v0.5.0 // indirect + github.com/miekg/dns v1.1.41 // indirect + github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 // indirect +) + exclude github.com/gosuri/uilive v0.0.4 // cause memory corruption // replace github.com/livepeer/joy4 => /Users/dark/projects/livepeer/joy4 diff --git a/go.sum b/go.sum index 3ceee16e..63480b6c 100644 --- a/go.sum +++ b/go.sum @@ -130,8 +130,10 @@ github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kd github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/aristanetworks/goarista v0.0.0-20170210015632-ea17b1a17847/go.mod h1:D/tb0zPVXnP7fmsLZjtdUhSsumbK/ij54UXjjVgMGxQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= +github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da h1:8GUt8eRujhVEGZFFEjBj46YV4rDjvGrNxb0KMWYkL2I= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= github.com/aws/aws-sdk-go v1.15.11/go.mod h1:mFuSZ37Z9YOHbQEwBWztmVzqXrEkub65tZoCYDt7FT0= github.com/aws/aws-sdk-go v1.20.1/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= @@ -366,6 +368,7 @@ github.com/eventials/go-tus v0.0.0-20220610120217-05d0564bb571 h1:0i+Y7klNNqXwzA github.com/eventials/go-tus v0.0.0-20220610120217-05d0564bb571/go.mod h1:XYuK1S5+kS6FGhlIUFuZFPvWiSrOIoLk6+ro33Xce3Y= github.com/fatih/color v1.3.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= +github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU= github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= github.com/fjl/memsize v0.0.0-20180418122429-ca190fb6ffbc/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= @@ -508,6 +511,7 @@ github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/btree v1.0.0 h1:0udJVsspx3VBr5FwtLhQQtuAsVc79tTq0ocGIPAU6qo= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= @@ -580,15 +584,21 @@ github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplb github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q= github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v0.0.0-20141028054710-7554cd9344ce/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-msgpack v0.5.3 h1:zKjpN5BK/P5lMYrLmBHdBULWbJ0XpYR+7NGzqkZzoD4= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v0.0.0-20161216184304-ed905158d874/go.mod h1:JMRHfdO9jKNzS/+BTlxCjKNQHg/jZAft8U7LloJvN7I= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.0 h1:B9UzwGQJehnUY1yNrnwREHc3fGbC2xefo8g4TbElacI= +github.com/hashicorp/go-multierror v1.1.0/go.mod h1:spPvp8C1qA32ftKqdAHm4hHTbPw+vmowP0z+KUhOZdA= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= +github.com/hashicorp/go-sockaddr v1.0.0 h1:GeH6tui99pF4NJgfnhp+L6+FfobzVW3Ah46sLo0ICXs= github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= @@ -600,10 +610,16 @@ github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uG github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/hashicorp/logutils v1.0.0 h1:dLEQVugN8vlakKOUE3ihGLTZJRB4j+M2cdTm/ORI65Y= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= +github.com/hashicorp/mdns v1.0.4/go.mod h1:mtBihi+LeNXGtG8L9dX59gAEa12BDtBQSp4v/YAJqrc= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= +github.com/hashicorp/memberlist v0.5.0 h1:EtYPN8DpAURiapus508I4n9CzHs2W+8NZGbmmR/prTM= +github.com/hashicorp/memberlist v0.5.0/go.mod h1:yvyXLpo0QaGE59Y7hDTsTzDD25JYBZ4mHgHUZ8lrOI0= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/serf v0.10.1 h1:Z1H2J60yRKvfDYAOZLd2MU0ND4AH/WDz7xYHDWQsIPY= +github.com/hashicorp/serf v0.10.1/go.mod h1:yL2t6BqATOLGc5HF7qbFkTfXoPIY0WZdWHfEvMqbG+4= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= github.com/holiman/uint256 v1.1.1/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= @@ -736,6 +752,8 @@ github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIG github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= +github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -747,6 +765,7 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx github.com/mattn/go-isatty v0.0.5-0.20180830101745-3fb116b82035/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= +github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE= github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= @@ -762,9 +781,13 @@ github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5 github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 h1:I0XW9+e1XWDxdcEniV4rQAIOPUGDq67JSCiRCgGCZLI= github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= +github.com/miekg/dns v1.1.26/go.mod h1:bPDLeHnStXmXAq1m/Ch/hvfNHr14JKNPMBo3VZKjuso= +github.com/miekg/dns v1.1.41 h1:WMszZWJG0XmzbK9FEmzH2TVcqYzFesusSIB41b8KHxY= +github.com/miekg/dns v1.1.41/go.mod h1:p6aan82bvRIyn+zDIv9xYNUpwa73JcSh9BKwknJysuI= github.com/miekg/pkcs11 v1.0.3/go.mod h1:XsNlhZGX73bx86s2hdc/FuaLm2CPZJemRLMA+WTFxgs= github.com/mistifyio/go-zfs v2.1.2-0.20190413222219-f784269be439+incompatible/go.mod h1:8AuVvqP/mXw1px98n46wfvcGfQ4ci2FwoAjKYxuo3Z4= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= +github.com/mitchellh/cli v1.1.0/go.mod h1:xcISNoH86gajksDmfB23e/pu+B+GeFRMYmoHXxx3xhI= github.com/mitchellh/go-homedir v1.0.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -892,6 +915,7 @@ github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUI github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA= github.com/prometheus/client_golang v0.0.0-20180209125602-c332b6f63c06/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= @@ -957,6 +981,7 @@ github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQD github.com/ryanuber/columnize v0.0.0-20160712163229-9b3edd62028f/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/safchain/ethtool v0.0.0-20190326074333-42ed695e3de8/go.mod h1:Z0q5wiBQGYcxhMZ6gUqHn6pYNLypFAvaL3UvgZLR0U4= github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529 h1:nn5Wsu0esKSJiIVhscUtVbo7ada43DJhG55ua/hjS5I= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvWlF4P2Ca7zGrPiEpWo= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= @@ -1127,6 +1152,7 @@ golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20190923035154-9ee001bba392/go.mod h1:/lpIB1dKB+9EgE3H3cr1v9wB50oz8l4C4h62xy7jSTY= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= @@ -1207,6 +1233,7 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191004110552-13f9640d40b9/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -1234,6 +1261,7 @@ golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210410081132-afb366fc7cd1/go.mod h1:9tjilg8BloeKEkVJvy7fQ90B1CfIiPueXVOjqfkSzI8= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -1302,6 +1330,8 @@ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190916202348-b4ddaad3f8a3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190922100055-0a153f010e69/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190924154521-2837fb4f24fe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191022100944-742c48ecaeb7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1353,6 +1383,7 @@ golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210303074136-134d130e1a04/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1374,6 +1405,8 @@ golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211109184856-51b60fd695b3/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8 h1:OH54vjqzRWmbJ62fjuhxy7AxFFgoHN0/DPc/UrL8cAs= golang.org/x/sys v0.0.0-20220319134239-a9b59b0215f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1418,6 +1451,7 @@ golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgw golang.org/x/tools v0.0.0-20190624222133-a101b041ded4/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20190907020128-2ca718005c18/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= diff --git a/internal/app/recordtester/continuous_record_tester.go b/internal/app/recordtester/continuous_record_tester.go index 5cec359d..bfe71227 100644 --- a/internal/app/recordtester/continuous_record_tester.go +++ b/internal/app/recordtester/continuous_record_tester.go @@ -39,6 +39,7 @@ type ( pagerDutyComponent string pagerDutyLowUrgency bool rtOpts RecordTesterOptions + serfOpts SerfOptions } pagerDutyLink struct { @@ -48,7 +49,7 @@ type ( ) // NewContinuousRecordTester returns new object -func NewContinuousRecordTester(gctx context.Context, opts ContinuousRecordTesterOptions) IContinuousRecordTester { +func NewContinuousRecordTester(gctx context.Context, opts ContinuousRecordTesterOptions, serfOpts SerfOptions) IContinuousRecordTester { ctx, cancel := context.WithCancel(gctx) server := opts.API.GetServer() u, _ := url.Parse(server) @@ -60,6 +61,7 @@ func NewContinuousRecordTester(gctx context.Context, opts ContinuousRecordTester pagerDutyComponent: opts.PagerDutyComponent, pagerDutyLowUrgency: opts.PagerDutyLowUrgency, rtOpts: opts.RecordTesterOptions, + serfOpts: serfOpts, } return crt } @@ -74,7 +76,7 @@ func (crt *continuousRecordTester) Start(fileName string, testDuration, pauseDur messenger.SendMessage(msg) ctx, cancel := context.WithTimeout(crt.ctx, maxTestDuration) - rt := NewRecordTester(ctx, crt.rtOpts) + rt := NewRecordTester(ctx, crt.rtOpts, crt.serfOpts) es, err := rt.Start(fileName, testDuration, pauseDuration) rt.Clean() ctxErr := ctx.Err() diff --git a/internal/app/recordtester/recordtester_app.go b/internal/app/recordtester/recordtester_app.go index 9ed05e92..5f80ba5a 100644 --- a/internal/app/recordtester/recordtester_app.go +++ b/internal/app/recordtester/recordtester_app.go @@ -6,11 +6,13 @@ import ( "errors" "fmt" "io/ioutil" + "math/rand" "net/http" "os" "time" "github.com/golang/glog" + serfClient "github.com/hashicorp/serf/client" api "github.com/livepeer/go-api-client" "github.com/livepeer/joy4/format/mp4" "github.com/livepeer/joy4/format/mp4/mp4io" @@ -32,6 +34,11 @@ type ( Stream() *api.Stream } + SerfOptions struct { + UseSerf bool + SerfMembers []serfClient.Member + } + RecordTesterOptions struct { API *api.Client Analyzers testers.AnalyzerByRegion @@ -54,6 +61,7 @@ type ( useHTTP bool mp4 bool streamHealth bool + serfOpts SerfOptions // mutable fields streamID string @@ -63,7 +71,7 @@ type ( ) // NewRecordTester ... -func NewRecordTester(gctx context.Context, opts RecordTesterOptions) IRecordTester { +func NewRecordTester(gctx context.Context, opts RecordTesterOptions, serfOpts SerfOptions) IRecordTester { ctx, cancel := context.WithCancel(gctx) rt := &recordTester{ lapi: opts.API, @@ -76,6 +84,7 @@ func NewRecordTester(gctx context.Context, opts RecordTesterOptions) IRecordTest useHTTP: opts.UseHTTP, mp4: opts.TestMP4, streamHealth: opts.TestStreamHealth, + serfOpts: serfOpts, } return rt } @@ -153,6 +162,10 @@ func (rt *recordTester) Start(fileName string, testDuration, pauseDuration time. } mediaURL := fmt.Sprintf("%s/%s/index.m3u8", ingest.Playback, stream.PlaybackID) + if rt.serfOpts.UseSerf { + serfMember := rt.serfOpts.SerfMembers[rand.Intn(len(rt.serfOpts.SerfMembers))] + mediaURL = fmt.Sprintf("%s/hls/%s/index.m3u8", serfMember.Tags["https"], stream.PlaybackID) + } glog.V(model.SHORT).Infof("RTMP: %s", rtmpURL) glog.V(model.SHORT).Infof("MEDIA: %s", mediaURL) if rt.useHTTP { From 3cb8c917626999612fcab4ef9bf9202fb128147b Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Wed, 28 Dec 2022 17:07:40 +0530 Subject: [PATCH 2/5] recordtester: Option to use a random serf member for playback. --- cmd/recordtester/recordtester.go | 22 +++++++++++-------- internal/app/recordtester/recordtester_app.go | 11 +++++++--- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cmd/recordtester/recordtester.go b/cmd/recordtester/recordtester.go index 962232ed..61e8cc07 100644 --- a/cmd/recordtester/recordtester.go +++ b/cmd/recordtester/recordtester.go @@ -69,7 +69,6 @@ func main() { taskPollDuration := fs.Duration("task-poll-dur", 15*time.Second, "How long to wait between polling for task status") apiToken := fs.String("api-token", "", "Token of the Livepeer API to be used") apiServer := fs.String("api-server", "livepeer.com", "Server of the Livepeer API to be used") - serfRPCAddr := fs.String("serf-rpc-addr", "", "Serf RPC address for fetching serf members (replaces `--ingest` flag)") ingestStr := fs.String("ingest", "", "Ingest server info in JSON format including ingest and playback URLs. Should follow Livepeer API schema") analyzerServers := fs.String("analyzer-servers", "", "Comma-separated list of base URLs to connect for the Stream Health Analyzer API (defaults to --api-server)") fileArg := fs.String("file", "bbb_sunflower_1080p_30fps_normal_t02.mp4", "File to stream") @@ -90,6 +89,10 @@ func main() { pagerDutyLowUrgency := fs.Bool("pagerduty-low-urgency", false, "Whether to send only low-urgency PagerDuty alerts") bind := fs.String("bind", "0.0.0.0:9090", "Address to bind metric server to") + serfRPCAddr := fs.String("serf-rpc-addr", "", "Serf RPC address for fetching serf members (replaces `--ingest` flag)") + useSerf := fs.Bool("use-serf", false, "Use serf playback URLs") + useRandomSerfMember := fs.Bool("random-serf-member", false, "Use a random member from serf member list") + _ = fs.String("config", "", "config file (optional)") ff.Parse(fs, os.Args[1:], @@ -149,6 +152,9 @@ func main() { if *apiToken == "" { glog.Fatal("--api-token should be specified") } + if *useSerf && *serfRPCAddr == "" { + glog.Fatal("--serf-rpc-addr needed with --use-serf option") + } if fileName, err = utils.GetFile(*fileArg, strings.ReplaceAll(hostName, ".", "_")); err != nil { if err == utils.ErrNotFound { @@ -170,12 +176,10 @@ func main() { if err != nil { glog.Fatalf("failed to process serf members: %w", err) } - serfOptions := &recordtester.SerfOptions{ - UseSerf: false, - SerfMembers: serfMembers, - } - if serfMembers != nil { - serfOptions.UseSerf = true + serfOptions := recordtester.SerfOptions{ + UseSerf: *useSerf, + SerfMembers: serfMembers, + RandomSerfMember: *useRandomSerfMember, } var lapi *api.Client @@ -306,7 +310,7 @@ func main() { PagerDutyLowUrgency: *pagerDutyLowUrgency, RecordTesterOptions: rtOpts, } - crt := recordtester.NewContinuousRecordTester(egCtx, crtOpts) + crt := recordtester.NewContinuousRecordTester(egCtx, crtOpts, serfOptions) return crt.Start(fileName, *testDuration, *pauseDuration, *continuousTest) }) } @@ -318,7 +322,7 @@ func main() { PagerDutyLowUrgency: *pagerDutyLowUrgency, VodTesterOptions: vtOpts, } - cvt := vodtester.NewContinuousVodTester(egCtx, cvtOpts, serfOptions) + cvt := vodtester.NewContinuousVodTester(egCtx, cvtOpts) return cvt.Start(fileName, *vodImportUrl, *testDuration, *taskPollDuration, *continuousTest) }) } diff --git a/internal/app/recordtester/recordtester_app.go b/internal/app/recordtester/recordtester_app.go index 5f80ba5a..facb39b5 100644 --- a/internal/app/recordtester/recordtester_app.go +++ b/internal/app/recordtester/recordtester_app.go @@ -35,8 +35,9 @@ type ( } SerfOptions struct { - UseSerf bool - SerfMembers []serfClient.Member + UseSerf bool + SerfMembers []serfClient.Member + RandomSerfMember bool } RecordTesterOptions struct { @@ -163,7 +164,11 @@ func (rt *recordTester) Start(fileName string, testDuration, pauseDuration time. mediaURL := fmt.Sprintf("%s/%s/index.m3u8", ingest.Playback, stream.PlaybackID) if rt.serfOpts.UseSerf { - serfMember := rt.serfOpts.SerfMembers[rand.Intn(len(rt.serfOpts.SerfMembers))] + index := 0 + if rt.serfOpts.RandomSerfMember { + index = rand.Intn(len(rt.serfOpts.SerfMembers)) + } + serfMember := rt.serfOpts.SerfMembers[index] mediaURL = fmt.Sprintf("%s/hls/%s/index.m3u8", serfMember.Tags["https"], stream.PlaybackID) } glog.V(model.SHORT).Infof("RTMP: %s", rtmpURL) From 3c755d71003ebbce95c49037ff570afe5a24b4bb Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Wed, 28 Dec 2022 17:10:41 +0530 Subject: [PATCH 3/5] recordtester: Fix `%w` -> `%v` in `glog` error wrapping --- cmd/recordtester/recordtester.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/recordtester/recordtester.go b/cmd/recordtester/recordtester.go index 61e8cc07..a2b3631b 100644 --- a/cmd/recordtester/recordtester.go +++ b/cmd/recordtester/recordtester.go @@ -174,7 +174,7 @@ func main() { serfMembers, err := getSerfMembers(*serfRPCAddr) if err != nil { - glog.Fatalf("failed to process serf members: %w", err) + glog.Fatalf("failed to process serf members: %v", err) } serfOptions := recordtester.SerfOptions{ UseSerf: *useSerf, From 074cc850ce994434314324b50c5cc7d9a0ed2cdd Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Thu, 29 Dec 2022 09:44:36 +0530 Subject: [PATCH 4/5] recordtester: Fix flag description text --- cmd/recordtester/recordtester.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/recordtester/recordtester.go b/cmd/recordtester/recordtester.go index a2b3631b..34f8c72d 100644 --- a/cmd/recordtester/recordtester.go +++ b/cmd/recordtester/recordtester.go @@ -89,7 +89,7 @@ func main() { pagerDutyLowUrgency := fs.Bool("pagerduty-low-urgency", false, "Whether to send only low-urgency PagerDuty alerts") bind := fs.String("bind", "0.0.0.0:9090", "Address to bind metric server to") - serfRPCAddr := fs.String("serf-rpc-addr", "", "Serf RPC address for fetching serf members (replaces `--ingest` flag)") + serfRPCAddr := fs.String("serf-rpc-addr", "", "Serf RPC address for fetching serf members") useSerf := fs.Bool("use-serf", false, "Use serf playback URLs") useRandomSerfMember := fs.Bool("random-serf-member", false, "Use a random member from serf member list") From 9600a4e6b890924ede083c24d20220adeaa875c8 Mon Sep 17 00:00:00 2001 From: hjpotter92 Date: Tue, 3 Jan 2023 11:06:03 +0530 Subject: [PATCH 5/5] recordtester: Add unimplemented `pull-count` flag. --- cmd/recordtester/recordtester.go | 2 ++ internal/app/recordtester/recordtester_app.go | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/cmd/recordtester/recordtester.go b/cmd/recordtester/recordtester.go index 34f8c72d..b6e93027 100644 --- a/cmd/recordtester/recordtester.go +++ b/cmd/recordtester/recordtester.go @@ -92,6 +92,7 @@ func main() { serfRPCAddr := fs.String("serf-rpc-addr", "", "Serf RPC address for fetching serf members") useSerf := fs.Bool("use-serf", false, "Use serf playback URLs") useRandomSerfMember := fs.Bool("random-serf-member", false, "Use a random member from serf member list") + serfPullCount := fs.Int("pull-count", 1, "Number of serf nodes to pull playback from (requires `--use-serf`)") _ = fs.String("config", "", "config file (optional)") @@ -180,6 +181,7 @@ func main() { UseSerf: *useSerf, SerfMembers: serfMembers, RandomSerfMember: *useRandomSerfMember, + SerfPullCount: *serfPullCount, } var lapi *api.Client diff --git a/internal/app/recordtester/recordtester_app.go b/internal/app/recordtester/recordtester_app.go index facb39b5..0129f093 100644 --- a/internal/app/recordtester/recordtester_app.go +++ b/internal/app/recordtester/recordtester_app.go @@ -38,6 +38,10 @@ type ( UseSerf bool SerfMembers []serfClient.Member RandomSerfMember bool + + // TODO: pull from multiple nodes; each one will need to + // trigger a separate playback + SerfPullCount int } RecordTesterOptions struct {