tools: golang.org/x/tools/internal/telemetry/event Index | Files

package event

import "golang.org/x/tools/internal/telemetry/event"

Package event provides support for event based telemetry.

Index

Package Files

event.go export.go key.go label.go log.go metric.go tag.go trace.go

Constants

const (
    LogType       // an event that should be recorded in a log
    StartSpanType // the start of a span of time
    EndSpanType   // the end of a span of time
    LabelType     // some values that should be noted for later events
    DetachType    // an event that causes a context to detach
    RecordType    // a value that should be tracked
)

Variables

var (
    // Msg is a key used to add message strings to tag lists.
    Msg = NewStringKey("message", "a readable message")
    // Name is used for things like traces that have a name.
    Name = NewStringKey("name", "an entity name")
    // Err is a key used to add error values to tag lists.
    Err = NewErrorKey("error", "an error that occurred")
)

func Detach Uses

func Detach(ctx context.Context) context.Context

Detach returns a context without an associated span. This allows the creation of spans that are not children of the current span.

func Error Uses

func Error(ctx context.Context, message string, err error, tags ...Tag)

Error takes a message and a tag list and combines them into a single event before delivering them to the exporter. It captures the error in the delivered event.

func Label Uses

func Label(ctx context.Context, tags ...Tag) context.Context

Label sends a label event to the exporter with the supplied tags.

func Label1 Uses

func Label1(ctx context.Context, t1 Tag) context.Context

Label1 sends a label event to the exporter with the supplied tags.

func Label2 Uses

func Label2(ctx context.Context, t1, t2 Tag) context.Context

Label2 sends a label event to the exporter with the supplied tags.

func Label3 Uses

func Label3(ctx context.Context, t1, t2, t3 Tag) context.Context

Label3 sends a label event to the exporter with the supplied tags.

func Log Uses

func Log(ctx context.Context, tags ...Tag)

Log sends a log event with the supplied tag list to the exporter.

func Log1 Uses

func Log1(ctx context.Context, t1 Tag) context.Context

Log1 sends a label event to the exporter with the supplied tags.

func Log2 Uses

func Log2(ctx context.Context, t1, t2 Tag) context.Context

Log2 sends a label event to the exporter with the supplied tags.

func Log3 Uses

func Log3(ctx context.Context, t1, t2, t3 Tag) context.Context

Log3 sends a label event to the exporter with the supplied tags.

func Print Uses

func Print(ctx context.Context, message string, tags ...Tag)

Print takes a message and a tag list and combines them into a single event before delivering them to the exporter.

func Print1 Uses

func Print1(ctx context.Context, message string, t1 Tag)

Print1 takes a message and one tag delivers a log event to the exporter. It is a customized version of Print that is faster and does no allocation.

func Print2 Uses

func Print2(ctx context.Context, message string, t1 Tag, t2 Tag)

Print2 takes a message and two tags and delivers a log event to the exporter. It is a customized version of Print that is faster and does no allocation.

func Record Uses

func Record(ctx context.Context, tags ...Tag) context.Context

Record sends a label event to the exporter with the supplied tags.

func Record1 Uses

func Record1(ctx context.Context, t1 Tag) context.Context

Record1 sends a label event to the exporter with the supplied tags.

func Record2 Uses

func Record2(ctx context.Context, t1, t2 Tag) context.Context

Record2 sends a label event to the exporter with the supplied tags.

func Record3 Uses

func Record3(ctx context.Context, t1, t2, t3 Tag) context.Context

Record3 sends a label event to the exporter with the supplied tags.

func SetExporter Uses

func SetExporter(e Exporter)

SetExporter sets the global exporter function that handles all events. The exporter is called synchronously from the event call site, so it should return quickly so as not to hold up user code.

func StartSpan Uses

func StartSpan(ctx context.Context, name string, tags ...Tag) (context.Context, func())

StartSpan sends a span start event with the supplied tag list to the exporter. It also returns a function that will end the span, which should normally be deferred.

