Documentation ¶
Index ¶
- func Api(config ApiConfig, tiers *[]Tier, blacklisted *map[string]map[string]int64)
- func Blacklist(updates chan BlacklistItem, blacklisted *map[string]map[string]int64)
- func BuildTiers(tiers *[]Tier)
- func Encode(packet collectd.Packet) []byte
- func ExpvarHandler(w http.ResponseWriter, r *http.Request)
- func Filter(config FilterConfig, raw chan collectd.Packet, filtered chan collectd.Packet, ...)
- func Listen(config ListenConfig, c chan collectd.Packet)
- func Measure(config MeasureConfig, chans map[string]chan collectd.Packet, tiers *[]Tier)
- func MetricName(packet collectd.Packet) string
- func Send(tiers *[]Tier, filtered chan collectd.Packet)
- func TierLookup(params martini.Params, req *http.Request, tiers *[]Tier) []byte
- type ApiConfig
- type BlacklistItem
- type Config
- type Duration
- type FetchConfig
- type FilterConfig
- type ListenConfig
- type MeasureConfig
- type Tier
- type TierConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Blacklist ¶
func Blacklist(updates chan BlacklistItem, blacklisted *map[string]map[string]int64)
func BuildTiers ¶
func BuildTiers(tiers *[]Tier)
BuildTiers sets up tiers so it's ready to dispatch metrics
func ExpvarHandler ¶
func ExpvarHandler(w http.ResponseWriter, r *http.Request)
func Filter ¶
func Filter(config FilterConfig, raw chan collectd.Packet, filtered chan collectd.Packet, blacklist chan BlacklistItem)
func Listen ¶
func Listen(config ListenConfig, c chan collectd.Packet)
Listen takes collectd network packets and breaks them into individual samples.
func Measure ¶
func Measure(config MeasureConfig, chans map[string]chan collectd.Packet, tiers *[]Tier)
func MetricName ¶
Types ¶
type BlacklistItem ¶
type Config ¶
type Config struct { Listen ListenConfig Filter FilterConfig Tiers map[string]TierConfig Api ApiConfig Fetch FetchConfig Measure MeasureConfig }
type Duration ¶
func (*Duration) UnmarshalText ¶
type FetchConfig ¶
type FetchConfig struct { Bind string ProxyTimeout Duration `toml:"proxy_timeout"` // FIXME(lindsay): RemotePort is a bit of a code smell. // Ideally every target could define its own port for collectd + Visage. RemotePort string `toml:"remote_port"` }
func (*FetchConfig) Timeout ¶
func (f *FetchConfig) Timeout() time.Duration
Helper function to provide a default timeout value
type FilterConfig ¶
type FilterConfig struct {
Blacklist string
}
type ListenConfig ¶
type MeasureConfig ¶
type MeasureConfig struct {
TickInterval Duration `toml:"interval"`
}
func (*MeasureConfig) Interval ¶
func (m *MeasureConfig) Interval() time.Duration
Helper function to provide a default interval value
type Tier ¶
type Tier struct { Name string `json:"name"` Targets []string `json:"targets"` Hash *consistent.Consistent `json:"-"` Shadows map[string]string `json:"shadows"` // map[target]map[sample host]map[sample metric name]last dispatched Mappings map[string]map[string]map[string]int64 `json:"routes"` Connections map[string]net.Conn `json:"connections,nil"` VirtualReplicas int `json:"virtual_replicas"` }
func (*Tier) SetMagicVirtualReplicaNumber ¶
SetMagicVirtualReplicaNumber sets the number of virtual replicas on the hash.
Pass it the number of targets in a tier, and it looks up the optimal number of virtual replicas in the table of magic numbers and uses that on the hash.
The magic numbers are determined from the results output in consistent_test.go.
There are problems with this approach:
- You can't change the number of virtual replicas on the hash after you've added sites to the hash.
- If the number of connections actually established is different to the number of virtual replicas we set on the hash, we could get poor hashing performance.
For example, if you tell SetMagicVirtualReplicaNumber you have 12 targets and successfully connect to all of them on boot, your magic number will be 11. But if you can't connect to even one of them, your magic number will be 100, which will provide worse hashing performance.
type TierConfig ¶
type TierConfig struct {
Targets []string
}