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