eventkit

package module
v0.0.0-...-1d9596f Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: MIT Imports: 13 Imported by: 17

README

eventkit

a go library for reporting multidimensional events over UDP

Build

Project can be built with usual go commands (such as go install or go test ./...), but current CI uses Earthly, which can be installed with downloading one binary.

Follow the instructions to download. For example, on Linux one can use:

sudo /bin/sh -c 'wget https://github.com/earthly/earthly/releases/latest/download/earthly-linux-amd64 -O /usr/local/bin/earthly && chmod +x /usr/local/bin/earthly && /usr/local/bin/earthly bootstrap --with-autocomplete'

You can decide to turn off all cloud features:

earthly config global.disable_analytics true   
earthly config global.disable_log_sharing true

Most useful build targets:

  • earthly +lint --> execute basic linting
  • earthly +test --> execute unit tests
  • earthly +format --> format the code (requires full committed state)

In case of something is failing, use -i which will give you an interactive environment where you can try to repeat the failing command:

earthly -i +lint

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultRegistry = NewRegistry()

Functions

This section is empty.

Types

type BatchDestination

type BatchDestination interface {
	SubmitBatch(*[]Event)
}

type Destination

type Destination interface {
	Submit(...*Event)
	Run(ctx context.Context)
}

type Event

type Event struct {
	Name      string
	Scope     []string
	Timestamp time.Time
	Tags      []Tag
}

type Registry

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

func NewRegistry

func NewRegistry() *Registry

func (*Registry) AddDestination

func (r *Registry) AddDestination(dest Destination)

AddDestination adds an output to the registry. Do not call AddDestination if (*Registry).Submit might be called concurrently. It is expected that AddDestination will be called at initialization time before any events.

func (*Registry) Scope

func (r *Registry) Scope(name string) *Scope

func (*Registry) Submit

func (r *Registry) Submit(e *Event)

Submit submits an Event to all added Destinations.

type Scope

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

func Package

func Package() *Scope

func (*Scope) Event

func (s *Scope) Event(name string, tags ...Tag)

func (*Scope) Subscope

func (s *Scope) Subscope(name string) *Scope

type Tag

type Tag = *pb.Tag

func Bool

func Bool(key string, val bool) Tag

func Bytes

func Bytes(key string, val []byte) Tag

func Duration

func Duration(key string, val time.Duration) Tag

func Float64

func Float64(key string, val float64) Tag

func Int64

func Int64(key string, val int64) Tag

func String

func String(key string, val string) Tag

func Timestamp

func Timestamp(key string, val time.Time) Tag

type UDPClient

type UDPClient struct {
	Application string
	Version     string
	Instance    string
	Addr        string

	QueueDepth           int
	MaxUncompressedBytes int
	CompressionLevel     int
	FlushInterval        time.Duration
	// contains filtered or unexported fields
}

func NewUDPClient

func NewUDPClient(application, version, instance, addr string) *UDPClient

func (*UDPClient) Run

func (c *UDPClient) Run(ctx context.Context)

func (*UDPClient) Submit

func (c *UDPClient) Submit(events ...*Event)

Jump to

Keyboard shortcuts

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