opentracefasthttp

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: Apache-2.0 Imports: 1 Imported by: 1

README

Build Status

opentracefasthttp

Opentracing carrier for fasthttp server. Gives possibility to use span extract/inject options

examples

client send with request's header

	req := fasthttp.AcquireRequest()
	...
	
	carrier := opentracefasthttp.New(&req.Header)
	err = opentracing.GlobalTracer().Inject(span.Context(), opentracing.HTTPHeaders, carrier)

server read from request's header

	func(ctx *fasthttp.RequestCtx) {
		carrier := opentracefasthttp.New(&ctx.Request.Header)
		clientContext, err := tr.Extract(opentracing.HTTPHeaders, carrier)
		if err != nil{
			...
		}
		span := trace.StartSpan("HTTP "+string(ctx.Method())+" "+ctx.Request.URI().String(), ext.RPCServerOption(clientContext))
	}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Carrier

type Carrier struct {
	// contains filtered or unexported fields
}

Carrier satisfies both TextMapWriter and TextMapReader.

Example usage for server side:

carrier := opentracefasthttp.New(&ctx.Request.Header)
clientContext, err := tracer.Extract(opentracing.HTTPHeaders, carrier)

Example usage for client side:

carrier := opentracefasthttp.New(&req.Header)
err := tracer.Inject(
    span.Context(),
    opentracing.HTTPHeaders,
    carrier)

func New

func (Carrier) ForeachKey

func (c Carrier) ForeachKey(handler func(key, val string) error) (err error)

ForeachKey conforms to the TextMapReader interface.

func (Carrier) Set

func (c Carrier) Set(key, val string)

Set conforms to the TextMapWriter interface.

Jump to

Keyboard shortcuts

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