event

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAlertKey = "_defaultAlertKey"
	NoDataKey       = "NoDataAlert"
	Addition        = "additions"
	Fields          = "fields"
	ReasonKey       = "reason"

	AlertOriginDataKey = "Events"
)
View Source
const (
	SystemKeyPrefix  = "system"
	PrivateKeyPrefix = "@private"

	SystemPipelineKey    = SystemKeyPrefix + "PipelineName"
	SystemSourceKey      = SystemKeyPrefix + "SourceName"
	SystemProductTimeKey = SystemKeyPrefix + "ProductTime"

	Body = "body"
)

Variables

View Source
var ErrorDropEvent = errors.New("drop event")

Functions

func ErrorIntoEvent added in v1.5.0

func ErrorIntoEvent(event api.Event, message string) api.Event

func ErrorToEvent added in v1.5.0

func ErrorToEvent(message string) *api.Event

func GenAlertsOriginData added in v1.5.0

func GenAlertsOriginData(alerts []Alert) map[string]interface{}

Types

type Alert added in v1.5.0

type Alert map[string]interface{}

func NewAlert added in v1.5.0

func NewAlert(e api.Event, lineLimit int) Alert

type AlertMap added in v1.5.0

type AlertMap map[string][]Alert

type DefaultEvent

type DefaultEvent struct {
	H map[string]interface{} `json:"header"`
	B []byte                 `json:"body"`
	M api.Meta               `json:"meta"`
}

func NewEvent

func NewEvent(header map[string]interface{}, body []byte) *DefaultEvent

func (*DefaultEvent) Body

func (de *DefaultEvent) Body() []byte

func (*DefaultEvent) DeepCopy added in v1.4.0

func (de *DefaultEvent) DeepCopy() api.Event

func (*DefaultEvent) Fill

func (de *DefaultEvent) Fill(meta api.Meta, header map[string]interface{}, body []byte)

func (*DefaultEvent) Header

func (de *DefaultEvent) Header() map[string]interface{}

func (*DefaultEvent) Meta

func (de *DefaultEvent) Meta() api.Meta

func (*DefaultEvent) Release

func (de *DefaultEvent) Release()

func (*DefaultEvent) String

func (de *DefaultEvent) String() string

type DefaultMeta

type DefaultMeta struct {
	Properties map[string]interface{} `json:"properties"`
}

func NewDefaultMeta

func NewDefaultMeta() *DefaultMeta

func (*DefaultMeta) Get

func (dm *DefaultMeta) Get(key string) (value interface{}, exist bool)

func (*DefaultMeta) GetAll

func (dm *DefaultMeta) GetAll() map[string]interface{}

func (*DefaultMeta) Set

func (dm *DefaultMeta) Set(key string, value interface{})

func (*DefaultMeta) Source

func (dm *DefaultMeta) Source() string

func (*DefaultMeta) String

func (dm *DefaultMeta) String() string

type Factory

type Factory func() api.Event

type PackageAndSendAlerts added in v1.5.0

type PackageAndSendAlerts func(alerts []Alert)

type Pool

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

func NewDefaultPool

func NewDefaultPool(capacity int) *Pool

func NewPool

func NewPool(capacity int, factory Factory) *Pool

func (*Pool) Get

func (p *Pool) Get() api.Event

func (*Pool) GetN

func (p *Pool) GetN(n int) []api.Event

func (*Pool) Put

func (p *Pool) Put(event api.Event)

func (*Pool) PutAll

func (p *Pool) PutAll(events []api.Event)

Jump to

Keyboard shortcuts

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