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

Commit

Permalink
Prepare for 0.2.0 release
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
alessfg committed Apr 23, 2020
1 parent 3f6271f commit 52365ef
Show file tree
Hide file tree
Showing 367 changed files with 38,991 additions and 8,378 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -16,3 +16,7 @@

# Build directories
build/

# packrd build artifacts
packrd/
main-packr.go
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -4,12 +4,15 @@ all: build_darwin build_linux build_windows

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

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

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

packrd:
packr2
Expand Down
51 changes: 37 additions & 14 deletions README.md
Expand Up @@ -4,7 +4,7 @@ This tool measures the latency response of a series of API endpoints and creates

## How to use

`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.
`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.

```
$ ./rtapi -h
Expand All @@ -15,20 +15,23 @@ USAGE:
rtapi [global options] command [command options] [arguments...]
VERSION:
v0.1.0
v0.2.0
COMMANDS:
help, h Shows a list of commands or help for one command
GLOBAL OPTIONS:
--file value, -f value Select a JSON file to load
--data value, -d value Pass API parameters directly as a JSON string
--output value, -o value PDF report file name
--file value, -f value select a JSON or YAML file to load
--data value, -d value input API parameters directly as a JSON string
--output value, -o value output query results in easy to grasp PDF report
--print, -p output technical query results to terminal (default: false)
--help, -h show help (default: false)
--version, -v print the version (default: false)
```

## Sample JSON
## Sample Input

### JSON

```json
[
Expand All @@ -47,21 +50,41 @@ GLOBAL OPTIONS:
"threads": 2,
"max_threads": 2,
"connections": 12,
"duration": 10,
"duration": "10s",
"request_rate": 500
}
}
]
```

## Default Query Values
### YAML

```yaml
- target:
url: https://www.example.com
method: POST
body: '{"id":"0"}'
header:
Content-Type:
- application/json
query_parameters:
threads: 2
max_threads: 2
connections: 12
duration: 10s
request_rate: 500
```

### Default Values

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.

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

```
"threads": 2
"max_threads": 2
"connections": 10
"duration": 10
"request_rate": 500
threads: 2
max_threads: 2
connections: 10
duration: 10s
request_rate: 500
```
18 changes: 8 additions & 10 deletions go.mod
Expand Up @@ -3,15 +3,13 @@ module github.com/nginxinc/rtapi
go 1.13

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

0 comments on commit 52365ef

Please sign in to comment.