Documentation ¶
Index ¶
- Constants
- Variables
- func IsEndofMessages(msg *ControlMessage) bool
- func IsWebsocketError(err error) bool
- type ControlMessage
- type Data
- type Detector
- type Incident
- type Issue
- type Message
- type MessageGeneral
- type MessageKeepAlive
- type MessageMetadata
- type MetricDataPoint
- type QueryResults
- type Result
- func CheckInformational(ok bool, tested string) *Result
- func CheckSystemIssue(ok bool, tested string) *Result
- func CheckUserIssue(ok bool, tested string) *Result
- func InformationalIssue(tested string) *Result
- func NoIssue(tested string) *Result
- func SystemIssue(tested string) *Result
- func UserIssue(tested string) *Result
- type Rule
- type Time
- type Visualization
- type WebsocketError
Constants ¶
const ( ExpectControlType = "control-message" ControlMessageEndEvent = "END_OF_CHANNEL" ControlMessageAbortEvent = "ABORT_CHANNEL" ControlMessageStartStreamEvent = "STREAM_START" )
const (
ExeceptedKeepAliveEvent = "KEEP_ALIVE"
)
const ExpectedGeneralMessageType = "message"
const ExpectedMetadataType = "metadata"
Variables ¶
var ( // ErrNoDetectorFound is return when no valid detector is given ErrNoDetectorFound = errors.New("no detector passed") ErrAPIIssue = errors.New("unable to process request") ErrNotImplemented = errors.New("currently not implemented") ErrMissingClient = errors.New("missing required client") ErrFailedAuth = errors.New("failed auth") )
var ( // Endian is being cached within this package as the default Endian type to use when processing binary requests Endian = binary.BigEndian )
Functions ¶
func IsEndofMessages ¶
func IsEndofMessages(msg *ControlMessage) bool
func IsWebsocketError ¶
Types ¶
type ControlMessage ¶
type ControlMessage struct { Event string `json:"event"` Kind string `json:"type"` Channel string `json:"channel"` TimestampMS int64 `json:"timestamp"` Progress int `json:"progress,omitempty` }
func ReadControlMessage ¶
func ReadControlMessage(data []byte) *ControlMessage
type Data ¶
type Data struct { Version uint8 `json:"version,omitempty"` TimeSeriesID string `json:"tsId"` // Value represents either a float32, int32 or nil Value interface{} `json:"value"` }
Data represents a singular value
type Detector ¶
type Detector struct { ID string `json:"id"` Created int64 `json:"created"` LastUpdated int64 `json:"lastUpdated"` Creator string `json:"creator"` LastUpdatedBy string `json:"lastUpdatedBy"` CustomProperties map[string]interface{} `json:"customProperties"` Locked bool `json:"locked"` LabelResolutions map[string]int64 `json:"labelResolution"` MaxDelay int32 `json:"maxDelay"` OverMTSLimit bool `json:"overMTSLimit"` Timezone string `json:"timezone"` Name string `json:"name"` Description string `json:"description"` Teams []string `json:"teams"` Tags []string `json:"tags"` ProgramText string `json:"programText"` Rules []Rule `json:"rules"` VisualizationOptions Visualization `json:"visualizationOptions"` }
Detector defines the response object from the SignalFx API for further details, check: https://developers.signalfx.com/detectors_reference.html
type Issue ¶
type Issue int8
Issue is used as an enum value
const ( // OK is used when no issue is detected OK Issue = iota + 1 // System is used when the issue relates to an issue with SignalFx System // User is used when the issue relates to an issue that is result of user action User // Informational is used when as guide to highlight potential issue Informational )
type Message ¶
type Message interface {
GetType() string
}
Message defines the generic result returned back from the websocket connection
type MessageGeneral ¶
type MessageGeneral struct { Kind string `json:"type"` Channel string `json:"channel"` LogicalTimeStampMs int64 `json:"logicalTimestampMs"` Message map[string]interface{} `json:"message"` }
func ReadGeneralMessage ¶
func ReadGeneralMessage(data []byte) *MessageGeneral
func (*MessageGeneral) GetType ¶
func (gen *MessageGeneral) GetType() string
type MessageKeepAlive ¶
func ReadKeepAliveMessage ¶
func ReadKeepAliveMessage(data []byte) *MessageKeepAlive
type MessageMetadata ¶
type MessageMetadata struct { TimeSeriesID string `json:"tsId"` Kind string `json:"type"` Properties map[string]interface{} `json:"properties"` Channel string `json:"channel"` }
func ReadMetadataMessage ¶
func ReadMetadataMessage(data []byte) *MessageMetadata
func (*MessageMetadata) GetType ¶
func (meta *MessageMetadata) GetType() string
type MetricDataPoint ¶
type MetricDataPoint struct { Version int8 `json:"-"` Mtype int8 `json:"-"` Flags int8 `json:"-"` Channel string `json:"channel"` Kind string `json:"type"` LogicalTimestampMs int64 `json:"logicalTimestampMs"` MaxDelayMs int64 `json:"maxDelayMs"` Data []*Data `json:"data"` }
MetricDataPoint contains all the values needed for a collection of datapoints
func ReadMetricDataPoint ¶
func ReadMetricDataPoint(bin []byte) (*MetricDataPoint, error)
ReadMetricDataPoint reads a binary message from a websocket response and then will convert into a strong golang type
type QueryResults ¶
type QueryResults struct { Count int32 `json:"count"` Results []json.RawMessage `json:"results"` }
QueryResults defines the abstracted bulk return from SignalFx when asking for items in bulk, the results field is left as json.RawMessages to allow for partial proccessing
type Result ¶
type Result struct { IssueType Issue `json:"issueType"` Tested string `json:"tested"` Msg string `json:"message"` }
Result used when evaluation a known condition for a detector to be in an errored state
func CheckInformational ¶
func CheckSystemIssue ¶
CheckSystemIssue is a convience function to return a SystemIssue iff ok is false
func CheckUserIssue ¶
CheckUserIssue is convience function to return an UserIssue iff ok is false
func InformationalIssue ¶
InformationalIssue returns a result is meant as an informative piece
func SystemIssue ¶
SystemIssue returns a Result with its IssueType set as System and a default message
func (*Result) WithMessage ¶
WithMessage updates the Result's message and returns a deepcopy instead of modifying the orginal result
type Rule ¶
type Rule struct { Description string `json:"description"` DetectLabel string `json:"detectLabel"` Disabled bool `json:"disabled"` Notifications []map[string]string `json:"notifications,omitempty"` ParameterizedBody string `json:"parameterizedBody,omitempty"` ParameterizedSubject string `json:"parameterizedSubject,omitempty"` RunbookURL string `json:"runbookUrl,omitempty"` Severity string `json:"severity"` Tip string `json:"tip,omitempty"` }
Rule defines the response object from the SignalFx API
type Time ¶
type Time struct { Start int64 `json:"start"` End int64 `json:"end"` Range int64 `json:"range"` Type string `json:"type"` }
Time defines the response object from the SignalFx API to be used with Detectors
type Visualization ¶
type Visualization struct { DisableSampling bool `json:"disableSampling"` PublishLabelOptions []interface{} `json:"publishLabelOptions"` ShowDataMarkers bool `json:"showDataMarkers"` ShowEventLines bool `json:"showEventLines"` Time Time `json:"time"` }
Visualization defines the response object from the SignalFx API
type WebsocketError ¶
type WebsocketError struct { ErrorCode int `json:"error"` ErrorType string `json:"errorType"` Message string `json:"message"` Channel string `json:"channel"` Context map[string]interface{} `json:"context"` Kind string `json:"type"` }
func ReadWebsocketError ¶
func ReadWebsocketError(data []byte) *WebsocketError
func (*WebsocketError) Error ¶
func (web *WebsocketError) Error() string