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

Find a way to fetch the number of attempt #352

Closed
christophe-dufour opened this issue Jul 9, 2020 · 3 comments · Fixed by #374
Closed

Find a way to fetch the number of attempt #352

christophe-dufour opened this issue Jul 9, 2020 · 3 comments · Fixed by #374
Assignees
Labels
enhancement v2 For resty v2

Comments

@christophe-dufour
Copy link

Retry comes with a nice retry system.
For monitoring reason, I would like to be able when I get a response, how many attempts Resty has to do to complete the request.

Something like that:

client := resty.New()SetRetryCount(3).OnAfterResponse(func(c *resty.Client, resp *resty.Response) error {
			metrics.ReportHTTPCall(resp.StatusCode(),resp.Request.Method, somewhere.NumberOfAttempt())
			return nil
		})

Is there a way to get that value?

@moorereason
Copy link
Contributor

I'm not aware of the number of attempts being exposed by resty, but you can track the attempts yourself as in here (using AddRetryCondition).

@jeevatkm
Copy link
Member

jeevatkm commented Sep 4, 2020

@christophe-dufour Did you get a chance to try out the @moorereason's input?

@jeevatkm jeevatkm self-assigned this Sep 9, 2020
@jeevatkm jeevatkm added this to the v2.4.0 Milestone milestone Sep 9, 2020
@jeevatkm jeevatkm added the v2 For resty v2 label Sep 9, 2020
@jeevatkm
Copy link
Member

jeevatkm commented Sep 9, 2020

@moorereason FYI, resty already have a value also I think it might good to expose in trace info too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement v2 For resty v2
Development

Successfully merging a pull request may close this issue.

3 participants