Documentation
¶
Index ¶
- Constants
- func Reset()
- type Configuration
- type ConfigurationSettings
- type HAProxyConfigurationSettings
- type HostPort
- type MySQLClusterConfigurationSettings
- type MySQLConfigurationSettings
- type ProxySQLConfigurationSettings
- type StaticHostsConfigurationSettings
- type StoresSettings
- type VitessConfigurationSettings
Constants ¶
const DefaultMySQLPort = 3306
const ProxySQLDefaultDatabase = "stats"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Configuration ¶
type Configuration struct {
// contains filtered or unexported fields
}
Configuration struct stores the readFileNames and points to the settings which are the configuration parameters used in the application. see ConfigurationSettings for the available settings. Read file names are also stored to allow configuration reloading.
func Instance ¶
func Instance() *Configuration
Instance returns the global instance of Configuration
func (*Configuration) Read ¶
func (config *Configuration) Read(fileNames ...string) error
Read reads configuration from all given files, in order of input. Each file can override the properties of the previous files Initially, the settings are the defult ones defined by newConfigurationSettings
func (*Configuration) Reload ¶
func (config *Configuration) Reload() error
Reload re-reads configuration from last used files
type ConfigurationSettings ¶
type ConfigurationSettings struct {
ListenPort int
DataCenter string
Environment string
Domain string
RaftBind string
RaftDataDir string
DefaultRaftPort int // if a RaftNodes entry does not specify port, use this one
RaftNodes []string // Raft nodes to make initial connection with
BackendMySQLHost string
BackendMySQLPort int
BackendMySQLSchema string
BackendMySQLUser string
BackendMySQLPassword string
BackendMySQLCollation string // if specified, use this collation instead of charset when connecting to MySQL backend
MemcacheServers []string // if given, freno will report to aggregated values to given memcache
MemcachePath string // use as prefix to metric path in memcache key, e.g. if `MemcachePath` is "myprefix" the key would be "myprefix/mysql/maincluster". Default: "freno"
EnableProfiling bool // enable pprof profiling http api
Stores StoresSettings
}
ConfigurationSettings models a set of configurable values, that can be provided by the user via one or several JSON formatted files.
Some of the settinges have reasonable default values, and some other (like database credentials) are strictly expected from user.
func Settings ¶
func Settings() *ConfigurationSettings
Settings returns the settings of the global instance of Configuration
type HAProxyConfigurationSettings ¶
func (*HAProxyConfigurationSettings) GetProxyAddresses ¶
func (settings *HAProxyConfigurationSettings) GetProxyAddresses() (addresses [](*url.URL), err error)
func (*HAProxyConfigurationSettings) IsEmpty ¶
func (settings *HAProxyConfigurationSettings) IsEmpty() bool
type HostPort ¶
func ParseHostPort ¶
type MySQLClusterConfigurationSettings ¶
type MySQLClusterConfigurationSettings struct {
User string // override MySQLConfigurationSettings's, or leave empty to inherit those settings
Password string // override MySQLConfigurationSettings's, or leave empty to inherit those settings
MetricQuery string // override MySQLConfigurationSettings's, or leave empty to inherit those settings
CacheMillis int // override MySQLConfigurationSettings's, or leave empty to inherit those settings
ThrottleThreshold float64 // override MySQLConfigurationSettings's, or leave empty to inherit those settings
Port int // Specify if different than 3306 or if different than specified by MySQLConfigurationSettings
IgnoreHostsCount int // Number of hosts that can be skipped/ignored even on error or on exceeding theesholds
IgnoreHostsThreshold float64 // Threshold beyond which IgnoreHostsCount applies (default: 0)
HttpCheckPort int // Specify if different than specified by MySQLConfigurationSettings. -1 to disable HTTP check
HttpCheckPath string // Specify if different than specified by MySQLConfigurationSettings
IgnoreHosts []string // override MySQLConfigurationSettings's, or leave empty to inherit those settings
HAProxySettings HAProxyConfigurationSettings // If list of servers is to be acquired via HAProxy, provide this field
ProxySQLSettings ProxySQLConfigurationSettings // If list of servers is to be acquired via ProxySQL, provide this field
VitessSettings VitessConfigurationSettings // If list of servers is to be acquired via Vitess, provide this field
StaticHostsSettings StaticHostsConfigurationSettings
}
type MySQLConfigurationSettings ¶
type MySQLConfigurationSettings struct {
User string
Password string
MetricQuery string
CacheMillis int // optional, if defined then probe result will be cached, and future probes may use cached value
ThrottleThreshold float64
Port int // Specify if different than 3306; applies to all clusters
IgnoreDialTcpErrors bool // Skip hosts where a metric cannot be retrieved due to TCP dial errors
IgnoreHostsCount int // Number of hosts that can be skipped/ignored even on error or on exceeding theesholds
IgnoreHostsThreshold float64 // Threshold beyond which IgnoreHostsCount applies (default: 0)
HttpCheckPort int // port for HTTP check. -1 to disable.
HttpCheckPath string // If non-empty, requires HttpCheckPort
IgnoreHosts []string // If non empty, substrings to indicate hosts to be ignored/skipped
ProxySQLAddresses []string // A list of ProxySQL instances to query for hosts
ProxySQLUser string // ProxySQL stats username
ProxySQLPassword string // ProxySQL stats password
VitessCells []string // Name of the Vitess cells for polling tablet hosts
Collation string // MySQL collation to use for stores, replaces charset if specified
Clusters map[string](*MySQLClusterConfigurationSettings) // cluster name -> cluster config
}
type ProxySQLConfigurationSettings ¶ added in v1.1.0
type ProxySQLConfigurationSettings struct {
Addresses []string
User string
Password string
HostgroupID uint
IgnoreServerTTLSecs uint
}
func (ProxySQLConfigurationSettings) AddressToDSN ¶ added in v1.1.0
func (settings ProxySQLConfigurationSettings) AddressToDSN(address string) string
func (*ProxySQLConfigurationSettings) IsEmpty ¶ added in v1.1.0
func (settings *ProxySQLConfigurationSettings) IsEmpty() bool
type StaticHostsConfigurationSettings ¶
type StaticHostsConfigurationSettings struct {
Hosts []string // a host can be "hostname" or "hostname:port"
}
func (*StaticHostsConfigurationSettings) IsEmpty ¶
func (settings *StaticHostsConfigurationSettings) IsEmpty() bool
type StoresSettings ¶
type StoresSettings struct {
MySQL MySQLConfigurationSettings // Any and all MySQL setups go here
}