Documentation ¶
Index ¶
- func NewDatapoint(point *JSONWriteFormat, index uint, defaultDimensions map[string]string) *datapoint.Datapoint
- func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event
- func SetupHandler(ctx context.Context, name string, sink dpsink.Sink, ...) (*web.Handler, stats.Keeper)
- type JSONDecoder
- type JSONWriteBody
- type JSONWriteFormat
- type ListenerServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatapoint ¶
func NewDatapoint(point *JSONWriteFormat, index uint, defaultDimensions map[string]string) *datapoint.Datapoint
NewDatapoint creates a new datapoint from collectd's write_http endpoint JSON format defaultDimensions are added to the datapoint created, but will be overridden by any dimension values in the JSON Dimensions are pulled out of type_instance, plugin_instance and host in that order of precedence
func NewEvent ¶ added in v0.7.0
func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event
NewEvent creates a new event from collectd's write_http endpoint JSON format defaultDimensions are added to the event created, but will be overridden by any dimension values in the JSON
func SetupHandler ¶
func SetupHandler(ctx context.Context, name string, sink dpsink.Sink, defaultDims map[string]string) (*web.Handler, stats.Keeper)
SetupHandler is shared between signalfx and here to setup listening for collectd connections. Will do shared basic setup like configuring request counters
Types ¶
type JSONDecoder ¶
type JSONDecoder struct { SendTo dpsink.Sink DefaultDims map[string]string TotalErrors int64 TotalBlankDims int64 }
JSONDecoder can decode collectd's native JSON datapoint format
func (*JSONDecoder) ServeHTTPC ¶
func (decoder *JSONDecoder) ServeHTTPC(ctx context.Context, rw http.ResponseWriter, req *http.Request)
ServeHTTPC decodes datapoints for the connection and sends them to the decoder's sink
type JSONWriteBody ¶
type JSONWriteBody []*JSONWriteFormat
JSONWriteBody is the full POST body of collectd's write_http format
type JSONWriteFormat ¶
type JSONWriteFormat struct { Dsnames []*string `json:"dsnames"` Dstypes []*string `json:"dstypes"` Host *string `json:"host"` Interval *float64 `json:"interval"` Plugin *string `json:"plugin"` PluginInstance *string `json:"plugin_instance"` Time *float64 `json:"time"` TypeS *string `json:"type"` TypeInstance *string `json:"type_instance"` Values []*float64 `json:"values"` // events Message *string `json:"message"` Meta map[string]interface{} `json:"meta"` Severity *string `json:"severity"` }
JSONWriteFormat is the format for collectd json datapoints
type ListenerServer ¶
ListenerServer will listen for collectd datapoint connections
func ListenerLoader ¶
func ListenerLoader(ctx context.Context, sink dpsink.Sink, listenFrom *config.ListenFrom) (*ListenerServer, error)
ListenerLoader loads a listener for collectd write_http protocol
func StartListeningCollectDHTTPOnPort ¶
func StartListeningCollectDHTTPOnPort(ctx context.Context, sink dpsink.Sink, listenAddr string, listenPath string, clientTimeout time.Duration, name string, defaultDims map[string]string) (*ListenerServer, error)
StartListeningCollectDHTTPOnPort servers http collectd requests
func (*ListenerServer) Close ¶
func (streamer *ListenerServer) Close() error
Close the socket currently open for collectd JSON connections