handler

package
v0.0.0-...-f4ec7ef Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2016 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBufferSize                = 100
	DefaultInterval                  = 10
	DefaultTimeoutSec                = 2
	DefaultMaxIdleConnectionsPerHost = 2
	DefaultKeepAliveInterval         = 30
)

Some sane values to default things to

Variables

This section is empty.

Functions

func RegisterHandler

func RegisterHandler(name string, f func(chan metric.Metric, int, int, time.Duration, *l.Entry) Handler)

RegisterHandler takes handler name and constructor function and returns handler

Types

type BaseHandler

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

BaseHandler is class to handle the boiler plate parts of the handlers

func (BaseHandler) Channel

func (base BaseHandler) Channel() chan metric.Metric

Channel : the channel to handler listens for metrics on

func (BaseHandler) CollectorBlackList

func (base BaseHandler) CollectorBlackList() map[string]bool

CollectorBlackList : return handler specific black listed collectors

func (BaseHandler) CollectorChannels

func (base BaseHandler) CollectorChannels() map[string]chan metric.Metric

CollectorChannels : the channels to handler listens for metrics on

func (BaseHandler) CollectorWhiteList

func (base BaseHandler) CollectorWhiteList() map[string]bool

CollectorWhiteList : return handler specific black listed collectors

func (BaseHandler) DefaultDimensions

func (base BaseHandler) DefaultDimensions() map[string]string

DefaultDimensions : dimensions that should be included in any metric

func (*BaseHandler) InitListeners

func (base *BaseHandler) InitListeners(globalConfig config.Config)

InitListeners - initiate listener channels for collectors

func (BaseHandler) InternalMetrics

func (base BaseHandler) InternalMetrics() metric.InternalMetrics

InternalMetrics : Returns the internal metrics that are being collected by this handler

func (BaseHandler) Interval

func (base BaseHandler) Interval() int

Interval : the maximum interval that the handler should buffer stats for

func (BaseHandler) IsCollectorBlackListed

func (base BaseHandler) IsCollectorBlackListed(collectorName string) (bool, bool)

IsCollectorBlackListed : return true if collectorName is blacklisted in the handler

func (BaseHandler) IsCollectorWhiteListed

func (base BaseHandler) IsCollectorWhiteListed(collectorName string) (bool, bool)

IsCollectorWhiteListed : return true if collectorName is blacklisted in the handler

func (BaseHandler) KeepAliveInterval

func (base BaseHandler) KeepAliveInterval() int

KeepAliveInterval - return keep alive interval

func (BaseHandler) MaxBufferSize

func (base BaseHandler) MaxBufferSize() int

MaxBufferSize : the maximum number of metrics that should be buffered before sending

func (BaseHandler) MaxIdleConnectionsPerHost

func (base BaseHandler) MaxIdleConnectionsPerHost() int

MaxIdleConnectionsPerHost : return max idle connections per host

func (BaseHandler) Name

func (base BaseHandler) Name() string

Name : the name of the handler

func (BaseHandler) Prefix

func (base BaseHandler) Prefix() string

Prefix : the prefix (with punctuation) to use on each emitted metric

func (*BaseHandler) SetCollectorBlackList

func (base *BaseHandler) SetCollectorBlackList(blackList []string)

SetCollectorBlackList : Add collectors mentioned in the handler config to blacklist

func (*BaseHandler) SetCollectorChannels

func (base *BaseHandler) SetCollectorChannels(c map[string]chan metric.Metric)

SetCollectorChannels : the channels to handler listens for metrics on

func (*BaseHandler) SetCollectorWhiteList

func (base *BaseHandler) SetCollectorWhiteList(whiteList []string)

SetCollectorWhiteList : Add collectors mentioned in the handler config to the whitelist

func (*BaseHandler) SetDefaultDimensions

func (base *BaseHandler) SetDefaultDimensions(defaults map[string]string)

SetDefaultDimensions : set the defautl dimensions

func (*BaseHandler) SetInterval

func (base *BaseHandler) SetInterval(val int)

SetInterval : set the interval

func (*BaseHandler) SetKeepAliveInterval

func (base *BaseHandler) SetKeepAliveInterval(value int)

SetKeepAliveInterval : Set keep alive interval

func (*BaseHandler) SetMaxBufferSize

func (base *BaseHandler) SetMaxBufferSize(size int)

SetMaxBufferSize : set the buffer size

func (*BaseHandler) SetMaxIdleConnectionsPerHost

func (base *BaseHandler) SetMaxIdleConnectionsPerHost(value int)

SetMaxIdleConnectionsPerHost : Set maximum idle connections per host

func (*BaseHandler) SetPrefix

func (base *BaseHandler) SetPrefix(prefix string)

SetPrefix : any prefix that should be applied to the metrics name as they're sent it is appended without any punctuation, include your own

func (BaseHandler) String

func (base BaseHandler) String() string

String returns the handler name in a printable format.

type Graphite

type Graphite struct {
	BaseHandler
	// contains filtered or unexported fields
}

Graphite type

func (*Graphite) Configure

func (g *Graphite) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the Graphite handler

func (Graphite) Port

func (g Graphite) Port() string

Port returns the Graphite server's port number

func (*Graphite) Run

func (g *Graphite) Run()

Run runs the handler main loop

