observe

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2019 License: MIT Imports: 9 Imported by: 0

README

This is wrapper around:

  • opentracing for traces
  • prometheus for metrics
  • logrus for logs

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Observe

type Observe struct {
	Span opentracing.Span // Thin wrapper, thus this is public field in case someone needs underlying

	StaticObserveFactory
	// contains filtered or unexported fields
}

func (*Observe) AddField

func (obs *Observe) AddField(key string, value interface{})

AddField adds persistant field to this Span. It's attribute in traces and field in logrus

func (*Observe) Debug

func (obs *Observe) Debug(args ...interface{})

func (*Observe) Debugf

func (obs *Observe) Debugf(format string, args ...interface{})

func (*Observe) Debugln

func (obs *Observe) Debugln(args ...interface{})

func (*Observe) End

func (obs *Observe) End(retErr *error)

End marks Span as ended. Metrics are calculated on in and if the error occurs it's included in the metrics and trace.

func (*Observe) Error

func (obs *Observe) Error(args ...interface{})

func (*Observe) Errorf

func (obs *Observe) Errorf(format string, args ...interface{})

func (*Observe) Errorln

func (obs *Observe) Errorln(args ...interface{})

func (*Observe) Fatal

func (obs *Observe) Fatal(args ...interface{})

func (*Observe) Fatalf

func (obs *Observe) Fatalf(format string, args ...interface{})

func (*Observe) Fatalln

func (obs *Observe) Fatalln(args ...interface{})

func (*Observe) Info

func (obs *Observe) Info(args ...interface{})

func (*Observe) Infof

func (obs *Observe) Infof(format string, args ...interface{})

func (*Observe) Infoln

func (obs *Observe) Infoln(args ...interface{})

func (*Observe) Log

func (obs *Observe) Log(level logrus.Level, args ...interface{})

func (*Observe) Logf

func (obs *Observe) Logf(level logrus.Level, format string, args ...interface{})

func (*Observe) Logln

func (obs *Observe) Logln(level logrus.Level, args ...interface{})

func (*Observe) Panic

func (obs *Observe) Panic(args ...interface{})

func (*Observe) Panicf

func (obs *Observe) Panicf(format string, args ...interface{})

func (*Observe) Panicln

func (obs *Observe) Panicln(args ...interface{})

func (*Observe) Print

func (obs *Observe) Print(args ...interface{})

func (*Observe) Printf

func (obs *Observe) Printf(format string, args ...interface{})

func (*Observe) Println

func (obs *Observe) Println(args ...interface{})

func (*Observe) Trace

func (obs *Observe) Trace(args ...interface{})

func (*Observe) Tracef

func (obs *Observe) Tracef(format string, args ...interface{})

func (*Observe) Traceln

func (obs *Observe) Traceln(args ...interface{})

func (*Observe) Warn

func (obs *Observe) Warn(args ...interface{})

func (*Observe) Warnf

func (obs *Observe) Warnf(format string, args ...interface{})

func (*Observe) Warning

func (obs *Observe) Warning(args ...interface{})

func (*Observe) Warningf

func (obs *Observe) Warningf(format string, args ...interface{})

func (*Observe) Warningln

func (obs *Observe) Warningln(args ...interface{})

func (*Observe) Warnln

func (obs *Observe) Warnln(args ...interface{})

func (*Observe) WithError added in v0.1.1

func (obs *Observe) WithError(err error) *Observe

WithError created new shallow copy observer with logrus error set

type Option

type Option func(cfg *Observe)

func WithTraceOptions

func WithTraceOptions(opts ...opentracing.StartSpanOption) Option

WithTraceOptions

type StaticObserveFactory

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

func New

func New(name string) StaticObserveFactory

func (StaticObserveFactory) FromContext

func (f StaticObserveFactory) FromContext(ctx context.Context, opts ...Option) (context.Context, *Observe)

FromContext created Observe --> the thin wrapper this library is all about

The returned observe shouldn't really pass the function boundary, and it is definitely **not** thread safe. It's by design. It's intended usage is in the first two lines of the function (which can be called from multiple goroutines, that's fine)

Jump to

Keyboard shortcuts

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