collectdreceiver

package module
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: Apache-2.0 Imports: 21 Imported by: 9

README

CollectD write_http plugin JSON receiver

This receiver can receive data exported by the CollectD's write_http plugin. Only JSON format is supported. Authentication is not supported but support can be added later if needed.

This receiver was donated by SignalFx and ported from SignalFx's Gateway (https://github.com/signalfx/gateway/tree/master/protocol/collectd). As a result, this receiver supports some additional features that are technically not compatible with stock CollectD's write_http plugin. That said, in practice such incompatibilities should never surface. For example, this receiver supports extracting labels from different fields. Given a field value field[a=b, k=v], this receiver will extract a and b as label keys and, k and v as the respective label values.

Documentation

Overview

Package collectdreceiver implements a receiver that can be used by the Opentelemetry collector to receive traces from CollectD http_write plugin in JSON format.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelsFromName

func LabelsFromName(val *string) (metricName string, labels map[string]string)

LabelsFromName tries to pull out dimensions out of name in the format "name[k=v,f=x]-more_name". For the example above it would return "name-more_name" and extract dimensions (k,v) and (f,x). If something unexpected is encountered it returns the original metric name.

The code tries to avoid allocation by using local slices and avoiding calls to functions like strings.Slice.

func New

func New(
	logger *zap.Logger,
	addr string,
	timeout time.Duration,
	defaultAttrsPrefix string,
	nextConsumer consumer.MetricsConsumerOld) (component.MetricsReceiver, error)

New creates the CollectD receiver with the given parameters.

Types

type Config

type Config struct {
	configmodels.ReceiverSettings `mapstructure:",squash"`
	confignet.TCPAddr             `mapstructure:",squash"`

	Timeout          time.Duration `mapstructure:"timeout"`
	AttributesPrefix string        `mapstructure:"attributes_prefix"`
	Encoding         string        `mapstructure:"encoding"`
}

Config defines configuration for Collectd receiver.

type Factory

type Factory struct {
}

Factory is the factory for collectd receiver.

func (*Factory) CreateDefaultConfig

func (f *Factory) CreateDefaultConfig() configmodels.Receiver

CreateDefaultConfig creates the default configuration for CollectD receiver.

func (*Factory) CreateMetricsReceiver

func (f *Factory) CreateMetricsReceiver(
	ctx context.Context,
	logger *zap.Logger,
	cfg configmodels.Receiver,
	nextConsumer consumer.MetricsConsumerOld,
) (component.MetricsReceiver, error)

CreateMetricsReceiver creates a metrics receiver based on provided config.

func (*Factory) CreateTraceReceiver

func (f *Factory) CreateTraceReceiver(
	ctx context.Context,
	logger *zap.Logger,
	cfg configmodels.Receiver,
	nextConsumer consumer.TraceConsumerOld,
) (component.TraceReceiver, error)

CreateTraceReceiver creates a trace receiver based on provided config.

func (*Factory) CustomUnmarshaler

func (f *Factory) CustomUnmarshaler() component.CustomUnmarshaler

CustomUnmarshaler returns nil because we don't need custom unmarshaling for this config.

func (*Factory) Type

func (f *Factory) Type() configmodels.Type

Type gets the type of the Receiver config created by this factory.

Jump to

Keyboard shortcuts

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