core_tracing

package
v0.0.0-...-99e5d07 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: MIT Imports: 19 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	TracerEngine *TracingEngine
	Client       *http.Client
}

HTTPClient wraps an http.Client with tracing instrumentation.

func NewHTTPClient

func NewHTTPClient(tracer *TracingEngine) *HTTPClient

func (*HTTPClient) GetJSON

func (c *HTTPClient) GetJSON(ctx context.Context, endpoint string, url string, out interface{}) error

GetJSON executes HTTP GET against specified url and tried to parse the response into out object.

type Mutex

type Mutex struct {
	SessionBaggageKey string
	// contains filtered or unexported fields
}

Mutex is just like the standard sync.Mutex, except that it is aware of the Context and logs some diagnostic information into the current span.

func (*Mutex) Lock

func (sm *Mutex) Lock(ctx context.Context)

Lock acquires an exclusive lock.

func (*Mutex) Unlock

func (sm *Mutex) Unlock()

Unlock releases the lock.

type TracedServeMux

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

TracedServeMux is a wrapper around http.ServeMux that instruments handlers for tracing.

func NewServeMux

func NewServeMux(tracer opentracing.Tracer) *TracedServeMux

NewServeMux creates a new TracedServeMux.

func (*TracedServeMux) Handle

func (tm *TracedServeMux) Handle(pattern string, handler http.Handler)

Handle implements http.ServeMux#Handle

func (*TracedServeMux) ServeHTTP

func (tm *TracedServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.ServeMux#ServeHTTP

type TracingEngine

type TracingEngine struct {
	Tracer opentracing.Tracer
}

func NewTracer

func NewTracer(service string, collectorEndpoint string, metricsFactory metrics.Factory) (*TracingEngine, io.Closer)

Init returns an instance of Jaeger Tracer that samples 100% of traces and logs all spans to stdout.

func (*TracingEngine) CreateChildSpan

func (engine *TracingEngine) CreateChildSpan(ctx context.Context, name string) opentracing.Span

CreateChildSpan creates a new opentracing span adding tags for the span name and caller details. Returns a Span. User must call `defer sp.Finish()`

func (*TracingEngine) Extract

func (engine *TracingEngine) Extract(tracer opentracing.Tracer, r *http.Request) (opentracing.SpanContext, error)

func (*TracingEngine) Inject

func (engine *TracingEngine) Inject(span opentracing.Span, request *http.Request) error

func (*TracingEngine) NewTracedRequest

func (engine *TracingEngine) NewTracedRequest(method string, url string, span opentracing.Span) (*http.Request, error)

NewTracedRequest generates a new traced HTTP request with opentracing headers injected into it

func (*TracingEngine) OpenTracingMiddleware

func (engine *TracingEngine) OpenTracingMiddleware(next http.Handler) http.Handler

func (*TracingEngine) TraceFunction

func (engine *TracingEngine) TraceFunction(ctx context.Context, fn interface{}, params ...interface{}) (result []reflect.Value)

TraceFunction wraps funtion with opentracing span adding tags for the function name and caller details

Jump to

Keyboard shortcuts

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