vitess.io/vitess@v0.16.2/go/vt/vttablet/tabletserver/throttle/mysql/probe.go (about) 1 /* 2 Copyright 2017 GitHub Inc. 3 4 Licensed under MIT License. See https://github.com/github/freno/blob/master/LICENSE 5 */ 6 7 package mysql 8 9 import ( 10 "fmt" 11 ) 12 13 // Probe is the minimal configuration required to connect to a MySQL server 14 type Probe struct { 15 Key InstanceKey 16 MetricQuery string 17 TabletHost string 18 TabletPort int 19 CacheMillis int 20 QueryInProgress int64 21 } 22 23 // Probes maps instances to probe(s) 24 type Probes map[InstanceKey](*Probe) 25 26 // ClusterProbes has the probes for a specific cluster 27 type ClusterProbes struct { 28 ClusterName string 29 IgnoreHostsCount int 30 IgnoreHostsThreshold float64 31 InstanceProbes *Probes 32 } 33 34 // NewProbes creates Probes 35 func NewProbes() *Probes { 36 return &Probes{} 37 } 38 39 // NewProbe creates Probe 40 func NewProbe() *Probe { 41 config := &Probe{ 42 Key: InstanceKey{}, 43 } 44 return config 45 } 46 47 // String returns a human readable string of this struct 48 func (p *Probe) String() string { 49 return fmt.Sprintf("%s, tablet=%s:%d", p.Key.DisplayString(), p.TabletHost, p.TabletPort) 50 } 51 52 // Equals checks if this probe has same instance key as another 53 func (p *Probe) Equals(other *Probe) bool { 54 return p.Key.Equals(&other.Key) 55 }