func StartSpan1 Uses

func StartSpan1(ctx context.Context, name string, t1 Tag) (context.Context, func())

StartSpan1 sends a span start event with the supplied tag list to the exporter. It also returns a function that will end the span, which should normally be deferred.

func StartSpan2 Uses

func StartSpan2(ctx context.Context, name string, t1, t2 Tag) (context.Context, func())

StartSpan2 sends a span start event with the supplied tag list to the exporter. It also returns a function that will end the span, which should normally be deferred.

type BooleanKey Uses

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

BooleanKey represents a key

func NewBooleanKey Uses

func NewBooleanKey(name, description string) *BooleanKey

NewBooleanKey creates a new Key for bool values.

func (*BooleanKey) Description Uses

func (k *BooleanKey) Description() string

func (*BooleanKey) From Uses

func (k *BooleanKey) From(t Tag) bool

From can be used to get a value from a Tag.

func (*BooleanKey) Get Uses

func (k *BooleanKey) Get(tags TagMap) bool

Get can be used to get a tag for the key from a TagMap.

func (*BooleanKey) Name Uses

func (k *BooleanKey) Name() string

func (*BooleanKey) Of Uses

func (k *BooleanKey) Of(v bool) Tag

Of creates a new Tag with this key and the supplied value.

type ErrorKey Uses

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

ErrorKey represents a key

func NewErrorKey Uses

func NewErrorKey(name, description string) *ErrorKey

NewErrorKey creates a new Key for int64 values.

func (*ErrorKey) Description Uses

func (k *ErrorKey) Description() string

func (*ErrorKey) From Uses

func (k *ErrorKey) From(t Tag) error

From can be used to get a value from a Tag.

func (*ErrorKey) Get Uses

func (k *ErrorKey) Get(tags TagMap) error

Get can be used to get a tag for the key from a TagMap.

func (*ErrorKey) Name Uses

func (k *ErrorKey) Name() string

func (*ErrorKey) Of Uses

func (k *ErrorKey) Of(v error) Tag

Of creates a new Tag with this key and the supplied value.

type Event Uses

type Event struct {
    At time.Time
    // contains filtered or unexported fields
}

Event holds the information about an event of note that ocurred.

func (Event) Find Uses

func (ev Event) Find(key interface{}) Tag

func (Event) Format Uses

func (ev Event) Format(f fmt.State, r rune)

func (Event) IsDetach Uses

func (ev Event) IsDetach() bool

func (Event) IsEndSpan Uses

func (ev Event) IsEndSpan() bool

func (Event) IsLabel Uses

func (ev Event) IsLabel() bool

func (Event) IsLog Uses

func (ev Event) IsLog() bool

func (Event) IsRecord Uses

func (ev Event) IsRecord() bool

func (Event) IsStartSpan Uses

func (ev Event) IsStartSpan() bool

func (Event) Tags Uses

func (ev Event) Tags() TagIterator

type Exporter Uses

type Exporter func(context.Context, Event, TagMap) context.Context

Exporter is a function that handles events. It may return a modified context and event.

type Float32Key Uses

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

Float32Key represents a key

func NewFloat32Key Uses

func NewFloat32Key(name, description string) *Float32Key

NewFloat32Key creates a new Key for float32 values.

func (*Float32Key) Description Uses

func (k *Float32Key) Description() string

func (*Float32Key) From Uses

func (k *Float32Key) From(t Tag) float32

From can be used to get a value from a Tag.

func (*Float32Key) Get Uses

func (k *Float32Key) Get(tags TagMap) float32

Get can be used to get a tag for the key from a TagMap.

func (*Float32Key) Name Uses

func (k *Float32Key) Name() string

func (*Float32Key) Of Uses

func (k *Float32Key) Of(v float32) Tag

Of creates a new Tag with this key and the supplied value.

type Float64Key Uses

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

Float64Key represents a key

func NewFloat64Key Uses

func NewFloat64Key(name, description string) *Float64Key

NewFloat64Key creates a new Key for int64 values.

func (*Float64Key) Description Uses

func (k *Float64Key) Description() string

func (*Float64Key) From Uses

func (k *Float64Key) From(t Tag) float64

From can be used to get a value from a Tag.

func (*Float64Key) Get Uses

func (k *Float64Key) Get(tags TagMap) float64

Get can be used to get a tag for the key from a TagMap.

func (*Float64Key) Name Uses

func (k *Float64Key) Name() string

func (*Float64Key) Of Uses

func (k *Float64Key) Of(v float64) Tag

Of creates a new Tag with this key and the supplied value.

type Int16Key Uses

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

Int16Key represents a key

func NewInt16Key Uses

func NewInt16Key(name, description string) *Int16Key

NewInt16Key creates a new Key for int16 values.

func (*Int16Key) Description Uses

func (k *Int16Key) Description() string

func (*Int16Key) From Uses

func (k *Int16Key) From(t Tag) int16

From can be used to get a value from a Tag.

func (*Int16Key) Get Uses

func (k *Int16Key) Get(tags TagMap) int16

Get can be used to get a tag for the key from a TagMap.

func (*Int16Key) Name Uses

func (k *Int16Key) Name() string

func (*Int16Key) Of Uses

func (k *Int16Key) Of(v int16) Tag

Of creates a new Tag with this key and the supplied value.

type Int32Key Uses

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

Int32Key represents a key

func NewInt32Key Uses

func NewInt32Key(name, description string) *Int32Key

NewInt32Key creates a new Key for int32 values.

func (*Int32Key) Description Uses

func (k *Int32Key) Description() string

func (*Int32Key) From Uses

func (k *Int32Key) From(t Tag) int32

From can be used to get a value from a Tag.

func (*Int32Key) Get Uses

func (k *Int32Key) Get(tags TagMap) int32

Get can be used to get a tag for the key from a TagMap.

func (*Int32Key) Name Uses

func (k *Int32Key) Name() string

func (*Int32Key) Of Uses

func (k *Int32Key) Of(v int32) Tag

Of creates a new Tag with this key and the supplied value.

type Int64Key Uses

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

Int64Key represents a key

func NewInt64Key Uses

func NewInt64Key(name, description string) *Int64Key

NewInt64Key creates a new Key for int64 values.

func (*Int64Key) Description Uses

func (k *Int64Key) Description() string

func (*Int64Key) From Uses

func (k *Int64Key) From(t Tag) int64

From can be used to get a value from a Tag.

func (*Int64Key) Get Uses

func (k *Int64Key) Get(tags TagMap) int64

Get can be used to get a tag for the key from a TagMap.

func (*Int64Key) Name Uses

func (k *Int64Key) Name() string

func (*Int64Key) Of Uses

func (k *Int64Key) Of(v int64) Tag

Of creates a new Tag with this key and the supplied value.

type Int8Key Uses

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

Int8Key represents a key

func NewInt8Key Uses

func NewInt8Key(name, description string) *Int8Key

NewInt8Key creates a new Key for int8 values.

func (*Int8Key) Description Uses

func (k *Int8Key) Description() string

func (*Int8Key) From Uses

func (k *Int8Key) From(t Tag) int8

From can be used to get a value from a Tag.

func (*Int8Key) Get Uses

func (k *Int8Key) Get(tags TagMap) int8

Get can be used to get a tag for the key from a TagMap.

func (*Int8Key) Name Uses

func (k *Int8Key) Name() string

func (*Int8Key) Of Uses

func (k *Int8Key) Of(v int8) Tag

Of creates a new Tag with this key and the supplied value.

type IntKey Uses

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

IntKey represents a key

func NewIntKey Uses

func NewIntKey(name, description string) *IntKey

NewIntKey creates a new Key for int values.

func (*IntKey) Description Uses

func (k *IntKey) Description() string

func (*IntKey) From Uses

func (k *IntKey) From(t Tag) int

From can be used to get a value from a Tag.

