Skip to content

spyzhov/chttp-middleware-opentracing

Repository files navigation

OpenTracing middleware for the cHTTP client

Adds an OpenTracing logs and headers to the request.

Usage example

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)
}

License

MIT licensed. See the LICENSE file for details.

About

Opentracing middleware for the cHTTP client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages