observer

package
v0.0.0-...-30f5ca6 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Foreach

func Foreach(f func(Observer))

func NextEventID

func NextEventID() core.EventID

func Record

func Record(event Event) core.EventID

func RegisterObserver

func RegisterObserver(e Observer)

RegisterObserver adds to the list of Observers that will receive sampled trace spans.

Binaries can register observers, libraries shouldn't register observers.

func UnregisterObserver

func UnregisterObserver(e Observer)

UnregisterObserver removes from the list of Observers the Observer that was registered with the given name.

Types

type Event

type Event struct {
	// Automatic fields
	Sequence core.EventID // Auto-filled
	Time     time.Time    // Auto-filled

	// Type, Scope, Context
	Type    EventType       // All events
	Scope   core.ScopeID    // All events
	Context context.Context // core.FromContext() and scope.Active()

	// Arguments (type-specific)
	Attribute  core.KeyValue   // SET_ATTRIBUTE
	Attributes []core.KeyValue // SET_ATTRIBUTES, LOG_EVENT
	Mutator    core.Mutator    // SET_ATTRIBUTE
	Mutators   []core.Mutator  // SET_ATTRIBUTES
	Arguments  []interface{}   // LOGF_EVENT
	Recovered  interface{}     // FINISH_SPAN

	// Values
	String  string // START_SPAN, EVENT, ...
	Float64 float64
	Parent  core.ScopeID // START_SPAN
	Stats   []core.Measurement
	Stat    core.Measurement
}

type EventType

type EventType int
const (
	// TODO: rename these NOUN_VERB
	INVALID EventType = iota
	START_SPAN
	FINISH_SPAN
	LOG_EVENT
	LOGF_EVENT
	NEW_SCOPE
	NEW_MEASURE
	NEW_METRIC
	MODIFY_ATTR
	RECORD_STATS
)

func (EventType) String

func (i EventType) String() string

type Observer

type Observer interface {
	Observe(data Event)
}

Jump to

Keyboard shortcuts

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