func (*IntKey) Get Uses

func (k *IntKey) Get(tags TagMap) int

Get can be used to get a tag for the key from a TagMap.

func (*IntKey) Name Uses

func (k *IntKey) Name() string

func (*IntKey) Of Uses

func (k *IntKey) Of(v int) Tag

Of creates a new Tag with this key and the supplied value.

type Key Uses

type Key interface {
    // Name returns the key name.
    Name() string
    // Description returns a string that can be used to describe the value.
    Description() string
}

Key is the interface shared by all key implementations.

type StringKey Uses

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

StringKey represents a key

func NewStringKey Uses

func NewStringKey(name, description string) *StringKey

NewStringKey creates a new Key for int64 values.

func (*StringKey) Description Uses

func (k *StringKey) Description() string

func (*StringKey) From Uses

func (k *StringKey) From(t Tag) string

From can be used to get a value from a Tag.

func (*StringKey) Get Uses

func (k *StringKey) Get(tags TagMap) string

Get can be used to get a tag for the key from a TagMap.

func (*StringKey) Name Uses

func (k *StringKey) Name() string

func (*StringKey) Of Uses

func (k *StringKey) Of(v string) Tag

Of creates a new Tag with this key and the supplied value.

type Tag Uses

type Tag struct {
    Key Key
    // contains filtered or unexported fields
}

Tag holds a key and value pair. It is normally used when passing around lists of tags.

func (Tag) Format Uses

func (t Tag) Format(f fmt.State, r rune)

Format is used for debug printing of tags.

func (Tag) Valid Uses

func (t Tag) Valid() bool

Valid returns true if the Tag is a valid one (it has a key).

type TagIterator Uses

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

TagIterator is used to iterate through tags using TagPointer. It is a small helper that will normally fully inline to make it easier to manage the fact that pointer advance returns a new pointer rather than moving the existing one.

func ChainTagIterators Uses

func ChainTagIterators(iterators ...TagIterator) TagIterator

func Filter Uses

func Filter(it TagIterator, keys ...Key) TagIterator

func NewTagIterator Uses

func NewTagIterator(tags ...Tag) TagIterator

func (*TagIterator) Advance Uses

func (i *TagIterator) Advance()

func (*TagIterator) Tag Uses

func (i *TagIterator) Tag() Tag

func (*TagIterator) Valid Uses

func (i *TagIterator) Valid() bool

type TagMap Uses

type TagMap interface {
    // Find returns the tag that matches the supplied key.
    Find(key interface{}) Tag
}

TagMap is the interface to a collection of Tags indexed by key.

func MergeTagMaps Uses

func MergeTagMaps(srcs ...TagMap) TagMap

func NewTagMap Uses

func NewTagMap(tags ...Tag) TagMap

type TagPointer Uses

type TagPointer interface {
    // Next advances to the next entry in the list and return a TagIterator for it.
    // It will return nil if there are no more entries.
    Next() TagPointer
    // Tag returns the tag the pointer is for.
    Tag() Tag
}

TagPointer is the interface to something that provides an iterable list of tags.

type UInt16Key Uses

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

UInt16Key represents a key

func NewUInt16Key Uses

func NewUInt16Key(name, description string) *UInt16Key

NewUInt16Key creates a new Key for uint16 values.

func (*UInt16Key) Description Uses

func (k *UInt16Key) Description() string

func (*UInt16Key) From Uses

func (k *UInt16Key) From(t Tag) uint16

From can be used to get a value from a Tag.

func (*UInt16Key) Get Uses

func (k *UInt16Key) Get(tags TagMap) uint16

Get can be used to get a tag for the key from a TagMap.

func (*UInt16Key) Name Uses

func (k *UInt16Key) Name() string

func (*UInt16Key) Of Uses

func (k *UInt16Key) Of(v uint16) Tag

Of creates a new Tag with this key and the supplied value.

type UInt32Key Uses

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

UInt32Key represents a key

func NewUInt32Key Uses

