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

fix(reports): deserialize json documents #207

Closed
wants to merge 1 commit into from

Conversation

gsantos-hc
Copy link

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 #206


A local build was able to deserialize a JSON benchmark document and print out the results in the regular format:

$ cat benchmark-10nvs.json
{"metrics":{"aes256-gcm":{"latencies":{"total":8868243064539,"mean":9951291,"50th":8643168,"90th":16520069,"95th":20732241,"99th":30478892,"max":168027415,"min":1270184},"bytes_in":{"total":477664440,"mean":536},"bytes_out":{"total":180015330,"mean":202},"earliest":"2025-01-17T00:01:09.716773327Z","latest":"2025-01-17T00:06:09.720432428Z","end":"2025-01-17T00:06:09.730847514Z","duration":300003659101,"wait":10415086,"requests":891165,"rate":2970.5137686336625,"throughput":2970.410646283658,"success":1,"status_codes":{"200":891165},"errors":[]},"total":{"latencies":{"total":8868243064539,"mean":9951291,"50th":8643168,"90th":16520069,"95th":20732241,"99th":30478892,"max":168027415,"min":1270184},"bytes_in":{"total":477664440,"mean":536},"bytes_out":{"total":180015330,"mean":202},"earliest":"2025-01-17T00:01:09.716773327Z","latest":"2025-01-17T00:06:09.720432428Z","end":"2025-01-17T00:06:09.730847514Z","duration":300003659101,"wait":10415086,"requests":891165,"rate":2970.5137686336625,"throughput":2970.410646283658,"success":1,"status_codes":{"200":891165},"errors":[]}},"target_addr":"[redacted]"}

$ ~/code/vault-benchmark/dist/darwin/arm64/vault-benchmark review -results_file benchmark-10nvs.json
Target: N/A
op          count   rate         throughput   mean        95th%        99th%        successRatio
aes256-gcm  891165  2970.513769  2970.410646  9.951291ms  20.732241ms  30.478892ms  100.00%

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
@gsantos-hc gsantos-hc requested a review from a team as a code owner January 17, 2025 16:43
@gsantos-hc gsantos-hc requested review from ltcarbonell and elliesterner and removed request for a team January 17, 2025 16:43
@gsantos-hc
Copy link
Author

I'd like to add a regression test for this, but not sure if there's an easy way to do it. Any ideas?

@gsantos-hc
Copy link
Author

Just spotted #205, which seems like a more comprehensive fix for the same bug.

@elliesterner
Copy link
Contributor

Just spotted #205, which seems like a more comprehensive fix for the same bug.

Thanks @gsantos-hc ! I'm reviewing the other PR. If youre good with it, let's close this PR in favor of #205.

@gsantos-hc gsantos-hc closed this Jan 21, 2025
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 this pull request may close these issues.

Panic decoding JSON reports with review command
2 participants