signalfx

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2015 License: Apache-2.0 Imports: 32 Imported by: 0

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 ForwarderLoader

func ForwarderLoader(ctx context.Context, forwardTo *config.ForwardTo) (protocol.Forwarder, error)

ForwarderLoader loads a json forwarder forwarding points from proxy to SignalFx

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 SetupCollectdPaths

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

SetupCollectdPaths tells the router which paths the given handler (which should handle collectd json) should see

func SetupJSONV1Paths

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

SetupJSONV1Paths routes to R paths that should handle V1 JSON datapoints

func SetupJSONV2Paths

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

SetupJSONV2Paths tells the router which paths the given handler (which should handle v2 JSON) should see

func SetupProtobufV1Paths

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

SetupProtobufV1Paths routes to R paths that should handle V1 Protobuf datapoints

func SetupProtobufV2Paths

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

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

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 ConstTypeGetter

ConstTypeGetter always returns the wrapped metric type as a MericTypeGetter

func (ConstTypeGetter) GetMetricTypeFromMap

func (c ConstTypeGetter) GetMetricTypeFromMap(metricName string) com_signalfx_metrics_protobuf.MetricType

GetMetricTypeFromMap returns the wrapped metric type object

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) 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

func (*ErrorTrackerHandler) Stats

func (e *ErrorTrackerHandler) Stats(dimensions map[string]string) []*datapoint.Datapoint

Stats returns the number of calls to AddDatapoint

type Forwarder

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

Forwarder controls forwarding datapoints to SignalFx

func ForwarderLoader1

func ForwarderLoader1(ctx context.Context, forwardTo *config.ForwardTo) (protocol.Forwarder, *Forwarder, error)

ForwarderLoader1 is a more strictly typed version of ForwarderLoader

func NewSignalfxJSONForwarer

func NewSignalfxJSONForwarer(url string, timeout time.Duration,
	defaultAuthToken string, drainingThreads uint32,
	defaultSource string, sourceDimensions string, proxyVersion string) *Forwarder

NewSignalfxJSONForwarer 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) AuthToken

func (connector *Forwarder) AuthToken(authToken string)

AuthToken identifies who is sending the request

func (*Forwarder) Endpoint

func (connector *Forwarder) Endpoint(endpoint string)

Endpoint sets where metrics are sent

func (*Forwarder) UserAgent

func (connector *Forwarder) UserAgent(ua string)

UserAgent sets the User-Agent header on the request

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.Sink
}

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
}

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 ListenerServer

type ListenerServer struct {
	stats.Keeper
	// contains filtered or unexported fields
}

ListenerServer controls listening on a socket for SignalFx connections

func ListenerLoader

func ListenerLoader(ctx context.Context, sink dpsink.Sink, listenFrom *config.ListenFrom) (*ListenerServer, error)

ListenerLoader loads a listener for signalfx protocol from config

func StartServingHTTPOnPort

func StartServingHTTPOnPort(ctx context.Context, sink dpsink.Sink, listenAddr string,
	clientTimeout time.Duration, name string) (*ListenerServer, error)

StartServingHTTPOnPort servers http requests for Signalfx datapoints

func (*ListenerServer) Close

func (streamer *ListenerServer) Close() error

Close the exposed socket listening for new connections

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.Sink
	TypeGetter MericTypeGetter
}

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
}

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 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