vitess.io/vitess@v0.16.2/go/vt/vttablet/tabletserver/throttle/mysql/mysql_inventory.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  	"vitess.io/vitess/go/vt/vttablet/tabletserver/throttle/base"
    11  )
    12  
    13  // ClusterInstanceKey combines a cluster name with an instance key
    14  type ClusterInstanceKey struct {
    15  	ClusterName string
    16  	Key         InstanceKey
    17  }
    18  
    19  // GetClusterInstanceKey creates a ClusterInstanceKey object
    20  func GetClusterInstanceKey(clusterName string, key *InstanceKey) ClusterInstanceKey {
    21  	return ClusterInstanceKey{ClusterName: clusterName, Key: *key}
    22  }
    23  
    24  // InstanceMetricResultMap maps a cluster-instance to a result
    25  type InstanceMetricResultMap map[ClusterInstanceKey]base.MetricResult
    26  
    27  // Inventory has the operational data about probes, their metrics, and relevant configuration
    28  type Inventory struct {
    29  	ClustersProbes       map[string](*Probes)
    30  	IgnoreHostsCount     map[string]int
    31  	IgnoreHostsThreshold map[string]float64
    32  	InstanceKeyMetrics   InstanceMetricResultMap
    33  }
    34  
    35  // NewInventory creates a Inventory
    36  func NewInventory() *Inventory {
    37  	inventory := &Inventory{
    38  		ClustersProbes:       make(map[string](*Probes)),
    39  		IgnoreHostsCount:     make(map[string]int),
    40  		IgnoreHostsThreshold: make(map[string]float64),
    41  		InstanceKeyMetrics:   make(map[ClusterInstanceKey]base.MetricResult),
    42  	}
    43  	return inventory
    44  }