Documentation ¶
Index ¶
- Constants
- Variables
- type DecFunc
- type Decoder
- type DecoderFactory
- type EncFunc
- type Encoder
- type EncoderDecoder
- type EncoderFactory
- type EncodingPool
- type Event
- func (z *Event) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Event) EncodeMsg(en *msgp.Writer) (err error)
- func (e *Event) FormatDescription() string
- func (e *Event) Get(key string) string
- func (e *Event) IndexName() string
- func (mj *Event) MarshalJSON() ([]byte, error)
- func (mj *Event) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (z *Event) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Event) Msgsize() (s int)
- func (uj *Event) UnmarshalJSON(input []byte) error
- func (uj *Event) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (z *Event) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Incident
- func (z *Incident) DecodeMsg(dc *msgp.Reader) (err error)
- func (z *Incident) EncodeMsg(en *msgp.Writer) (err error)
- func (i *Incident) FormatDescription() string
- func (i *Incident) GetEvent() *Event
- func (i *Incident) IndexName() []byte
- func (mj *Incident) MarshalJSON() ([]byte, error)
- func (mj *Incident) MarshalJSONBuf(buf fflib.EncodingBuffer) error
- func (z *Incident) MarshalMsg(b []byte) (o []byte, err error)
- func (z *Incident) Msgsize() (s int)
- func (uj *Incident) UnmarshalJSON(input []byte) error
- func (uj *Incident) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error
- func (z *Incident) UnmarshalMsg(bts []byte) (o []byte, err error)
- type Index
- func (i *Index) Close() error
- func (i *Index) Delete() error
- func (i *Index) DeleteIncidentById(id []byte)
- func (i *Index) GetIncident(id []byte) *Incident
- func (i *Index) GetIncidentCounter() int64
- func (i *Index) GetKeepAlives() []*Event
- func (i *Index) ListIncidents() []*Incident
- func (i *Index) PutEvent(e *Event)
- func (i *Index) PutIncident(in *Incident)
- func (i *Index) UpdateEvent(e *Event)
- func (i *Index) UpdateIncidentCounter(count int64)
- type JsonDecoder
- type JsonEncoder
- type MsgPackDecoder
- type MsgPackEncoder
Constants ¶
View Source
const ( ENCODING_TYPE_JSON = "json" ENCODING_TYPE_MSGPACK = "msgp" )
View Source
const ( OK = iota WARNING CRITICAL )
View Source
const (
KEEP_ALIVE_SERVICE_NAME = "KeepAlive"
)
Variables ¶
View Source
var ( EncoderFactories = map[string]EncoderFactory{ ENCODING_TYPE_JSON: NewJsonEncoder, ENCODING_TYPE_MSGPACK: NewMsgPackEncoder, } DecoderFactories = map[string]DecoderFactory{ ENCODING_TYPE_JSON: NewJsonDecoder, ENCODING_TYPE_MSGPACK: NewMsgPackDecoder, } )
View Source
var ( EVENT_BUCKET_NAME = []byte("events") INCIDENT_BUCKET_NAME = []byte("incidents") MANAGEMENT_BUCKET_NAME = []byte("management") INCIDENT_COUNT_NAME = []byte("incident_count") )
Functions ¶
This section is empty.
Types ¶
type Decoder ¶
decodes the raw event and sends the decoded event to it's destination
func NewJsonDecoder ¶
func NewJsonDecoder() Decoder
func NewMsgPackDecoder ¶
func NewMsgPackDecoder() Decoder
type DecoderFactory ¶
type DecoderFactory func() Decoder
type Encoder ¶
encodes the given event and sends the encoded value on the dst channel
func NewJsonEncoder ¶
func NewJsonEncoder() Encoder
func NewMsgPackEncoder ¶
func NewMsgPackEncoder() 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
func (*EncodingPool) Decode ¶
func (t *EncodingPool) Decode(d DecFunc)
use one of the pooled decoders to decode the given event
func (*EncodingPool) Encode ¶
func (t *EncodingPool) Encode(e EncFunc)
use one of the pooled encoders to encode the given event
type Event ¶
type Event struct { Host string `json:"host" msg:"host"` Service string `json:"service" msg:"service"` SubService string `json:"sub_type" msg:"sub_service"` Metric float64 `json:"metric" msg:"metric"` Occurences int `json:"occurences" msg:"occurences"` Tags map[string]string `json:"tags" msg:"tags"` Status int `json:"status" msg:"status"` IncidentId *int64 `json:"incident,omitempty" msg:"incident_id"` // contains filtered or unexported fields }
func (*Event) FormatDescription ¶
func (*Event) MarshalJSON ¶
func (*Event) MarshalJSONBuf ¶
func (mj *Event) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*Event) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Event) UnmarshalJSON ¶
func (*Event) UnmarshalJSONFFLexer ¶
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"` Escalation string `json:"escalation" msg:"escalation"` Description string `json:"description" msg:"description"` Policy string `json:"policy" msg:"policy"` Event }
An incident is created whenever an event changes to a state that is not event.OK
func NewIncident ¶
func (*Incident) FormatDescription ¶
func (*Incident) MarshalJSON ¶
func (*Incident) MarshalJSONBuf ¶
func (mj *Incident) MarshalJSONBuf(buf fflib.EncodingBuffer) error
func (*Incident) MarshalMsg ¶
MarshalMsg implements msgp.Marshaler
func (*Incident) UnmarshalJSON ¶
func (*Incident) UnmarshalJSONFFLexer ¶
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) GetKeepAlives ¶
return all keep alive's as events
func (*Index) UpdateEvent ¶
updates the event, will not apply any of the dedupe logic
func (*Index) UpdateIncidentCounter ¶
type JsonDecoder ¶
type JsonDecoder struct { }
type JsonEncoder ¶
type JsonEncoder struct {
// contains filtered or unexported fields
}
type MsgPackDecoder ¶
type MsgPackDecoder struct { }
type MsgPackEncoder ¶
type MsgPackEncoder struct { }
Click to show internal directories.
Click to hide internal directories.