messages

package
v1.6.11 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2019 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StreamStartEvent  = "STREAM_START"
	JobStartEvent     = "JOB_START"
	JobProgressEvent  = "JOB_PROGRESS"
	ChannelAbortEvent = "CHANNEL_ABORT"
	EndOfChannelEvent = "END_OF_CHANNEL"
)

The event types used in the control-message messages. This are not used for "event" type messages.

View Source
const (
	JobRunningResolution = "JOB_RUNNING_RESOLUTION"
	JobDetectedLag       = "JOB_DETECTED_LAG"
	JobInitialMaxDelay   = "JOB_INITIAL_MAX_DELAY"
)
View Source
const (
	AuthenticatedType  = "authenticated"
	ControlMessageType = "control-message"
	ErrorType          = "error"
	MetadataType       = "metadata"
	MessageType        = "message"
	DataType           = "data"
	EventType          = "event"
	WebsocketErrorType = "websocket-error"
	ExpiredTSIDType    = "expired-tsid"
)

See https://developers.signalfx.com/signalflow_analytics/rest_api_messages/stream_messages_specification.html

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticatedMessage

type AuthenticatedMessage struct {
	BaseJSONMessage
	OrgID  string `json:"orgId"`
	UserID string `json:"userId"`
}

type BaseChannelMessage

type BaseChannelMessage struct {
	Chan string `json:"channel,omitempty"`
}

func (*BaseChannelMessage) Channel

func (bcm *BaseChannelMessage) Channel() string

type BaseControlMessage

type BaseControlMessage struct {
	BaseJSONChannelMessage
	TimestampedMessage
	Event string `json:"event"`
}

type BaseJSONChannelMessage

type BaseJSONChannelMessage struct {
	BaseJSONMessage
	BaseChannelMessage
}

func (*BaseJSONChannelMessage) String

func (j *BaseJSONChannelMessage) String() string

type BaseJSONMessage

type BaseJSONMessage struct {
	BaseMessage
	// contains filtered or unexported fields
}

func (*BaseJSONMessage) JSONBase

func (bjm *BaseJSONMessage) JSONBase() *BaseJSONMessage

func (*BaseJSONMessage) RawData

func (j *BaseJSONMessage) RawData() map[string]interface{}

The raw message deserialized from JSON. Only applicable for JSON Useful if the message type doesn't have a concrete struct type implemented in this library (e.g. due to an upgrade to the SignalFlow protocol).

func (*BaseJSONMessage) String

func (j *BaseJSONMessage) String() string

type BaseMessage

type BaseMessage struct {
	Typ string `json:"type"`
}

func (*BaseMessage) Base

func (bm *BaseMessage) Base() *BaseMessage

func (*BaseMessage) String

func (bm *BaseMessage) String() string

func (*BaseMessage) Type

func (bm *BaseMessage) Type() string

type BinaryMessageHeader

type BinaryMessageHeader struct {
	Version     uint8
	MessageType uint8
	Flags       uint8
	Reserved    uint8
	Channel     [16]byte
}

BinaryMessageHeader represents the first 20 bytes of every binary websocket message from the backend. https://developers.signalfx.com/signalflow_analytics/rest_api_messages/stream_messages_specification.html#_binary_encoding_of_websocket_messages

type ChannelMessage

type ChannelMessage interface {
	Channel() string
}

type DataMessage

type DataMessage struct {
	BaseMessage
	BaseChannelMessage
	TimestampedMessage
	Payloads []DataPayload
}

DataMessage is a set of datapoints that share a common timestamp

func (*DataMessage) String

func (dm *DataMessage) String() string

type DataMessageHeader

type DataMessageHeader struct {
	TimestampMillis uint64
	ElementCount    uint32
}

type DataPayload

type DataPayload struct {
	Type ValType
	TSID idtool.ID
	Val  [8]byte
}

func (*DataPayload) Float64

func (dp *DataPayload) Float64() float64

func (*DataPayload) Int32

func (dp *DataPayload) Int32() int32

func (*DataPayload) Int64

func (dp *DataPayload) Int64() int64

func (*DataPayload) Value

func (dp *DataPayload) Value() interface{}

Value returns the numeric value as an interface{}.

type ErrorContext

type ErrorContext struct {
	BindingName string      `json:"bindingName"`
	Column      int         `json:"column"`
	Line        int         `json:"line"`
	ProgramText string      `json:"programText"`
	Reference   string      `json:"reference"`
	Traceback   interface{} `json:"traceback"`
}

