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

package core

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

Package core provides support for event based telemetry.

Index

Package Files

event.go export.go fast.go

func Export Uses

func Export(ctx context.Context, ev Event) context.Context

Export is called to deliver an event to the global exporter if set.

func ExportPair Uses

func ExportPair(ctx context.Context, begin, end Event) (context.Context, func())

ExportPair is called to deliver a start event to the supplied exporter. It also returns a function that will deliver the end event to the same exporter. It will fill in the time.

func Log1 Uses

func Log1(ctx context.Context, message string, t1 label.Label)

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

func Log2 Uses

func Log2(ctx context.Context, message string, t1 label.Label, t2 label.Label)

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

func Metric1 Uses

func Metric1(ctx context.Context, t1 label.Label) context.Context

Metric1 sends a label event to the exporter with the supplied labels.

func Metric2 Uses

func Metric2(ctx context.Context, t1, t2 label.Label) context.Context

Metric2 sends a label event to the exporter with the supplied labels.

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 Start1 Uses

func Start1(ctx context.Context, name string, t1 label.Label) (context.Context, func())

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

func Start2 Uses

func Start2(ctx context.Context, name string, t1, t2 label.Label) (context.Context, func())

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

type Event Uses

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

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

func CloneEvent Uses

func CloneEvent(ev Event, at time.Time) Event

CloneEvent event returns a copy of the event with the time adjusted to at.

func MakeEvent Uses

func MakeEvent(static [3]label.Label, labels []label.Label) Event

func (Event) At Uses

func (ev Event) At() time.Time

func (Event) Find Uses

func (ev Event) Find(key label.Key) label.Label

func (Event) Format Uses

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

func (Event) Label Uses

func (ev Event) Label(index int) label.Label

func (Event) Valid Uses

func (ev Event) Valid(index int) bool

type Exporter Uses

type Exporter func(context.Context, Event, label.Map) context.Context

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

Package core imports 7 packages (graph) and is imported by 16 packages. Updated 2020-10-28. Refresh now. Tools for package owners.