-
Notifications
You must be signed in to change notification settings - Fork 2.1k
/
mysql_inventory.go
44 lines (36 loc) · 1.3 KB
/
mysql_inventory.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
/*
Copyright 2017 GitHub Inc.
Licensed under MIT License. See https://github.com/github/freno/blob/master/LICENSE
*/
package mysql
import (
"vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/base"
)
// ClusterInstanceKey combines a cluster name with an instance key
type ClusterInstanceKey struct {
ClusterName string
Key InstanceKey
}
// GetClusterInstanceKey creates a ClusterInstanceKey object
func GetClusterInstanceKey(clusterName string, key *InstanceKey) ClusterInstanceKey {
return ClusterInstanceKey{ClusterName: clusterName, Key: *key}
}
// InstanceMetricResultMap maps a cluster-instance to a result
type InstanceMetricResultMap map[ClusterInstanceKey]base.MetricResult
// Inventory has the operational data about probes, their metrics, and relevant configuration
type Inventory struct {
ClustersProbes map[string](*Probes)
IgnoreHostsCount map[string]int
IgnoreHostsThreshold map[string]float64
InstanceKeyMetrics InstanceMetricResultMap
}
// NewInventory creates a Inventory
func NewInventory() *Inventory {
inventory := &Inventory{
ClustersProbes: make(map[string](*Probes)),
IgnoreHostsCount: make(map[string]int),
IgnoreHostsThreshold: make(map[string]float64),
InstanceKeyMetrics: make(map[ClusterInstanceKey]base.MetricResult),
}
return inventory
}