spanhelper

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: Apache-2.0 Imports: 10 Imported by: 19

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogFromSpan

func LogFromSpan(span opentracing.Span) logrus.FieldLogger

LogFromSpan - return a logger that has a TraceHook to also log messages to the span

func NewTraceHook

func NewTraceHook(span opentracing.Span) logrus.Hook

NewTraceHook - create a TraceHook for also logging to a span

Types

type SpanHelper

type SpanHelper interface {
	Finish()
	Context() context.Context
	Logger() logrus.FieldLogger
	LogObject(attribute string, value interface{})
	LogValue(attribute string, value interface{})
	LogError(err error)
	Span() opentracing.Span
}

SpanHelper - wrap span if specified to simplify workflow

func CopySpan

func CopySpan(ctx context.Context, spanContext SpanHelper, operation string) SpanHelper

CopySpan - construct span helper object with ctx and copy span from spanContext Will start new operation on span

func FromContext

func FromContext(ctx context.Context, operation string) (result SpanHelper)

FromContext - return span helper from context and if opentracing is enabled start new span

func GetSpanHelper

func GetSpanHelper(ctx context.Context) SpanHelper

GetSpanHelper - construct a span helper object from current context span

func NewSpanHelper

func NewSpanHelper(ctx context.Context, span opentracing.Span, operation string) SpanHelper

NewSpanHelper - constructs a span helper from context/snap and opertaion name.

func WithSpan

func WithSpan(ctx context.Context, span opentracing.Span, operation string) (result SpanHelper)

WithSpan - construct span helper object with ctx and copy spanid from span Will start new operation on span

Jump to

Keyboard shortcuts

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