OpenTracing

package module
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2021 License: MIT Imports: 14 Imported by: 0

README

OpenTracing

GoDoc Tests codecov

OpenTracing helpers.

Installation

go get github.com/pkgz/OpenTracing

Usage

TODO

Licence

MIT License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error added in v0.0.5

func Error(span opentracing.Span)

Error - finish a span and set error status

func InjectToReq

func InjectToReq(ctx context.Context, req *http.Request) error

InjectToReq - inject opentracing span to *http.Requst

func Middleware added in v0.0.4

func Middleware(next http.Handler) http.Handler

Middleware - create a new openTracing span and put it into request context

func NewTracer

func NewTracer(ctx context.Context, name string, host string) (opentracing.Tracer, error)

NewTracer - initializing opentracing tracer and set up global tracer.

func Request

func Request(ctx context.Context, params RequestOpts) ([]byte, int, error)

Request - for http requests. Expect method, url and body. Will inject bearer token and tracing id to request.

func SetAuthorization added in v0.0.4

func SetAuthorization(ctx context.Context, req *http.Request) error

SetAuthorization - take token from context value and set as Bearer token in Authorization header.

Types

type RequestOpts added in v0.0.8

type RequestOpts struct {
	Client       http.Client
	Method       string
	URL          string
	Data         []byte
	InjectBearer bool
}

Jump to

Keyboard shortcuts

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