package core
import "golang.org/x/tools/internal/event/core"
Package core provides support for event based telemetry.
Index ¶
- func Export(ctx context.Context, ev Event) context.Context
- func ExportPair(ctx context.Context, begin, end Event) (context.Context, func())
- func Log1(ctx context.Context, message string, t1 label.Label)
- func Log2(ctx context.Context, message string, t1 label.Label, t2 label.Label)
- func Metric1(ctx context.Context, t1 label.Label) context.Context
- func Metric2(ctx context.Context, t1, t2 label.Label) context.Context
- func SetExporter(e Exporter)
- func Start1(ctx context.Context, name string, t1 label.Label) (context.Context, func())
- func Start2(ctx context.Context, name string, t1, t2 label.Label) (context.Context, func())
- type Event
- func CloneEvent(ev Event, at time.Time) Event
- func MakeEvent(static [3]label.Label, labels []label.Label) Event
- func (ev Event) At() time.Time
- func (ev Event) Find(key label.Key) label.Label
- func (ev Event) Format(f fmt.State, r rune)
- func (ev Event) Label(index int) label.Label
- func (ev Event) Valid(index int) bool
- type Exporter
Functions ¶
func Export ¶
Export is called to deliver an event to the global exporter if set.
func ExportPair ¶
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 ¶
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 ¶
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 ¶
Metric1 sends a label event to the exporter with the supplied labels.
func Metric2 ¶
Metric2 sends a label event to the exporter with the supplied labels.
func SetExporter ¶
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 ¶
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 ¶
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.
Types ¶
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event holds the information about an event of note that occurred.
func CloneEvent ¶
CloneEvent event returns a copy of the event with the time adjusted to at.
func MakeEvent ¶
func (Event) At ¶
func (Event) Find ¶
func (Event) Format ¶
func (Event) Label ¶
func (Event) Valid ¶
type Exporter ¶
Exporter is a function that handles events. It may return a modified context and event.
Source Files ¶
event.go export.go fast.go
- Version
- v0.30.0 (latest)
- Published
- Feb 10, 2025
- Platform
- linux/amd64
- Imports
- 7 packages
- Last checked
- 8 hours ago –
Tools for package owners.