type ErrorMessage

type ErrorMessage struct {
	BaseJSONChannelMessage

	Context   ErrorContext `json:"context"`
	Error     int          `json:"error"`
	ErrorType string       `json:"errorType"`
	Message   string       `json:"message"`
}

type EventMessage

type EventMessage struct {
	BaseJSONChannelMessage
}

type ExpiredTSIDMessage

type ExpiredTSIDMessage struct {
	BaseJSONChannelMessage
	TSID string `json:"tsId"`
}

ExpiredTSIDMessage is received when a timeseries has expired and is no longer relvant to a computation.

type InfoMessage

type InfoMessage struct {
	BaseJSONChannelMessage
	LogicalTimestampMillis uint64 `json:"logicalTimestampMs"`
	MessageBlock           `json:"message"`
}

func (*InfoMessage) LogicalTimestamp

func (im *InfoMessage) LogicalTimestamp() time.Time

func (*InfoMessage) UnmarshalJSON

func (im *InfoMessage) UnmarshalJSON(raw []byte) error

type JSONMessage

type JSONMessage interface {
	Message
	JSONBase() *BaseJSONMessage
	RawData() map[string]interface{}
}

type JobDetectedLagContents

type JobDetectedLagContents map[string]interface{}

func (JobDetectedLagContents) LagMS

func (jm JobDetectedLagContents) LagMS() int

type JobInitialMaxDelayContents

type JobInitialMaxDelayContents map[string]interface{}

func (JobInitialMaxDelayContents) MaxDelayMS

func (jm JobInitialMaxDelayContents) MaxDelayMS() int

type JobRunningResolutionContents

type JobRunningResolutionContents map[string]interface{}

func (JobRunningResolutionContents) ResolutionMS

func (jm JobRunningResolutionContents) ResolutionMS() int

type JobStartControlMessage

type JobStartControlMessage struct {
	BaseControlMessage
	Handle string `json:"handle"`
}

type Message

type Message interface {
	Type() string
	Base() *BaseMessage
}

func ParseMessage

func ParseMessage(msg []byte, isText bool) (Message, error)

The way to distinguish between JSON and binary messages is the websocket message type.

type MessageBlock

type MessageBlock struct {
	TimestampedMessage
	Code               string `json:"messageCode"`
	Level              string `json:"messageLevel"`
	NumInputTimeseries int    `json:"numInputTimeSeries"`
	// If the messageCode field in the message is known, this will be an
	// instance that has more specific methods to access the known fields.  You
	// can always access the original content by treating this value as a
	// map[string]interface{}.
	Contents    interface{}            `json:"-"`
	ContentsRaw map[string]interface{} `json:"contents"`
}

type MetadataMessage

type MetadataMessage struct {
	BaseJSONChannelMessage
	TSID       idtool.ID          `json:"tsId"`
	Properties MetadataProperties `json:"properties"`
}

type MetadataProperties

type MetadataProperties struct {
	Metric            string `json:"sf_metric"`
	OriginatingMetric string `json:"sf_originatingMetric"`
	ResolutionMS      int    `json:"sf_resolutionMs"`
	CreatedOnMS       int    `json:"sf_createdOnMs"`
	// Additional SignalFx-generated properties about this time series.  Many
	// of these are exposed directly in fields on this struct.
	InternalProperties map[string]interface{} `json:"-"`
	// Custom properties applied to the timeseries through various means,
	// including dimensions, properties on matching dimensions, etc.
	CustomProperties map[string]string `json:"-"`
}

func (*MetadataProperties) MarshalJSON

func (mp *MetadataProperties) MarshalJSON() ([]byte, error)

func (*MetadataProperties) UnmarshalJSON

func (mp *MetadataProperties) UnmarshalJSON(b []byte) error

type TimestampedMessage

type TimestampedMessage struct {
	TimestampMillis uint64 `json:"timestampMs"`
}

func (*TimestampedMessage) Timestamp

func (tsm *TimestampedMessage) Timestamp() time.Time

type ValType

type ValType uint8
const (
	ValTypeLong   ValType = 1
	ValTypeDouble ValType = 2
	ValTypeInt    ValType = 3
)

func (ValType) String

func (vt ValType) String() string

Jump to

Keyboard shortcuts

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