diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-11-21 09:53:52 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-21 09:53:52 +0100 |
commit | 8f9be373aca924f1d146ceb668c7b9a8463c6da3 (patch) | |
tree | 50a2af1a4caaa20da7b5baa41be1ddd1fd58e5d8 /client/go/internal/cli | |
parent | 430c0f8c9e1ea5eaeae2b795cd4b7350091679ae (diff) | |
parent | 29fd9a845fe1474167159b7868a2c2c4a924a14e (diff) |
Merge pull request #29397 from vespa-engine/mpolden/tweak-feed-output
Count operations passed to feeder
Diffstat (limited to 'client/go/internal/cli')
-rw-r--r-- | client/go/internal/cli/cmd/feed.go | 32 | ||||
-rw-r--r-- | client/go/internal/cli/cmd/feed_test.go | 2 |
2 files changed, 32 insertions, 2 deletions
diff --git a/client/go/internal/cli/cmd/feed.go b/client/go/internal/cli/cmd/feed.go index 1a32ac7110d..89e13a4673c 100644 --- a/client/go/internal/cli/cmd/feed.go +++ b/client/go/internal/cli/cmd/feed.go @@ -64,10 +64,36 @@ func newFeedCmd(cli *CLI) *cobra.Command { This command can be used to feed large amounts of documents to a Vespa cluster efficiently. -The contents of JSON-FILE must be either a JSON array or JSON objects separated by +The contents of json-file must be either a JSON array or JSON objects separated by newline (JSONL). -If JSON-FILE is a single dash ('-'), documents will be read from standard input. +If json-file is a single dash ('-'), documents will be read from standard input. + +Once feeding completes, metrics of the feed session are printed to standard out +in a JSON format: + +- feeder.operation.count: Number of operations passed to the feeder by the user, + not counting retries. +- feeder.seconds: Total time spent feeding. +- feeder.ok.count: Number of successful operations. +- feeder.ok.rate: Number of successful operations per second. +- feeder.error.count: Number of network errors (transport layer). +- feeder.inflight.count: Number of operations currently being sent. +- http.request.count: Number of HTTP requests made, including retries. +- http.request.bytes: Number of bytes sent. +- http.request.MBps: Request throughput measured in MB/s. This is the raw + operation throughput, and not the network throughput, + I.e. using compression does not affect this number. +- http.exception.count: Same as feeder.error.count. Present for compatiblity + with vespa-feed-client. +- http.response.count: Number of HTTP responses received. +- http.response.bytes: Number of bytes received. +- http.response.MBps: Response throughput measured in MB/s. +- http.response.error.count: Number of non-OK HTTP responses received. +- http.response.latency.millis.min: Lowest latency of a successful operation. +- http.response.latency.millis.avg: Average latency of successful operations. +- http.response.latency.millis.max: Highest latency of a successful operation. +- http.response.code.counts: Number of responses grouped by their HTTP code. `, Example: `$ vespa feed docs.jsonl moredocs.json $ cat docs.jsonl | vespa feed -`, @@ -244,6 +270,7 @@ type number float32 func (n number) MarshalJSON() ([]byte, error) { return []byte(fmt.Sprintf("%.3f", n)), nil } type feedSummary struct { + Operations int64 `json:"feeder.operation.count"` Seconds number `json:"feeder.seconds"` SuccessCount int64 `json:"feeder.ok.count"` SuccessRate number `json:"feeder.ok.rate"` @@ -272,6 +299,7 @@ func mbps(bytes int64, duration time.Duration) float64 { func writeSummaryJSON(w io.Writer, stats document.Stats, duration time.Duration) error { summary := feedSummary{ + Operations: stats.Operations, Seconds: number(duration.Seconds()), SuccessCount: stats.Successful(), SuccessRate: number(float64(stats.Successful()) / math.Max(1, duration.Seconds())), diff --git a/client/go/internal/cli/cmd/feed_test.go b/client/go/internal/cli/cmd/feed_test.go index 1cf9a6aba3c..daf649a0fd1 100644 --- a/client/go/internal/cli/cmd/feed_test.go +++ b/client/go/internal/cli/cmd/feed_test.go @@ -48,6 +48,7 @@ func TestFeed(t *testing.T) { assert.Equal(t, "", stderr.String()) want := `{ + "feeder.operation.count": 2, "feeder.seconds": 5.000, "feeder.ok.count": 2, "feeder.ok.rate": 0.400, @@ -122,6 +123,7 @@ func TestFeedInvalid(t *testing.T) { require.NotNil(t, cli.Run("feed", "-t", "http://127.0.0.1:8080", jsonFile)) want := `{ + "feeder.operation.count": 1, "feeder.seconds": 3.000, "feeder.ok.count": 1, "feeder.ok.rate": 0.333, |