Documentation ¶
Index ¶
- Constants
- Variables
- func DefaultIncidentFormatter(i *Incident) string
- func Status(code int) string
- type BinDecoder
- type BinEncoder
- type Decoder
- type DecoderFactory
- type Encoder
- type EncoderDecoder
- type EncoderFactory
- type EncodingPool
- type Event
- func (e *Event) Get(key string) string
- func (e *Event) GetState() uint32
- func (e *Event) IndexName() string
- func (e *Event) MarshalBinary() ([]byte, error)
- func (e *Event) SetState(s uint32)
- func (e *Event) UnmarshalBinary(buff []byte) error
- func (e *Event) WaitForState(s uint32, timeout time.Duration) func()
- type EventPasser
- type Incident
- type IncidentFormatter
- type IncidentPasser
- type Index
- func (i *Index) Close()
- func (i *Index) Delete()
- func (i *Index) DeleteIncidentById(id []byte)
- func (i *Index) GetIncident(id []byte) *Incident
- func (i *Index) GetIncidentCounter() int64
- func (i *Index) ListIncidents() []*Incident
- func (i *Index) PutIncident(in *Incident)
- func (i *Index) UpdateIncidentCounter(count int64)
- type JsonDecoder
- type JsonEncoder
- type KeyVal
- type TagSet
Constants ¶
const ( ENCODING_TYPE_JSON = "json" ENCODING_TYPE_BIN = "bin" )
const ( OK = iota WARNING CRITICAL )
const ( StateStart uint32 = iota StatePipeline StatePolicy StateIncident StateComplete )
const (
KEEP_ALIVE_SERVICE_NAME = "KeepAlive"
)
Variables ¶
var ( EncoderFactories = map[string]EncoderFactory{ ENCODING_TYPE_JSON: NewJsonEncoder, ENCODING_TYPE_BIN: NewBinEncoder, } DecoderFactories = map[string]DecoderFactory{ ENCODING_TYPE_JSON: NewJsonDecoder, ENCODING_TYPE_BIN: NewBinDecoder, } )
var ( EVENT_BUCKET_NAME = []byte("events") INCIDENT_BUCKET_NAME = []byte("incidents") MANAGEMENT_BUCKET_NAME = []byte("management") INCIDENT_COUNT_NAME = []byte("incident_count") INDEX_FILE_NAME = "bangarang-index.db" )
Functions ¶
func DefaultIncidentFormatter ¶ added in v0.15.0
DefaultIncidentFormatter is the legacy formatter for incidents
Types ¶
type BinDecoder ¶ added in v0.15.0
type BinDecoder struct { }
type BinEncoder ¶ added in v0.15.0
type BinEncoder struct { }
type Decoder ¶
decodes the raw event and sends the decoded event to it's destination
func NewBinDecoder ¶ added in v0.15.0
func NewBinDecoder() Decoder
func NewJsonDecoder ¶
func NewJsonDecoder() Decoder
type DecoderFactory ¶
type DecoderFactory func() Decoder
type Encoder ¶
encodes the given event and sends the encoded value on the dst channel
func NewBinEncoder ¶ added in v0.15.0
func NewBinEncoder() Encoder
func NewJsonEncoder ¶
func NewJsonEncoder() Encoder
type EncoderDecoder ¶
type EncoderFactory ¶
type EncoderFactory func() Encoder
type EncodingPool ¶
type EncodingPool struct {
// contains filtered or unexported fields
}
func NewEncodingPool ¶
func NewEncodingPool(enc EncoderFactory, dec DecoderFactory, maxSize int) *EncodingPool
type Event ¶
type Event struct { Metric float64 `json:"metric" msg:"metric"` Tags *TagSet `json:"tags" msg:"tags"` Time time.Time `json:"time" msg: "time"` // contains filtered or unexported fields }
Event represents a metric as it passes through the pipeline. It holds meta data about the metric, as well as methods to trace the event as it is processed
func (*Event) GetState ¶ added in v0.15.0
GetState returns the current state of the event at call time
func (*Event) MarshalBinary ¶ added in v0.15.0
MarshalBinary creates the binary representation of an event Size header 8 bytes Metric 8 bytes Time seconds 8 bytes Time nanoseconds 8 bytes
TagSetSize 1 byte (max 256 key->val pairs)
Tags: key size 1 byte Tags: key (max 256 bytes) Tags: value size 1 byte Tags: value (max 256 bytes) repeat
func (*Event) SetState ¶ added in v0.15.0
SetState atomically updates the event's state to the given number
func (*Event) UnmarshalBinary ¶ added in v0.15.0
type EventPasser ¶ added in v0.15.0
type EventPasser interface {
PassEvent(e *Event)
}
EventPasser provides a method for passing an event down a step in the pipeline
type Incident ¶
type Incident struct { EventName []byte `json:"event" msg:"event_name"` Time int64 `json:"time" msg:"time"` Id int64 `json:"id" msg:"id"` Active bool `json:"active" msg:"active"` Description string `json:"description" msg:"description"` Policy string `json:"policy" msg:"policy"` Status int `json:"status" "msg:"status"` Event // contains filtered or unexported fields }
An incident is created whenever an event changes to a state
func NewIncident ¶
NewIncident creats and returns a new incident for the given event
func (*Incident) FormatDescription ¶
FormatDescription calls the formatter for this incident
func (*Incident) GetResolve ¶ added in v0.15.0
GetResolve return the incidents resover channel
func (*Incident) SetResolve ¶ added in v0.15.0
SetResolve sets the incident resolver channel for the given incident
type IncidentFormatter ¶ added in v0.15.0
IncidentFormatter will createa a string representation of an incident
type IncidentPasser ¶ added in v0.15.0
type IncidentPasser interface {
PassIncident(i *Incident)
}
IncidentPasser passes an incdent to the next step in the pipeline
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
func (*Index) DeleteIncidentById ¶
func (*Index) GetIncident ¶
get an event from the index
func (*Index) GetIncidentCounter ¶
func (*Index) UpdateIncidentCounter ¶
type JsonDecoder ¶
type JsonDecoder struct { }
type JsonEncoder ¶
type JsonEncoder struct { }
type TagSet ¶ added in v0.15.0
type TagSet []KeyVal
TagSet is a collection of key/val pairs that will always give the same order of the tags
func (*TagSet) Get ¶ added in v0.15.0
Get returns the value of a key in linear time. An empty string if it wasn't found
func (*TagSet) MarshalBinary ¶ added in v0.15.0
func (*TagSet) SortByValue ¶ added in v0.15.0
func (t *TagSet) SortByValue()