Documentation ¶
Index ¶
- Variables
- type ClusterInstanceKey
- type ClusterProbes
- type InstanceKey
- func (i *InstanceKey) DisplayString() string
- func (i *InstanceKey) Equals(other *InstanceKey) bool
- func (i *InstanceKey) IsSelf() bool
- func (i *InstanceKey) IsValid() bool
- func (i *InstanceKey) SmallerThan(other *InstanceKey) bool
- func (i InstanceKey) String() string
- func (i *InstanceKey) StringCode() string
- type InstanceMetricResultMap
- type Inventory
- type MetricsQueryType
- type MySQLThrottleMetric
- type Probe
- type Probes
Constants ¶
This section is empty.
Variables ¶
var SelfInstanceKey = &InstanceKey{Hostname: "(self)", Port: 1}
SelfInstanceKey is a special indicator for "this instance", e.g. denoting the MySQL server associated with local tablet The values of this key are immaterial and are intentionally descriptive
Functions ¶
This section is empty.
Types ¶
type ClusterInstanceKey ¶
type ClusterInstanceKey struct { ClusterName string Key InstanceKey }
ClusterInstanceKey combines a cluster name with an instance key
func GetClusterInstanceKey ¶
func GetClusterInstanceKey(clusterName string, key *InstanceKey) ClusterInstanceKey
GetClusterInstanceKey creates a ClusterInstanceKey object
type ClusterProbes ¶
type ClusterProbes struct { ClusterName string IgnoreHostsCount int IgnoreHostsThreshold float64 InstanceProbes *Probes }
ClusterProbes has the probes for a specific cluster
type InstanceKey ¶
InstanceKey is an instance indicator, identified by hostname and port
func ParseInstanceKey ¶
func ParseInstanceKey(hostPort string, defaultPort int) (*InstanceKey, error)
ParseInstanceKey will parse an InstanceKey from a string representation such as 127.0.0.1:3306 or some.hostname `defaultPort` is used if `hostPort` does not include a port.
func (*InstanceKey) DisplayString ¶
func (i *InstanceKey) DisplayString() string
DisplayString returns a user-friendly string representation of this key
func (*InstanceKey) Equals ¶
func (i *InstanceKey) Equals(other *InstanceKey) bool
Equals tests equality between this key and another key
func (*InstanceKey) IsSelf ¶ added in v0.10.0
func (i *InstanceKey) IsSelf() bool
IsSelf checks if this is the special "self" instance key
func (*InstanceKey) IsValid ¶
func (i *InstanceKey) IsValid() bool
IsValid uses simple heuristics to see whether this key represents an actual instance
func (*InstanceKey) SmallerThan ¶
func (i *InstanceKey) SmallerThan(other *InstanceKey) bool
SmallerThan returns true if this key is dictionary-smaller than another. This is used for consistent sorting/ordering; there's nothing magical about it.
func (InstanceKey) String ¶
func (i InstanceKey) String() string
String returns a user-friendly string representation of this key
func (*InstanceKey) StringCode ¶
func (i *InstanceKey) StringCode() string
StringCode returns an official string representation of this key
type InstanceMetricResultMap ¶
type InstanceMetricResultMap map[ClusterInstanceKey]base.MetricResult
InstanceMetricResultMap maps a cluster-instance to a result
type Inventory ¶
type Inventory struct { ClustersProbes map[string](*Probes) IgnoreHostsCount map[string]int IgnoreHostsThreshold map[string]float64 InstanceKeyMetrics InstanceMetricResultMap }
Inventory has the operational data about probes, their metrics, and relevant configuration
type MetricsQueryType ¶ added in v0.10.0
type MetricsQueryType int
MetricsQueryType indicates the type of metrics query on MySQL backend. See following.
const ( // MetricsQueryTypeDefault indictes the default, internal implementation. Specifically, our throttler runs a replication lag query MetricsQueryTypeDefault MetricsQueryType = iota // MetricsQueryTypeShowGlobal indicatesa SHOW GLOBAL (STATUS|VARIABLES) query MetricsQueryTypeShowGlobal // MetricsQueryTypeSelect indicates a custom SELECT query MetricsQueryTypeSelect // MetricsQueryTypeUnknown is an unknown query type, which we cannot run. This is an error MetricsQueryTypeUnknown )
func GetMetricsQueryType ¶ added in v0.10.0
func GetMetricsQueryType(query string) MetricsQueryType
GetMetricsQueryType analyzes the type of a metrics query
type MySQLThrottleMetric ¶
type MySQLThrottleMetric struct { ClusterName string Key InstanceKey Value float64 Err error }
MySQLThrottleMetric has the probed metric for a mysql instance
func NewMySQLThrottleMetric ¶
func NewMySQLThrottleMetric() *MySQLThrottleMetric
NewMySQLThrottleMetric creates a new MySQLThrottleMetric
func ReadThrottleMetric ¶
func ReadThrottleMetric(probe *Probe, clusterName string, overrideGetMetricFunc func() *MySQLThrottleMetric) (mySQLThrottleMetric *MySQLThrottleMetric)
ReadThrottleMetric returns a metric for the given probe. Either by explicit query or via SHOW REPLICA STATUS
func (*MySQLThrottleMetric) Get ¶
func (metric *MySQLThrottleMetric) Get() (float64, error)
Get implements MetricResult
func (*MySQLThrottleMetric) GetClusterInstanceKey ¶
func (metric *MySQLThrottleMetric) GetClusterInstanceKey() ClusterInstanceKey
GetClusterInstanceKey returns the ClusterInstanceKey part of the metric
type Probe ¶
type Probe struct { Key InstanceKey MetricQuery string Tablet *topodatapb.Tablet TabletHost string TabletPort int CacheMillis int QueryInProgress int64 }
Probe is the minimal configuration required to connect to a MySQL server