httptracing

package module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2017 License: MIT Imports: 6 Imported by: 0

README

Build Status GoDoc Coverage Status Go Report Card

Description

The httptracing package forms a bridge between httpclient and the opentracing-contrib nethttp package. It provides a HTTP client with opentracing support, implementing the httpclient.Client interface.

Usage

tracer := opentracing.GlobalTracer()
client := httptracing.Trace(tracer, http.DefaultClient)

resp, err := client.Get("http://test.com")
//...

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TracingClient

type TracingClient struct {
	*http.Client
	// contains filtered or unexported fields
}

TracingClient wraps a http.Client with an OpenTracing tracer

func Trace

func Trace(tracer opentracing.Tracer, client *http.Client) *TracingClient

Trace wraps the client with a tracer so each request has its own span.

func (*TracingClient) Do

func (client *TracingClient) Do(req *http.Request) (resp *http.Response, err error)

Do is the same as http.Client.Do but the request is traced

func (*TracingClient) Get

func (client *TracingClient) Get(url string) (resp *http.Response, err error)

Get is the same as http.Client.Get but the request is traced

func (*TracingClient) Head

func (client *TracingClient) Head(url string) (resp *http.Response, err error)

Head is the same as http.Client.Head but the request is traced

func (*TracingClient) Post

func (client *TracingClient) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)

Post is the same as http.Client.Post but the request is traced

func (*TracingClient) PostForm

func (client *TracingClient) PostForm(url string, data url.Values) (resp *http.Response, err error)

PostForm is the same as http.Client.PostForm but the request is traced

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL