event

package module
v0.0.0-...-85df8ed Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2023 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidFlags     = errors.New("invalid flags")
	ErrInvalidHeader    = fmt.Errorf("%w: invalid --event-headers (missing =)", ErrInvalidFlags)
	ErrInvalidRateClass = fmt.Errorf("%w: invalid --event-rate-classes (missing =)", ErrInvalidFlags)
)

Functions

func HookBuildInfo

func HookBuildInfo(_ context.Context, ev *Event)

func HookMetrics

func HookMetrics(_ context.Context, ev *Event)

func HookRUsage

func HookRUsage(_ context.Context, ev *Event)

func RegisterFlags

func RegisterFlags()

Types

type Client

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

func New

func New() *Client

func (*Client) AddHook

func (c *Client) AddHook(hook Hook) *Client

func (*Client) AddTarget

func (c *Client) AddTarget(url string, headers map[string]string, writePeriodSeconds float64) *Target

func (*Client) Close

func (c *Client) Close()

func (*Client) Fatal

func (c *Client) Fatal(ctx context.Context, vals ...any)

func (*Client) HandleFlags

func (c *Client) HandleFlags() error

func (*Client) Log

func (c *Client) Log(ctx context.Context, vals ...any) string

func (*Client) WriteEvent

func (c *Client) WriteEvent(ctx context.Context, ev *Event)

type Event

type Event struct {
	Time       string         `json:"time"`
	SampleRate int64          `json:"samplerate"`
	Data       map[string]any `json:"data"`
	// contains filtered or unexported fields
}

func NewEvent

func NewEvent(eventType string, vals ...any) *Event

func (*Event) Set

func (ev *Event) Set(vals ...any)

type Hook

type Hook func(context.Context, *Event)

type Target

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

func (*Target) AddRateClass

func (target *Target) AddRateClass(grantRate float64, vals ...any)

Jump to

Keyboard shortcuts

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