events

package
v0.0.0-...-60c8855 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	*sync.RWMutex
	Name string
	// contains filtered or unexported fields
}

Event wraps some data and some sinks to send it to.

func NewEvent

func NewEvent(name string, sinks ...EventSink) *Event

func (*Event) AddDynamicField

func (event *Event) AddDynamicField(key string, fn func() interface{})

Add a dynamic field to this event; this will be evaluated each time Send() or SendTo() is called.

func (*Event) AddField

func (event *Event) AddField(key string, value interface{})

Add a field to this event

func (*Event) Send

func (event *Event) Send()

Send event to all sinks asynchronously

func (*Event) SendTo

func (event *Event) SendTo(sink EventSink)

Send to a particular event sink asynchronously, won't send to other sinks defined on the event prior

type EventSink

type EventSink interface {
	SendEvent(eventName string, fields map[string]interface{})
}

EventSink defines an interface for accepting data for an event

type HoneycombSink

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

HoneycombSink will send the event to HoneyComb.io, with fields added.

func NewHoneycombSink

func NewHoneycombSink(builder *libhoney.Builder) *HoneycombSink

func (*HoneycombSink) SendEvent

func (sink *HoneycombSink) SendEvent(eventName string, fields map[string]interface{})

type LogEventSink

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

LogEventSink will log the event with level "info" to the logger passed in, using the event fields.

func NewLogEventSink

func NewLogEventSink(logger log.Logger) *LogEventSink

func (*LogEventSink) SendEvent

func (sink *LogEventSink) SendEvent(eventName string, fields map[string]interface{})

Jump to

Keyboard shortcuts

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