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

x/crypto/acme: send req with external context to RetryBackoff function #30183

Open
rekby opened this issue Feb 12, 2019 · 1 comment
Open

x/crypto/acme: send req with external context to RetryBackoff function #30183

rekby opened this issue Feb 12, 2019 · 1 comment

Comments

@rekby
Copy link

@rekby rekby commented Feb 12, 2019

What did you do?

client = &acme.Client{
			Key:          config.PrivateKey,
			DirectoryURL: *ServerApiURL,
			RetryBackoff: func(n int, r *http.Request, res *http.Response) time.Duration {
				ctx := r.Context()
				retryLogger := zc.L(ctx) // get logger from context https://github.com/rekby/zapcontext
				if retryLogger == nil {
					retryLogger = logger.With(zap.String("request_context", "no-logger"))
				}
                                retryLogger.Info("Test")
                       }
}
                 

Send request to Lets encrypt with retrieval error.
_, err = client.Accept(ctx, httpchallenge)

What did you expect to see?

logs with my logger from ctx, and without request_context" = "no-logger"

What did you see instead?

logs with "request_context" = "no-logger" and without my logger from context ctx.

I suggest to send req with external context to function. Now it receive clear context (but http call do with external context).
My patch for self: rekby/crypto@9874cac

@gopherbot gopherbot added this to the Unreleased milestone Feb 12, 2019
@FiloSottile FiloSottile changed the title x/crypto: send req with external context to RetryBackoff function x/crypto/acme: send req with external context to RetryBackoff function Feb 13, 2019
@bcmills

This comment has been minimized.

Copy link
Member

@bcmills bcmills commented Mar 1, 2019

CC @FiloSottile @agl for x/crypto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.