Adds an OpenTracing logs and headers to the request.
package clients
import (
"context"
"github.com/spyzhov/chttp"
middleware "github.com/spyzhov/chttp-middleware-opentracing"
)
type Client struct {
Client *chttp.JSONClient
}
func New() *Client {
client := chttp.NewJSON(nil)
client.With(middleware.Opentracing())
return &Client{
Client: client,
}
}
func (c *Client) GetCount(ctx context.Context) (result int, err error) {
return result, c.Client.GET(ctx, "https://example.com/get/count", nil, &result)
}
MIT licensed. See the LICENSE file for details.