core

package
v0.24.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2024 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package core provides support for event based telemetry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Export

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

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

func ExportPair

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

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

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

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

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

func Metric2

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

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

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

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.

Types

type Event

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

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

func CloneEvent

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

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

func MakeEvent

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

func (Event) At

func (ev Event) At() time.Time

func (Event) Find

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

func (Event) Format

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

func (Event) Label

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

func (Event) Valid

func (ev Event) Valid(index int) bool

type Exporter

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.

Jump to

Keyboard shortcuts

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