mysql

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterInstanceKey

type ClusterInstanceKey struct {
	ClusterName string
	Key         InstanceKey
}

ClusterInstanceKey combines a cluster name with an instance key

func GetClusterInstanceKey

func GetClusterInstanceKey(clusterName string, key *InstanceKey) ClusterInstanceKey

GetClusterInstanceKey creates a ClusterInstanceKey object

type ClusterProbes

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

ClusterProbes has the probes for a specific cluster

type InstanceKey

type InstanceKey struct {
	Hostname string
	Port     int
}

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

DisplayString returns a user-friendly string representation of this key

func (*InstanceKey) Equals

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

Equals tests equality between this key and another key

func (*InstanceKey) IsValid

func (i *InstanceKey) IsValid() bool

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

func (*InstanceKey) SmallerThan

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

String returns a user-friendly string representation of this key

func (*InstanceKey) StringCode

func (i *InstanceKey) StringCode() string

StringCode returns an official string representation of this key

type InstanceMetricResultMap

type InstanceMetricResultMap map[ClusterInstanceKey]base.MetricResult

InstanceMetricResultMap maps a cluster-instance to a result

type Inventory

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

Inventory has the operational data about probes, their metrics, and relevant configuration

func NewInventory

func NewInventory() *Inventory

NewInventory creates a Inventory

type MySQLThrottleMetric

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

MySQLThrottleMetric has the probed metric for a mysql instance

func NewMySQLThrottleMetric

func NewMySQLThrottleMetric() *MySQLThrottleMetric

NewMySQLThrottleMetric creates a new 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)

Get implements MetricResult

func (*MySQLThrottleMetric) GetClusterInstanceKey

func (metric *MySQLThrottleMetric) GetClusterInstanceKey() ClusterInstanceKey

GetClusterInstanceKey returns the ClusterInstanceKey part of the metric

type Probe

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

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

func NewProbe

func NewProbe() *Probe

NewProbe creates Probe

func (*Probe) Duplicate

func (p *Probe) Duplicate() *Probe

Duplicate duplicates this probe, including credentials

func (*Probe) DuplicateCredentials

func (p *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 (p *Probe) Equals(other *Probe) bool

Equals checks if this probe has same instance key as another

func (*Probe) GetDBUri

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

GetDBUri returns the DB URI for the mysql server indicated by this probe

func (*Probe) String

func (p *Probe) String() string

String returns a human readable string of this struct

type Probes

type Probes map[InstanceKey](*Probe)

Probes maps instances to probe(s)

func NewProbes

func NewProbes() *Probes

NewProbes creates Probes

Jump to

Keyboard shortcuts

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