oc

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: 10 Imported by: 0

README

This is wrapper around logrus & opencensus

Documentation

Index

Constants

View Source
const (
	EntryKey = "OBSERVE_ENTRY_KEY"
	ErrorKey = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Observe

type Observe struct {
	Red
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context, name string, opts ...Option) (context.Context, *Observe)

func (*Observe) AddField

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

func (*Observe) End

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

func (*Observe) Log

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

func (*Observe) WithField

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

type Option

type Option func(cfg *Observe)

func AddREDMetrics

func AddREDMetrics(r *Red) Option

func AddTraceStartOptions

func AddTraceStartOptions(opts ...trace.StartOption) Option

func PropagateLogEntry

func PropagateLogEntry() Option

type Red

type Red struct {
	*sync.Once // Do I need to keep pointer to once, or is it good without it?
	// contains filtered or unexported fields
}

func NewRED

func NewRED(minDuration time.Duration, maxDuration time.Duration, buckets int, spacing Spacing, nameOverride ...string) *Red

func NewSimpleRED

func NewSimpleRED() *Red

type Spacing

type Spacing int
const (
	Linear    Spacing = iota
	LogLinear Spacing = iota
)

Jump to

Keyboard shortcuts

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