func NewUInt32Key(name, description string) *UInt32Key

NewUInt32Key creates a new Key for uint32 values.

func (*UInt32Key) Description Uses

func (k *UInt32Key) Description() string

func (*UInt32Key) From Uses

func (k *UInt32Key) From(t Tag) uint32

From can be used to get a value from a Tag.

func (*UInt32Key) Get Uses

func (k *UInt32Key) Get(tags TagMap) uint32

Get can be used to get a tag for the key from a TagMap.

func (*UInt32Key) Name Uses

func (k *UInt32Key) Name() string

func (*UInt32Key) Of Uses

func (k *UInt32Key) Of(v uint32) Tag

Of creates a new Tag with this key and the supplied value.

type UInt64Key Uses

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

UInt64Key represents a key

func NewUInt64Key Uses

func NewUInt64Key(name, description string) *UInt64Key

NewUInt64Key creates a new Key for uint64 values.

func (*UInt64Key) Description Uses

func (k *UInt64Key) Description() string

func (*UInt64Key) From Uses

func (k *UInt64Key) From(t Tag) uint64

From can be used to get a value from a Tag.

func (*UInt64Key) Get Uses

func (k *UInt64Key) Get(tags TagMap) uint64

Get can be used to get a tag for the key from a TagMap.

func (*UInt64Key) Name Uses

func (k *UInt64Key) Name() string

func (*UInt64Key) Of Uses

func (k *UInt64Key) Of(v uint64) Tag

Of creates a new Tag with this key and the supplied value.

type UInt8Key Uses

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

UInt8Key represents a key

func NewUInt8Key Uses

func NewUInt8Key(name, description string) *UInt8Key

NewUInt8Key creates a new Key for uint8 values.

func (*UInt8Key) Description Uses

func (k *UInt8Key) Description() string

func (*UInt8Key) From Uses

func (k *UInt8Key) From(t Tag) uint8

From can be used to get a value from a Tag.

func (*UInt8Key) Get Uses

func (k *UInt8Key) Get(tags TagMap) uint8

Get can be used to get a tag for the key from a TagMap.

func (*UInt8Key) Name Uses

func (k *UInt8Key) Name() string

func (*UInt8Key) Of Uses

func (k *UInt8Key) Of(v uint8) Tag

Of creates a new Tag with this key and the supplied value.

type UIntKey Uses

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

UIntKey represents a key

func NewUIntKey Uses

func NewUIntKey(name, description string) *UIntKey

NewUIntKey creates a new Key for uint values.

func (*UIntKey) Description Uses

func (k *UIntKey) Description() string

func (*UIntKey) From Uses

func (k *UIntKey) From(t Tag) uint

From can be used to get a value from a Tag.

func (*UIntKey) Get Uses

func (k *UIntKey) Get(tags TagMap) uint

Get can be used to get a tag for the key from a TagMap.

func (*UIntKey) Name Uses

func (k *UIntKey) Name() string

func (*UIntKey) Of Uses

func (k *UIntKey) Of(v uint) Tag

Of creates a new Tag with this key and the supplied value.

type ValueKey Uses

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

ValueKey represents a key for untyped values.

func NewKey Uses

func NewKey(name, description string) *ValueKey

NewKey creates a new Key for untyped values.

func (*ValueKey) Description Uses

func (k *ValueKey) Description() string

func (*ValueKey) From Uses

func (k *ValueKey) From(t Tag) interface{}

From can be used to get a value from a Tag.

func (*ValueKey) Get Uses

func (k *ValueKey) Get(tags TagMap) interface{}

Get can be used to get a tag for the key from a TagMap.

func (*ValueKey) Name Uses

func (k *ValueKey) Name() string

func (*ValueKey) Of Uses

func (k *ValueKey) Of(value interface{}) Tag

Of creates a new Tag with this key and the supplied value.

Package event imports 7 packages (graph) and is imported by 17 packages. Updated 2020-04-08. Refresh now. Tools for package owners.