Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Panic decoding JSON reports with review command #206

Open
gsantos-hc opened this issue Jan 17, 2025 · 0 comments
Open

Panic decoding JSON reports with review command #206

gsantos-hc opened this issue Jan 17, 2025 · 0 comments

Comments

@gsantos-hc
Copy link

I'm attempting to review a benchmark report that I earlier saved as a JSON file, but vault-benchmark panics when deserializing the file:

$ vault-benchmark -version
vault-benchmark v0.3.0

$ vault-benchmark review -results_file benchmark-10nvs.json
error reading report: json: cannot unmarshal string into Go value of type vegeta.Metrics
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x8 pc=0x104e83754]

goroutine 1 [running]:
github.com/hashicorp/vault-benchmark/benchmarktests.(*Reporter).ReportTerse(0x0, {0x10534e580, 0x140001a2008})
        github.com/hashicorp/vault-benchmark/benchmarktests/reports.go:117 +0x64
github.com/hashicorp/vault-benchmark/command.(*ReviewCommand).Run(0x14000300540, {0x140001a6060, 0x2, 0x2})
        github.com/hashicorp/vault-benchmark/command/review.go:109 +0x270
github.com/mitchellh/cli.(*CLI).Run(0x140000e0140)
        github.com/mitchellh/[email protected]/cli.go:262 +0x4a8
github.com/hashicorp/vault-benchmark/command.RunCustom({0x140001a6050?, 0x10468dd1c?, 0x1058e86f8?}, 0x0?)
        github.com/hashicorp/vault-benchmark/command/main.go:138 +0x730
github.com/hashicorp/vault-benchmark/command.Run(...)
        github.com/hashicorp/vault-benchmark/command/main.go:41
main.main()
        github.com/hashicorp/vault-benchmark/main.go:20 +0x54

The JSON report was created through something like this:

vault-benchmark run -config benchmark.hcl -report_mode json > benchmark.json
gsantos-hc added a commit to gsantos-hc/vault-benchmark that referenced this issue Jan 17, 2025
Update the `FromReader()` function to focus on a JSON document's
`metrics` key and deserialize each test's results into a vegeta.Metrics
object.

Fixes hashicorp#206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant