tracing

package
v0.53.1 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeaderNFDebugLogging = "X-NF-Debug-Logging"
	HeaderRequestUUID    = "X-BB-CLIENT-REQUEST-UUID"
)

Variables

This section is empty.

Functions

func Configure

func Configure(tc *Config, log logrus.FieldLogger, svcName string)

func GetLogger

func GetLogger(r *http.Request) logrus.FieldLogger

func GetLoggerFromContext

func GetLoggerFromContext(ctx context.Context) logrus.FieldLogger

func GetRequestID added in v0.38.0

func GetRequestID(r *http.Request) string

func GetRequestIDFromContext added in v0.38.0

func GetRequestIDFromContext(ctx context.Context) string

func LogErrorToSpan added in v0.40.1

func LogErrorToSpan(span opentracing.Span, err error)

func SetFinalField

func SetFinalField(r *http.Request, key string, value interface{}) logrus.FieldLogger

SetFinalField will add a field to the canonical line created at in Finish. It will add it to this line, but not every log line in between

func SetFinalFieldWithContext added in v0.37.0

func SetFinalFieldWithContext(ctx context.Context, key string, value interface{}) logrus.FieldLogger

SetFinalFieldWithContext will add a field to the canonical line created at in Finish. It will add it to this line, but not every log line in between

func SetLogField

func SetLogField(r *http.Request, key string, value interface{}) logrus.FieldLogger

SetLogField will add the field to this log line and every one following

func SetLogFields

func SetLogFields(r *http.Request, fields logrus.Fields) logrus.FieldLogger

SetLogFields will add the fields to this log line and every one following

func TrackRequest

func TrackRequest(w http.ResponseWriter, r *http.Request, log logrus.FieldLogger, service, resource string, next http.Handler)

func WrapWithSpan

func WrapWithSpan(r *http.Request, reqID, service, resource string) (*http.Request, opentracing.Span)

func WrapWithTracer

func WrapWithTracer(r *http.Request, rt *RequestTracer) *http.Request

Types

type Config

type Config struct {
	Enabled     bool   `default:"false"`
	Host        string `default:"localhost"`
	Port        string `default:"8126"`
	Tags        map[string]string
	EnableDebug bool `default:"false" split_words:"true" mapstructure:"enable_debug" json:"enable_debug" yaml:"enable_debug"`
}

type RequestTracer

type RequestTracer struct {
	logrus.FieldLogger

	RequestID string
	// contains filtered or unexported fields
}

func GetFromContext

func GetFromContext(ctx context.Context) *RequestTracer

func GetTracer

func GetTracer(r *http.Request) *RequestTracer

func NewTracer

func NewTracer(w http.ResponseWriter, r *http.Request, log logrus.FieldLogger, service, resource string) (http.ResponseWriter, *http.Request, *RequestTracer)

func (*RequestTracer) Finish

func (rt *RequestTracer) Finish()

func (RequestTracer) Header

func (w RequestTracer) Header() http.Header

func (RequestTracer) Hijack

func (w RequestTracer) Hijack() (net.Conn, *bufio.ReadWriter, error)

func (RequestTracer) OriginalWriter

func (w RequestTracer) OriginalWriter() http.ResponseWriter

func (*RequestTracer) SetFinalField added in v0.37.0

func (rt *RequestTracer) SetFinalField(key string, value interface{}) logrus.FieldLogger

func (*RequestTracer) SetLogField

func (rt *RequestTracer) SetLogField(key string, value interface{}) logrus.FieldLogger

func (*RequestTracer) SetLogFields

func (rt *RequestTracer) SetLogFields(fields logrus.Fields) logrus.FieldLogger

func (*RequestTracer) Start

func (rt *RequestTracer) Start()

func (RequestTracer) Write

func (w RequestTracer) Write(in []byte) (int, error)

func (RequestTracer) WriteHeader

func (w RequestTracer) WriteHeader(code int)

Jump to

Keyboard shortcuts

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