Skip to content

Commit a441021

Browse files
vdavidEmi Gutekanst
andauthored
Use the new URLs and local port for WebSocket (#1127)
* Use the new URLs * Add new CLI flag to work with local Sourcegraph --------- Co-authored-by: Emi Gutekanst <stephen.gutekanst@gmail.com>
1 parent 4fdbf71 commit a441021

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

cmd/src/gateway_benchmark.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Examples:
3838
3939
$ src gateway benchmark
4040
$ src gateway benchmark --requests 50
41+
$ src gateway benchmark --gateway http://localhost:9992 --sourcegraph http://localhost:3082
4142
$ src gateway benchmark --requests 50 --csv results.csv
4243
`
4344

@@ -47,6 +48,7 @@ Examples:
4748
requestCount = flagSet.Int("requests", 1000, "Number of requests to make per endpoint")
4849
csvOutput = flagSet.String("csv", "", "Export results to CSV file (provide filename)")
4950
gatewayEndpoint = flagSet.String("gateway", "https://cody-gateway.sourcegraph.com", "Cody Gateway endpoint")
51+
sgEndpoint = flagSet.String("sourcegraph", "https://sourcegraph.com", "Sourcegraph endpoint")
5052
)
5153

5254
handler := func(args []string) error {
@@ -71,16 +73,16 @@ Examples:
7173
return fmt.Errorf("WebSocket dial(%s): %v", wsURL, err)
7274
}
7375
endpoints["ws(s): gateway"] = gatewayWebsocket
74-
endpoints["http(s): gateway"] = fmt.Sprint(*gatewayEndpoint, "/v2")
76+
endpoints["http(s): gateway"] = fmt.Sprint(*gatewayEndpoint, "/v2/http")
7577
}
76-
if cfg.Endpoint != "" {
77-
wsURL := strings.Replace(fmt.Sprint(cfg.Endpoint, "/.api/gateway/websocket"), "http", "ws", 1)
78+
if *sgEndpoint != "" {
79+
wsURL := strings.Replace(fmt.Sprint(*sgEndpoint, "/.api/gateway/websocket"), "http", "ws", 1)
7880
sourcegraphWebsocket, _, err = websocket.DefaultDialer.Dial(wsURL, nil)
7981
if err != nil {
8082
return fmt.Errorf("WebSocket dial(%s): %v", wsURL, err)
8183
}
8284
endpoints["ws(s): sourcegraph"] = sourcegraphWebsocket
83-
endpoints["http(s): sourcegraph"] = fmt.Sprint(*gatewayEndpoint, "/.api/gateway")
85+
endpoints["http(s): sourcegraph"] = fmt.Sprint(*sgEndpoint, "/.api/gateway/http")
8486
}
8587

8688
fmt.Printf("Starting benchmark with %d requests per endpoint...\n", *requestCount)

0 commit comments

Comments
 (0)