Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cmd/src/gateway_benchmark.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Examples:

$ src gateway benchmark
$ src gateway benchmark --requests 50
$ src gateway benchmark --gateway http://localhost:9992 --sourcegraph http://localhost:3082
$ src gateway benchmark --requests 50 --csv results.csv
`

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

handler := func(args []string) error {
Expand All @@ -71,16 +73,16 @@ Examples:
return fmt.Errorf("WebSocket dial(%s): %v", wsURL, err)
}
endpoints["ws(s): gateway"] = gatewayWebsocket
endpoints["http(s): gateway"] = fmt.Sprint(*gatewayEndpoint, "/v2")
endpoints["http(s): gateway"] = fmt.Sprint(*gatewayEndpoint, "/v2/http")
}
if cfg.Endpoint != "" {
wsURL := strings.Replace(fmt.Sprint(cfg.Endpoint, "/.api/gateway/websocket"), "http", "ws", 1)
if *sgEndpoint != "" {
wsURL := strings.Replace(fmt.Sprint(*sgEndpoint, "/.api/gateway/websocket"), "http", "ws", 1)
sourcegraphWebsocket, _, err = websocket.DefaultDialer.Dial(wsURL, nil)
if err != nil {
return fmt.Errorf("WebSocket dial(%s): %v", wsURL, err)
}
endpoints["ws(s): sourcegraph"] = sourcegraphWebsocket
endpoints["http(s): sourcegraph"] = fmt.Sprint(*gatewayEndpoint, "/.api/gateway")
endpoints["http(s): sourcegraph"] = fmt.Sprint(*sgEndpoint, "/.api/gateway/http")
}

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