signalfx

package
v0.9.9 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2016 License: Apache-2.0 Imports: 29 Imported by: 3

Documentation

Index

Constants

View Source
const TokenHeaderName = "X-SF-TOKEN"

TokenHeaderName is the header key for the auth token in the HTTP request

Variables

This section is empty.

Functions

func NewDatumValue

NewDatumValue creates new datapoint value referenced from a value of the datum protobuf

func NewProtobufDataPointWithType

NewProtobufDataPointWithType creates a new datapoint from SignalFx's protobuf definition (backwards compatable with old API)

func NewProtobufEvent added in v0.8.0

func NewProtobufEvent(e *com_signalfx_metrics_protobuf.Event) (*event.Event, error)

NewProtobufEvent creates a new event from SignalFx's protobuf definition

func SetupJSONByPaths added in v0.8.0

func SetupJSONByPaths(r *mux.Router, handler http.Handler, endpoint string)

SetupJSONByPaths tells the router which paths the given handler (which should handle the given endpoint) should see

func SetupJSONV1Paths

func SetupJSONV1Paths(r *mux.Router, handler http.Handler)

SetupJSONV1Paths routes to R paths that should handle V1 JSON datapoints

func SetupJSONV2DatapointPaths added in v0.8.0

func SetupJSONV2DatapointPaths(r *mux.Router, handler http.Handler)

SetupJSONV2DatapointPaths tells the router which paths the given handler (which should handle v2 protobufs)

func SetupJSONV2EventPaths added in v0.8.0

func SetupJSONV2EventPaths(r *mux.Router, handler http.Handler)

SetupJSONV2EventPaths tells the router which paths the given handler (which should handle v2 protobufs)

func SetupProtobufV1Paths

func SetupProtobufV1Paths(r *mux.Router, handler http.Handler)

SetupProtobufV1Paths routes to R paths that should handle V1 Protobuf datapoints

func SetupProtobufV2ByPaths added in v0.8.0

func SetupProtobufV2ByPaths(r *mux.Router, handler http.Handler, path string)

SetupProtobufV2ByPaths tells the router which paths the given handler (which should handle v2 protobufs)

func SetupProtobufV2DatapointPaths added in v0.8.0

func SetupProtobufV2DatapointPaths(r *mux.Router, handler http.Handler)

SetupProtobufV2DatapointPaths tells the router which paths the given handler (which should handle v2 protobufs)

func SetupProtobufV2EventPaths added in v0.8.0

func SetupProtobufV2EventPaths(r *mux.Router, handler http.Handler)

SetupProtobufV2EventPaths tells the router which paths the given handler (which should handle v2 protobufs)

func ValueToValue

func ValueToValue(v ValueToSend) (datapoint.Value, error)

ValueToValue converts the v2 JSON value to a core api Value

Types

type BodySendFormatV2

type BodySendFormatV2 struct {
	Metric     string            `json:"metric"`
	Timestamp  int64             `json:"timestamp"`
	Value      ValueToSend       `json:"value"`
	Dimensions map[string]string `json:"dimensions"`
}

BodySendFormatV2 is the JSON format signalfx datapoints are expected to be in

func (*BodySendFormatV2) String

func (bodySendFormat *BodySendFormatV2) String() string

type ErrorReader

type ErrorReader interface {
	Read(ctx context.Context, req *http.Request) error
}

ErrorReader are datapoint streamers that read from a HTTP request and return errors if the stream is invalid

type ErrorTrackerHandler

type ErrorTrackerHandler struct {
	TotalErrors int64
	// contains filtered or unexported fields
}

ErrorTrackerHandler behaves like a http handler, but tracks error returns from a ErrorReader

func (*ErrorTrackerHandler) Datapoints added in v0.9.0

func (e *ErrorTrackerHandler) Datapoints() []*datapoint.Datapoint

Datapoints gets TotalErrors stats

func (*ErrorTrackerHandler) ServeHTTPC

func (e *ErrorTrackerHandler) ServeHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request)

ServeHTTPC will serve the wrapped ErrorReader and return the error (if any) to rw if ErrorReader fails

type EventSendFormatV2 added in v0.8.0

type EventSendFormatV2 struct {
	EventType  string                 `json:"eventType"`
	Category   *string                `json:"category"`
	Dimensions map[string]string      `json:"dimensions"`
	Properties map[string]interface{} `json:"properties"`
	Timestamp  *int64                 `json:"timestamp"`
}

EventSendFormatV2 is the JSON format signalfx datapoints are expected to be in

type Forwarder

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

Forwarder controls forwarding datapoints to SignalFx

func NewForwarder added in v0.9.0

func NewForwarder(conf *ForwarderConfig) *Forwarder

NewForwarder creates a new JSON forwarder

func (*Forwarder) AddDatapoints

func (connector *Forwarder) AddDatapoints(ctx context.Context, datapoints []*datapoint.Datapoint) error

AddDatapoints forwards datapoints to SignalFx

func (*Forwarder) AddEvents added in v0.7.0

func (connector *Forwarder) AddEvents(ctx context.Context, events []*event.Event) error

AddEvents forwards events to SignalFx

func (*Forwarder) Close added in v0.9.0

func (connector *Forwarder) Close() error

Close will terminate idle HTTP client connections

func (*Forwarder) Datapoints added in v0.9.0

