mysql

package
v1.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 25, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMySQLPort = 3306
)

Variables

This section is empty.

Functions

func MySQLHttpCheckHashKey

func MySQLHttpCheckHashKey(clusterName string, key *InstanceKey) string

Types

type ClusterInstanceHttpCheckResultMap

type ClusterInstanceHttpCheckResultMap map[string]int

type ClusterInstanceKey

type ClusterInstanceKey struct {
	ClusterName string
	Key         InstanceKey
}

func GetClusterInstanceKey

func GetClusterInstanceKey(clusterName string, key *InstanceKey) ClusterInstanceKey

func (ClusterInstanceKey) HashCode

func (c ClusterInstanceKey) HashCode() string

type ClusterProbes

type ClusterProbes struct {
	ClusterName          string
	IgnoreHostsCount     int
	IgnoreHostsThreshold float64
	InstanceProbes       *Probes
}

type InstanceKey

type InstanceKey struct {
	Hostname string
	Port     int
}

InstanceKey is an instance indicator, identifued 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 (this *InstanceKey) DisplayString() string

DisplayString returns a user-friendly string representation of this key

func (*InstanceKey) Equals

func (this *InstanceKey) Equals(other *InstanceKey) bool

Equals tests equality between this key and another key

func (*InstanceKey) IsValid

func (this *InstanceKey) IsValid() bool

IsValid uses simple heuristics to see whether this key represents an actual instance

func (*InstanceKey) SmallerThan

func (this *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 (this InstanceKey) String() string

String returns a user-friendly string representation of this key

func (*InstanceKey) StringCode

func (this *InstanceKey) StringCode() string

StringCode returns an official string representation of this key

type InstanceMetricResultMap

type InstanceMetricResultMap map[ClusterInstanceKey]base.MetricResult

type MySQLHttpCheck

type MySQLHttpCheck struct {
	ClusterName string
	Key         InstanceKey
	CheckResult int
}

func CheckHttp

func CheckHttp(clusterName string, probe *Probe) (httpCheckResult *MySQLHttpCheck)

func NewMySQLHttpCheck

func NewMySQLHttpCheck(clusterName string, instanceKey *InstanceKey, checkResult int) *MySQLHttpCheck

func (*MySQLHttpCheck) HashKey

func (check *MySQLHttpCheck) HashKey() string

type MySQLInventory

type MySQLInventory struct {
	ClustersProbes            map[string](*Probes)
	IgnoreHostsCount          map[string]int
	IgnoreHostsThreshold      map[string]float64
	InstanceKeyMetrics        InstanceMetricResultMap
	ClusterInstanceHttpChecks ClusterInstanceHttpCheckResultMap
}

func NewMySQLInventory

func NewMySQLInventory() *MySQLInventory

type MySQLThrottleMetric

type MySQLThrottleMetric struct {
	ClusterName string
	Key         InstanceKey
	Value       float64
	Err         error
}

func NewMySQLThrottleMetric

func NewMySQLThrottleMetric() *MySQLThrottleMetric

func ReadThrottleMetric

func ReadThrottleMetric(probe *Probe, clusterName string) (mySQLThrottleMetric *MySQLThrottleMetric)

ReadThrottleMetric returns replication lag for a given connection config; either by explicit query or via SHOW SLAVE STATUS

func (*MySQLThrottleMetric) Get

func (metric *MySQLThrottleMetric) Get() (float64, error)

func (*MySQLThrottleMetric) GetClusterInstanceKey

func (metric *MySQLThrottleMetric) GetClusterInstanceKey() ClusterInstanceKey

func (*MySQLThrottleMetric) HashCode

func (metric *MySQLThrottleMetric) HashCode() string

type Probe

type Probe struct {
	Key                 InstanceKey
	User                string
	Password            string
	MetricQuery         string
	CacheMillis         int
	QueryInProgress     int64
	HttpCheckPort       int
	HttpCheckPath       string
	HttpCheckInProgress int64
}

Probe is the minimal configuration required to connect to a MySQL server

func NewProbe

func NewProbe() *Probe

func (*Probe) Duplicate

func (probe *Probe) Duplicate() *Probe

func (*Probe) DuplicateCredentials

func (probe *Probe) DuplicateCredentials(key InstanceKey) *Probe

DuplicateCredentials creates a new connection config with given key and with same credentials as this config

func (*Probe) Equals

func (probe *Probe) Equals(other *Probe) bool

func (*Probe) GetDBUri

func (probe *Probe) GetDBUri(databaseName string) string

func (*Probe) String

func (probe *Probe) String() string

type Probes

type Probes map[InstanceKey](*Probe)

func NewProbes

func NewProbes() *Probes

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL