Skip to content

Commit 68e5971

Browse files
nareddythtuch
authored andcommitted
Add support for Fortio output format (envoyproxy#168)
Add support for Fortio output format Testing: Added a unit test the compare the output to a golden file Docs: Added sample data/reports, added docs to README.md Signed-off-by: Teju Nareddy <[email protected]>
1 parent dfab764 commit 68e5971

17 files changed

+4727
-15
lines changed

README.md

+30-13
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Nighthawk currently offers:
99
- A load testing client which supports HTTP/1.1 and HTTP/2 over HTTP and HTTPS.
1010
(HTTPS certificates are not yet validated).
1111
- A simple [test server](source/server/README.md) which is capable of generating dynamic response sizes, as well as inject delays.
12-
12+
- A binary to transform nighthawk output to well-known formats, allowing integration with other systems and dashboards.
1313

1414
## Prerequisites
1515

@@ -55,12 +55,13 @@ bazel-bin/nighthawk_client [--trace <uri format>]
5555
|CONNECT|OPTIONS|TRACE>] [--address-family
5656
<auto|v4|v6>] [--burst-size <uint32_t>]
5757
[--prefetch-connections] [--output-format
58-
<json|human|yaml|dotted>] [-v <trace|debug
59-
|info|warn|error|critical>] [--concurrency
60-
<string>] [--h2] [--timeout <uint32_t>]
61-
[--duration <uint32_t>] [--connections
62-
<uint32_t>] [--rps <uint32_t>] [--]
63-
[--version] [-h] <uri format>
58+
<json|human|yaml|dotted|fortio>] [-v <trace
59+
|debug|info|warn|error|critical>]
60+
[--concurrency <string>] [--h2] [--timeout
61+
<uint32_t>] [--duration <uint32_t>]
62+
[--connections <uint32_t>] [--rps
63+
<uint32_t>] [--] [--version] [-h] <uri
64+
format>
6465
6566
6667
Where:
@@ -111,9 +112,9 @@ Release requests in bursts of the specified size (default: 0).
111112
--prefetch-connections
112113
Prefetch connections before benchmarking (HTTP/1 only).
113114
114-
--output-format <json|human|yaml|dotted>
115-
Output format. Possible values: {"json", "human", "yaml", "dotted"}.
116-
The default output format is 'human'.
115+
--output-format <json|human|yaml|dotted|fortio>
116+
Output format. Possible values: {"json", "human", "yaml", "dotted",
117+
"fortio"}. The default output format is 'human'.
117118
118119
-v <trace|debug|info|warn|error|critical>, --verbosity <trace|debug
119120
|info|warn|error|critical>
@@ -208,14 +209,15 @@ Nighthawk comes with a tool to transform its json output to its other supported
208209
USAGE:
209210
210211
bazel-bin/nighthawk_output_transform --output-format <json|human|yaml
211-
|dotted> [--] [--version] [-h]
212+
|dotted|fortio> [--] [--version]
213+
[-h]
212214
213215
214216
Where:
215217
216-
--output-format <json|human|yaml|dotted>
218+
--output-format <json|human|yaml|dotted|fortio>
217219
(required) Output format. Possible values: {"json", "human", "yaml",
218-
"dotted"}.
220+
"dotted", "fortio"}.
219221
220222
--, --ignore_rest
221223
Ignores the rest of the labeled arguments following this flag.
@@ -305,6 +307,21 @@ client.upstream_rq_total 9994 1998.80
305307
[21:28:18.522403][27849][I] [source/client/client.cc:279] Done.
306308
```
307309

310+
## Visualizing the output of a benchmark
311+
312+
Nighthawk supports transforming the output into other well-known formats, such as:
313+
314+
- `dotted`: Provides integration with Prometheus
315+
- `fortio`: Provides integration with [Fortio's report-only UI](https://github.com/fortio/fortio#report-only-ui)
316+
317+
The following is an example of a nighthawk benchmark visualized via the Fortio UI.
318+
319+
```bash
320+
fortio report --data-dir ./samples/fortio_data
321+
```
322+
323+
![Fortio Large Report](./samples/fortio_reports/large.png)
324+
308325
## Accuracy and repeatability considerations when using the Nighthawk client
309326

310327
- Processes not related to the benchmarking task at hand may add significant noise. Consider stopping any

api/client/options.proto

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ message OutputFormat {
4747
HUMAN = 2;
4848
YAML = 3;
4949
DOTTED = 4;
50+
FORTIO = 5;
5051
}
5152
OutputFormatOptions value = 1;
5253
}

api/client/transform/BUILD

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
licenses(["notice"]) # Apache 2
2+
3+
load("@envoy//bazel:envoy_build_system.bzl", "envoy_package")
4+
load("@envoy_api//bazel:api_build_system.bzl", "api_cc_py_proto_library")
5+
6+
envoy_package()
7+
8+
api_cc_py_proto_library(
9+
name = "transform",
10+
srcs = [
11+
"fortio.proto",
12+
],
13+
visibility = ["//visibility:public"],
14+
)

api/client/transform/fortio.proto

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
syntax = "proto3";
2+
3+
package nighthawk.client;
4+
5+
import "google/protobuf/duration.proto";
6+
import "google/protobuf/timestamp.proto";
7+
import "google/protobuf/wrappers.proto";
8+
import "validate/validate.proto";
9+
10+
// This proto represents that output format that Fortio expects when converted to JSON.
11+
// Nighthawk can fill in this proto, and then unmarshal to the Fortio-compatible JSON.
12+
// Therefore, this proto may not follow conventions. aip.dev/not-precedent
13+
message FortioResult {
14+
// Disable validate because it doesn't work well with fields that are not all lowercase.
15+
// The field cases must match the final output JSON that fortio-ui expects.
16+
option (validate.disabled) = true;
17+
18+
string Labels = 1;
19+
20+
google.protobuf.Timestamp StartTime = 2;
21+
22+
uint32 RequestedQPS = 3;
23+
24+
google.protobuf.Duration RequestedDuration = 4;
25+
26+
double ActualQPS = 5;
27+
28+
double ActualDuration = 6;
29+
30+
uint32 NumThreads = 7;
31+
32+
DurationHistogram DurationHistogram = 8;
33+
34+
map<string, uint64> RetCodes = 11;
35+
36+
string URL = 12;
37+
}
38+
39+
message DurationHistogram {
40+
option (validate.disabled) = true;
41+
42+
uint64 Count = 1;
43+
44+
repeated DataEntry Data = 2;
45+
}
46+
47+
message DataEntry {
48+
option (validate.disabled) = true;
49+
50+
double Start = 1;
51+
52+
double End = 2;
53+
54+
double Percent = 3;
55+
56+
uint64 Count = 4;
57+
}

0 commit comments

Comments
 (0)