func (Graphite) Server

func (g Graphite) Server() string

Server returns the Graphite server's name or IP

type Handler

type Handler interface {
	Run()
	Configure(map[string]interface{})
	InitListeners(config.Config)

	// InternalMetrics is to publish a set of values
	// that are relevant to the handler itself.
	InternalMetrics() metric.InternalMetrics

	// taken care of by the base
	Name() string
	String() string
	Channel() chan metric.Metric

	CollectorChannels() map[string]chan metric.Metric
	SetCollectorChannels(map[string]chan metric.Metric)

	Interval() int
	SetInterval(int)

	MaxBufferSize() int
	SetMaxBufferSize(int)

	Prefix() string
	SetPrefix(string)

	DefaultDimensions() map[string]string
	SetDefaultDimensions(map[string]string)

	MaxIdleConnectionsPerHost() int
	SetMaxIdleConnectionsPerHost(int)

	KeepAliveInterval() int
	SetKeepAliveInterval(int)

	// Return true if collector
	// is blacklisted in the handler
	SetCollectorBlackList([]string)
	CollectorBlackList() map[string]bool
	IsCollectorBlackListed(string) (bool, bool)

	// Return true if collector
	// is whitelisted in the handler
	SetCollectorWhiteList([]string)
	CollectorWhiteList() map[string]bool
	IsCollectorWhiteListed(string) (bool, bool)
}

Handler defines the interface of a generic handler.

func New

func New(name string) Handler

New creates a new Handler based on the requested handler name.

func NewTest

func NewTest(
	channel chan metric.Metric,
	initialInterval int,
	initialBufferSize int,
	initialTimeout time.Duration,
	log *l.Entry) Handler

NewTest returns a new Test handler.

type InfluxDB

type InfluxDB struct {
	BaseHandler
	// contains filtered or unexported fields
}

InfluxDB type

func (*InfluxDB) Configure

func (i *InfluxDB) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the InfluxDB handler

func (InfluxDB) Port

func (i InfluxDB) Port() string

Port returns the InfluxDB server's port number

func (*InfluxDB) Run

func (i *InfluxDB) Run()

Run runs the handler main loop

func (InfluxDB) Server

func (i InfluxDB) Server() string

Server returns the InfluxDB server's name or IP

type Log

type Log struct {
	BaseHandler
}

Log type

func (*Log) Configure

func (h *Log) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the Log handler

func (*Log) Run

func (h *Log) Run()

Run runs the handler main loop

type OpenTSDBHandler

type OpenTSDBHandler struct {
	BaseHandler
	// contains filtered or unexported fields
}

OpenTSDBHandler type

func (*OpenTSDBHandler) Configure

func (h *OpenTSDBHandler) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the OpenTSDBHandler handler

func (OpenTSDBHandler) Port

func (h OpenTSDBHandler) Port() string

Port returns the Graphite server's port number

func (*OpenTSDBHandler) Run

func (h *OpenTSDBHandler) Run()

Run runs the handler main loop

func (OpenTSDBHandler) Server

func (h OpenTSDBHandler) Server() string

Server returns the OpenTSDBHandler server's name or IP

type Test

type Test struct {
	BaseHandler
}

Test type

func (*Test) Configure

func (h *Test) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the Test handler

func (*Test) Run

func (h *Test) Run()

Run runs the handler main loop

type ZmqBUF

type ZmqBUF struct {
	BaseHandler
	// contains filtered or unexported fields
}

ZmqBUF implements a simple way of reusing http connections

func (*ZmqBUF) Configure

func (h *ZmqBUF) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the InfluxDB handler

func (*ZmqBUF) Enqueue

func (h *ZmqBUF) Enqueue(m metric.Metric)

Enqueue puts metric into buffer

func (*ZmqBUF) Filter

func (h *ZmqBUF) Filter(f metric.Filter) ([]metric.Metric, bool)

Filter returns Values in the buffer which do not match the metric.Filter

func (*ZmqBUF) Match

func (h *ZmqBUF) Match(f metric.Filter) ([]metric.Metric, bool)

Match returns Values in the buffer which match the metric.Filter

func (ZmqBUF) Port

func (h ZmqBUF) Port() string

Port returns the server's port number

func (ZmqBUF) Retention

func (h ZmqBUF) Retention() int

Retention returns the rings retention time (in nanosec)

func (*ZmqBUF) Run

func (h *ZmqBUF) Run()

Run runs the handler main loop

func (ZmqBUF) SweepInterval

func (h ZmqBUF) SweepInterval() time.Duration

SweepInterval returns the rings retention time (in nanosec)

func (*ZmqBUF) Values

func (h *ZmqBUF) Values() ([]metric.Metric, bool)

Values returns all Values in the buffer

type ZmqPUB

type ZmqPUB struct {
	BaseHandler
	// contains filtered or unexported fields
}

ZmqPUB implements a simple way of reusing http connections

func (*ZmqPUB) Configure

func (h *ZmqPUB) Configure(configMap map[string]interface{})

Configure accepts the different configuration options for the InfluxDB handler

func (ZmqPUB) Port

func (h ZmqPUB) Port() string

Port returns the server's port number

func (*ZmqPUB) Run

func (h *ZmqPUB) Run()

Run runs the handler main loop

Jump to

Keyboard shortcuts

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