Documentation
¶
Overview ¶
package xopresty adds to the resty package to propagate xop context to through an HTTP request.
As of March 29th, 2023, the released resty package does not provide a way to have a logger that knows which request it is logging about. The resty package does not provide a way to know when requests are complete.
Pull requests to fix these issues have been merged but not made part of a release.
In the meantime, this package depends upon https://github.com/muir/resty.
The agumented resty Client requires that a context that has the parent log span be provided:
client.R().SetContext(log.IntoContext(context.Background()))
If there is no logger in the context, the request will fail.
If you use resty's Client.SetDebug(true), note that the output will be logged at Debug level which is below the default minimum level for xop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ClientOpt ¶
type ClientOpt func(*config)
func WithExtraLogging ¶
func WithExtraLogging(f ExtraLogging) ClientOpt
type ExtraLogging ¶
type ExtraLogging func(log *xop.Logger, originalStartTime time.Time, retryCount int, request *resty.Request, response *resty.Response, err error)
ExtraLogging provides a hook for extra logging to be done. It is possible that the response parameter will be null. If error is not null, then the request has failed. ExtraLogging should only be called once but if another resty callback panic's, it is possible ExtraLogging will be called twice.