func (connector *Forwarder) Datapoints() []*datapoint.Datapoint

Datapoints returns nothing.

type ForwarderConfig added in v0.9.0

type ForwarderConfig struct {
	DatapointURL     *string
	EventURL         *string
	Timeout          *time.Duration
	SourceDimensions *string
	Logger           log.Logger
	ProxyVersion     *string
	MaxIdleConns     *int64
	AuthToken        *string
	ProtoMarshal     func(pb proto.Message) ([]byte, error)
	JSONMarshal      func(v interface{}) ([]byte, error)
}

ForwarderConfig controls optional parameters for a signalfx forwarder

type JSONDatapointV1

type JSONDatapointV1 struct {
	Source string  `json:"source"`
	Metric string  `json:"metric"`
	Value  float64 `json:"value"`
}

JSONDatapointV1 is the JSON API format for /v1/datapoint

type JSONDatapointV2

type JSONDatapointV2 map[string][]*BodySendFormatV2

JSONDatapointV2 is the V2 json datapoint sending format

type JSONDecoderV1

type JSONDecoderV1 struct {
	TypeGetter MericTypeGetter
	Sink       dpsink.DSink
	Logger     log.Logger
}

JSONDecoderV1 creates datapoints out of the v1 JSON definition

func (*JSONDecoderV1) Read

func (decoder *JSONDecoderV1) Read(ctx context.Context, req *http.Request) error

type JSONDecoderV2

type JSONDecoderV2 struct {
	Sink   dpsink.Sink
	Logger log.Logger
}

JSONDecoderV2 decodes v2 json data for signalfx and sends it to Sink

func (*JSONDecoderV2) Read

func (decoder *JSONDecoderV2) Read(ctx context.Context, req *http.Request) error

type JSONEventDecoderV2 added in v0.8.0

type JSONEventDecoderV2 struct {
	Sink   dpsink.ESink
	Logger log.Logger
}

JSONEventDecoderV2 decodes v2 json data for signalfx events and sends it to Sink

func (*JSONEventDecoderV2) Read added in v0.8.0

func (decoder *JSONEventDecoderV2) Read(ctx context.Context, req *http.Request) error

type JSONEventV2 added in v0.8.0

type JSONEventV2 []*EventSendFormatV2

JSONEventV2 is the V2 json event sending format

type ListenerConfig added in v0.9.0

type ListenerConfig struct {
	ListenAddr  *string
	Timeout     *time.Duration
	Logger      log.Logger
	RootContext context.Context
	JSONMarshal func(v interface{}) ([]byte, error)
}

ListenerConfig controls optional parameters for the listener

type ListenerServer

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

ListenerServer controls listening on a socket for SignalFx connections

func NewListener added in v0.9.0

func NewListener(sink dpsink.Sink, conf *ListenerConfig) (*ListenerServer, error)

NewListener servers http requests for Signalfx datapoints

func (*ListenerServer) Close

func (streamer *ListenerServer) Close() error

Close the exposed socket listening for new connections

func (*ListenerServer) Datapoints added in v0.9.0

func (streamer *ListenerServer) Datapoints() []*datapoint.Datapoint

Datapoints returns the datapoints about various internal endpoints

type MericTypeGetter

type MericTypeGetter interface {
	GetMetricTypeFromMap(metricName string) com_signalfx_metrics_protobuf.MetricType
}

MericTypeGetter is an old metric interface that returns the type of a metric name

type MetricCreationResponse

type MetricCreationResponse struct {
	Code    int    `json:"code,omitempty"`
	Error   bool   `json:"error,omitempty"`
	Message string `json:"message,omitempty"`
}

MetricCreationResponse is the API response for /v1/metric POST

type MetricCreationStruct

type MetricCreationStruct struct {
	MetricName string `json:"sf_metric"`
	MetricType string `json:"sf_metricType"`
}

MetricCreationStruct is the API format for /v1/metric POST

type ProtobufDecoderV1

type ProtobufDecoderV1 struct {
	Sink       dpsink.DSink
	TypeGetter MericTypeGetter
	Logger     log.Logger
}

ProtobufDecoderV1 creates datapoints out of the V1 protobuf definition

func (*ProtobufDecoderV1) Read

func (decoder *ProtobufDecoderV1) Read(ctx context.Context, req *http.Request) error

type ProtobufDecoderV2

type ProtobufDecoderV2 struct {
	Sink   dpsink.Sink
	Logger log.Logger
}

ProtobufDecoderV2 decodes protocol buffers in signalfx's v2 format and sends them to Sink

func (*ProtobufDecoderV2) Read

func (decoder *ProtobufDecoderV2) Read(ctx context.Context, req *http.Request) error

type ProtobufEventDecoderV2 added in v0.8.0

type ProtobufEventDecoderV2 struct {
	Sink   dpsink.ESink
	Logger log.Logger
}

ProtobufEventDecoderV2 decodes protocol buffers in signalfx's v2 format and sends them to Sink

func (*ProtobufEventDecoderV2) Read added in v0.8.0

func (decoder *ProtobufEventDecoderV2) Read(ctx context.Context, req *http.Request) error

type ValueToSend

type ValueToSend interface {
}

ValueToSend are values are sent from the proxy to a reciever for the datapoint

Jump to

Keyboard shortcuts

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