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

Add bucket histogram option #68

Merged
merged 5 commits into from
Oct 17, 2020

Conversation

rzkmak
Copy link
Contributor

@rzkmak rzkmak commented Oct 14, 2020

I'm trying to add an option for bucket histogram as in the #63 issue

ali --buckets "1ms, 10ms, 100ms, 500ms" http://host.xz

But I'm not sure where I can put this part

0~1ms: 1 25%
1ms~10ms: 1 25%
10ms~100ms: 1 25%
100ms~500ms: 1 25%

Any feedback or suggestion would help me so much.
Thank you

@codecov-io
Copy link

codecov-io commented Oct 14, 2020

Codecov Report

Merging #68 into master will decrease coverage by 1.92%.
The diff coverage is 33.34%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #68      +/-   ##
==========================================
- Coverage   76.50%   74.59%   -1.91%     
==========================================
  Files           8        8              
  Lines         400      417      +17     
==========================================
+ Hits          306      311       +5     
- Misses         75       85      +10     
- Partials       19       21       +2     
Impacted Files Coverage Δ
attacker/attacker.go 64.92% <33.34%> (-4.31%) ⬇️
main.go 76.23% <33.34%> (-4.67%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f4ad79d...970c7fd. Read the comment docs.

@nakabonne
Copy link
Owner

@rzkmak Hey, thank you for your contribution! I can’t afford to check it, so I'll get back to you later :-)

main.go Outdated
@@ -81,6 +83,7 @@ func parseFlags(stdout, stderr io.Writer) (*cli, error) {
flagSet.IntVarP(&c.connections, "connections", "c", attacker.DefaultConnections, "Amount of maximum open idle connections per target host")
flagSet.BoolVar(&c.noHTTP2, "no-http2", false, "Don't issue HTTP/2 requests to servers which support it.")
flagSet.StringVar(&c.localAddress, "local-addr", "0.0.0.0", "Local IP address.")
flagSet.StringVar(&c.buckets, "buckets", "", "Histogram buckets.")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
flagSet.StringVar(&c.buckets, "buckets", "", "Histogram buckets.")
flagSet.StringVar(&c.buckets, "buckets", "", "Histogram buckets; comma-separated list.")

main.go Outdated
trimmedBucket := strings.TrimSpace(bucket)
d, err := time.ParseDuration(trimmedBucket)
if err != nil {
log.Fatalf("Invalid bucket time format")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you make it give back an error if even one of them fails?

main.go Outdated
Comment on lines 214 to 216
result := make([]time.Duration, 0)

stringBuckets := strings.Split(rawBuckets, ",")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
result := make([]time.Duration, 0)
stringBuckets := strings.Split(rawBuckets, ",")
stringBuckets := strings.Split(rawBuckets, ",")
result := make([]time.Duration, len(stringBuckets))

@rzkmak
Copy link
Contributor Author

rzkmak commented Oct 17, 2020

thank you for the review 👍

Copy link
Owner

@nakabonne nakabonne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you! i will add an ability to draw the histogram buckets, so your contribution will be available after that ;)

@nakabonne nakabonne merged commit dc848df into nakabonne:master Oct 17, 2020
@nakabonne nakabonne mentioned this pull request Oct 18, 2020
2 tasks
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.

3 participants