Documentation ¶
Index ¶
- func GetDimensionsFromName(val *string) (instanceName string, toAddDims map[string]string)
- func NewDatapoint(point *JSONWriteFormat, index uint, defaultDimensions map[string]string) *datapoint.Datapoint
- func NewEvent(e *JSONWriteFormat, defaultDimensions map[string]string) *event.Event
- func SetupCollectdPaths(r *mux.Router, handler http.Handler, endpoint string)
- type JSONDecoder
- type JSONWriteBody
- type JSONWriteFormat
- type ListenerConfig
- type ListenerServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDimensionsFromName ¶ added in v0.9.20
GetDimensionsFromName tries to pull out dimensions out of name in the format name[k=v,f=x]-morename would return name-morename and extract dimensions (k,v) and (f,x) if we encounter something we don't expect use original this is a bit complicated to avoid allocations, string.split allocates, while slices inside same function, do not.
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
Types ¶
type JSONDecoder ¶
type JSONDecoder struct { SendTo dpsink.Sink Logger log.Logger TotalErrors int64 TotalBlankDims int64 }
JSONDecoder can decode collectd's native JSON datapoint format
func (*JSONDecoder) Datapoints ¶ added in v0.9.0
func (decoder *JSONDecoder) Datapoints() []*datapoint.Datapoint
Datapoints about this decoder, including how many datapoints it decoded
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 JSONWriteFormat ¶
type JSONWriteFormat collectdformat.JSONWriteFormat
JSONWriteFormat is an alias
type ListenerConfig ¶ added in v0.9.0
type ListenerConfig struct { ListenAddr *string ListenPath *string Timeout *time.Duration StartingContext context.Context DebugContext *web.HeaderCtxFlag HealthCheck *string HTTPChain web.NextConstructor Logger log.Logger }
ListenerConfig controls optional parameters for collectd listeners
type ListenerServer ¶
type ListenerServer struct { protocol.CloseableHealthCheck // contains filtered or unexported fields }
ListenerServer will listen for collectd datapoint connections
func NewListener ¶ added in v0.9.0
func NewListener(sink dpsink.Sink, passedConf *ListenerConfig) (*ListenerServer, error)
NewListener serves http collectd requests
func (*ListenerServer) Close ¶
func (s *ListenerServer) Close() error
Close the socket currently open for collectd JSON connections
func (*ListenerServer) Datapoints ¶ added in v0.9.0
func (s *ListenerServer) Datapoints() []*datapoint.Datapoint
Datapoints returns JSON decoder datapoints
func (*ListenerServer) DebugDatapoints ¶ added in v1.2.11
func (s *ListenerServer) DebugDatapoints() []*datapoint.Datapoint
DebugDatapoints returns datapoints that are used for debugging the listener
func (*ListenerServer) DefaultDatapoints ¶ added in v1.2.11
func (s *ListenerServer) DefaultDatapoints() []*datapoint.Datapoint
DefaultDatapoints returns datapoints that should always be reported from the listener