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 offset to the histogram of the response time #495

Merged
merged 4 commits into from Nov 17, 2021

Conversation

debbyku
Copy link
Contributor

@debbyku debbyku commented Nov 7, 2021

It is to add offsset to the histogram of the response time.

Currently we run the fortio on a service with predefined latency, say, 200ms, 500ms, 1s to simulate production behavior. Fortio does not give accurate response time as the histogram of the response time is always starting from 0.

In this PR, a new flag is added. it is
-o : offset to histogram of the response time
e.g. if the latency of the service is 200ms, i.e. sleep 200ms in the service. the command for the fortio is : '

fortio load -o 0.2s ......

@codeclimate
Copy link

codeclimate bot commented Nov 7, 2021

Code Climate has analyzed commit 9c9b356 and detected 0 issues on this pull request.

View more on Code Climate.

@codecov
Copy link

codecov bot commented Nov 9, 2021

Codecov Report

Merging #495 (9c9b356) into master (388deb8) will increase coverage by 0.1%.
The diff coverage is 100.0%.

Impacted file tree graph

@@           Coverage Diff            @@
##           master    #495     +/-   ##
========================================
+ Coverage    87.0%   87.1%   +0.1%     
========================================
  Files          26      26             
  Lines        3381    3381             
========================================
+ Hits         2941    2945      +4     
+ Misses        292     288      -4     
  Partials      148     148             
Impacted Files Coverage Δ
periodic/periodic.go 96.5% <100.0%> (ø)
fhttp/http_client.go 79.8% <0.0%> (+0.8%) ⬆️

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 388deb8...9c9b356. Read the comment docs.

fortio_main.go Outdated
@@ -104,6 +104,7 @@ var (
durationFlag = flag.Duration("t", defaults.Duration, "How long to run the test or 0 to run until ^C")
percentilesFlag = flag.String("p", "50,75,90,99,99.9", "List of pXX to calculate")
resolutionFlag = flag.Float64("r", defaults.Resolution, "Resolution of the histogram lowest buckets in seconds")
offsetFlag = flag.Float64("o", defaults.Offset, "Offset of the histogram data in seconds")
Copy link
Member

Choose a reason for hiding this comment

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

should probably be a duration (like -t)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Code updated and pushed again

Copy link
Member

@ldemailly ldemailly left a comment

Choose a reason for hiding this comment

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

see above

@@ -406,7 +408,8 @@ func (r *periodicRunner) Run() RunnerResults {
}
start := time.Now()
// Histogram and stats for Function duration - millisecond precision
functionDuration := stats.NewHistogram(0, r.Resolution)
offsetSec := float64(r.Offset) / float64(time.Second)
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thanks. It is much easier to get the seconds. Code updated.

Copy link
Member

@ldemailly ldemailly left a comment

Choose a reason for hiding this comment

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

thanks!

@ldemailly ldemailly merged commit 8f354c2 into fortio:master Nov 17, 2021
@ldemailly
Copy link
Member

I should have thought about this sooner, but I am going to change the flag to keep the short -o for future

@ldemailly
Copy link
Member

#496 - so please use 1.18.2 and -offset - thanks!

@debbyku
Copy link
Contributor Author

debbyku commented Nov 24, 2021 via email

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.

None yet

2 participants