routers

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Rules            []Rule
	MaxRuleRecursion int
}

Config is a structure that contains router-specific config options

type DummyRouter

type DummyRouter struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

DummyRouter implements simple router That will just store everything in a map (with proper locking) It's only useful for unit tests and shouldn't be used in Production

func NewDummyRouter

func NewDummyRouter() *DummyRouter

NewDummyRouter will initialize router

func (*DummyRouter) GetData

func (r *DummyRouter) GetData() map[string]*carbon.Metric

GetData is a special function in DummyRouter that returns all internal data and resets the state

func (*DummyRouter) Reload

func (r *DummyRouter) Reload(senders []transport.Sender, config Config) bool

Reload will try to reload configuration of router. Returns true on success.

func (*DummyRouter) Route

func (r *DummyRouter) Route(payload carbon.Payload)

Route is the endpoint that should receive list of metrics

type Metrics

type Metrics struct {
	InfiniteRecursions uint64
	MetricsRouted      uint64
	MetricsRewritten   uint64
	RulesCacheMiss     uint64
	RulesCacheHit      uint64
}

Metrics contains all internal metrics

type RelayRouter

type RelayRouter struct {
	Config

	Metrics Metrics
	// contains filtered or unexported fields
}

RelayRouter describes internal router state.

func NewRelayRouter

func NewRelayRouter(senders []transport.Sender, config Config) *RelayRouter

NewRelayRouter will create a new router

func (*RelayRouter) Reload

func (r *RelayRouter) Reload(senders []transport.Sender, config Config) bool

Reload will try to reload configuration of router. Returns true on success.

func (*RelayRouter) Route

func (r *RelayRouter) Route(payload carbon.Payload)

Route allows to route bunch of metrics

type Router

type Router interface {
	Route(payload carbon.Payload)
	Reload(senders []transport.Sender, config Config) bool
}

Router is an interface for all possible routers

type Rule

type Rule struct {
	Regex                 string
	StartsWith            string
	RewriteTo             string
	Destinations          []string
	SaveOriginalOnRewrite bool
	LastIfMatched         bool
	Blackhole             bool
	LogOnReceive          bool
	// contains filtered or unexported fields
}

Rule is a generic struct that will describe all possible rules

Jump to

Keyboard shortcuts

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