Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit 52365ef

Browse files
committed
Prepare for 0.2.0 release
* Add support for YAML files * Update README.md * Add flag option to print latency results directly to terminal * Add success message when generating PDF * Add line at 30ms to mark real time boundary * Improve PDF and graph output * Update Gonum and Vegeta packages to their latest release * Update go.mod and vendor modules * Update .gitignore * Improve flags description * Update Makefile
1 parent 3f6271f commit 52365ef

367 files changed

Lines changed: 38991 additions & 8378 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@
1616

1717
# Build directories
1818
build/
19+
20+
# packrd build artifacts
21+
packrd/
22+
main-packr.go

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,15 @@ all: build_darwin build_linux build_windows
44

55
build_darwin: packrd
66
GOOS=darwin GOARCH=amd64 go build -mod vendor -o build/darwin/rtapi
7+
cd build/darwin && zip rtapi-mac.zip rtapi
78

89
build_linux: packrd
910
GOOS=linux GOARCH=amd64 go build -mod vendor -o build/linux/rtapi
11+
cd build/linux && zip rtapi-linux.zip rtapi
1012

1113
build_windows: packrd
1214
GOOS=windows GOARCH=amd64 go build -mod vendor -o build/windows/rtapi
15+
cd build/windows && zip rtapi-windows.zip rtapi
1316

1417
packrd:
1518
packr2

README.md

Lines changed: 37 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This tool measures the latency response of a series of API endpoints and creates
44

55
## How to use
66

7-
`rtapi` takes either a JSON file or a JSON string containing endpoint data and query parameters (optional), queries each endpoint using the query parameters (or default query values if no parameters have been specified), and outputs a PDF report containing all the endpoint query results plotted in an HDR histogram.
7+
`rtapi` takes either a JSON/YAML file or a JSON string containing endpoint data and query parameters (optional), queries each endpoint using the query parameters (or default query values if no parameters have been specified), and outputs a PDF report containing all the endpoint query results plotted in an HDR histogram.
88

99
```
1010
$ ./rtapi -h
@@ -15,20 +15,23 @@ USAGE:
1515
rtapi [global options] command [command options] [arguments...]
1616
1717
VERSION:
18-
v0.1.0
18+
v0.2.0
1919
2020
COMMANDS:
2121
help, h Shows a list of commands or help for one command
2222
2323
GLOBAL OPTIONS:
24-
--file value, -f value Select a JSON file to load
25-
--data value, -d value Pass API parameters directly as a JSON string
26-
--output value, -o value PDF report file name
24+
--file value, -f value select a JSON or YAML file to load
25+
--data value, -d value input API parameters directly as a JSON string
26+
--output value, -o value output query results in easy to grasp PDF report
27+
--print, -p output technical query results to terminal (default: false)
2728
--help, -h show help (default: false)
2829
--version, -v print the version (default: false)
2930
```
3031

31-
## Sample JSON
32+
## Sample Input
33+
34+
### JSON
3235

3336
```json
3437
[
@@ -47,21 +50,41 @@ GLOBAL OPTIONS:
4750
"threads": 2,
4851
"max_threads": 2,
4952
"connections": 12,
50-
"duration": 10,
53+
"duration": "10s",
5154
"request_rate": 500
5255
}
5356
}
5457
]
5558
```
5659

57-
## Default Query Values
60+
### YAML
61+
62+
```yaml
63+
- target:
64+
url: https://www.example.com
65+
method: POST
66+
body: '{"id":"0"}'
67+
header:
68+
Content-Type:
69+
- application/json
70+
query_parameters:
71+
threads: 2
72+
max_threads: 2
73+
connections: 12
74+
duration: 10s
75+
request_rate: 500
76+
```
77+
78+
### Default Values
79+
80+
Only the `target.url` parameter is required. If no method is specified the default is "GET", while in the case of the body and headers these will simply remain empty during the benchmark.
5881

59-
The default query parameters closely follow the default query parameters found in [`wrk2`](https://github.com/giltene/wrk2).
82+
The default `query_parameters` closely follow the default query parameters found in [`wrk2`](https://github.com/giltene/wrk2).
6083

6184
```
62-
"threads": 2
63-
"max_threads": 2
64-
"connections": 10
65-
"duration": 10
66-
"request_rate": 500
85+
threads: 2
86+
max_threads: 2
87+
connections: 10
88+
duration: 10s
89+
request_rate: 500
6790
```

go.mod

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,13 @@ module github.com/nginxinc/rtapi
33
go 1.13
44

55
require (
6-
github.com/bmizerany/perks v0.0.0-20141205001514-d9a9656a3a4b // indirect
7-
github.com/dgryski/go-gk v0.0.0-20140819190930-201884a44051 // indirect
8-
github.com/gobuffalo/packr/v2 v2.7.1
9-
github.com/influxdata/tdigest v0.0.1 // indirect
6+
github.com/ajstarks/svgo v0.0.0-20200320125537-f189e35d30ca // indirect
7+
github.com/gobuffalo/packr/v2 v2.8.0
108
github.com/jung-kurt/gofpdf v1.16.2
11-
github.com/mailru/easyjson v0.7.0 // indirect
12-
github.com/streadway/quantile v0.0.0-20150917103942-b0c588724d25 // indirect
13-
github.com/tsenart/vegeta v12.7.0+incompatible
14-
github.com/urfave/cli/v2 v2.1.1
15-
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 // indirect
16-
gonum.org/v1/plot v0.0.0-20200111075622-4abb28f724d5
9+
github.com/tsenart/vegeta/v12 v12.8.3
10+
github.com/urfave/cli/v2 v2.2.0
11+
golang.org/x/image v0.0.0-20200119044424-58c23975cae1 // indirect
12+
gonum.org/v1/netlib v0.0.0-20200317120129-c5a04cffd98a // indirect
13+
gonum.org/v1/plot v0.7.1-0.20200415083422-475e39bcda54
14+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
1715
)

0 commit comments

Comments
 (0)