Documentation ¶
Index ¶
- type DBStats
- type MysqlStatPerDB
- type MysqlStatPerTable
- type MysqlStatTables
- func (s *MysqlStatTables) CallByMethodName(name string) error
- func (s *MysqlStatTables) Close()
- func (s *MysqlStatTables) Collect()
- func (s *MysqlStatTables) FormatGraphite(w io.Writer) error
- func (s *MysqlStatTables) GetDBSizes()
- func (s *MysqlStatTables) GetTableSizes()
- func (s *MysqlStatTables) GetTableStatistics()
- func (s *MysqlStatTables) SetMaxConnections(maxConns int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DBStats ¶
type DBStats struct { Tables map[string]*MysqlStatPerTable Metrics *MysqlStatPerDB }
database stats struct contains metrics for databases and map to tables stats struct
type MysqlStatPerDB ¶
MysqlStatPerDB - metrics for each database
type MysqlStatPerTable ¶
type MysqlStatPerTable struct { SizeBytes *metrics.Gauge RowsRead *metrics.Counter RowsChanged *metrics.Counter RowsChangedXIndexes *metrics.Counter }
MysqlStatPerTable - metrics for each table
type MysqlStatTables ¶
MysqlStatTables - main struct that contains connection to database, metric context, and map to database stats struct
func New ¶
func New(m *metrics.MetricContext, user, password, host, config string) (*MysqlStatTables, error)
initializes mysqlstat takes as input: metrics context, username, password, path to config file for mysql. username and password can be left as "" if a config file is specified.
func (*MysqlStatTables) CallByMethodName ¶
func (s *MysqlStatTables) CallByMethodName(name string) error
CallByMethodName searches for a method implemented by s with name. Runs all methods that match names.
func (*MysqlStatTables) Collect ¶
func (s *MysqlStatTables) Collect()
collects metrics. sql.DB is thread safe so launching metrics collectors in their own goroutines is safe
func (*MysqlStatTables) FormatGraphite ¶
func (s *MysqlStatTables) FormatGraphite(w io.Writer) error
writes metrics in the form "metric_name metric_value" to the input writer
func (*MysqlStatTables) GetTableSizes ¶
func (s *MysqlStatTables) GetTableSizes()
gets sizes of tables within databases
func (*MysqlStatTables) GetTableStatistics ¶
func (s *MysqlStatTables) GetTableStatistics()
get table statistics: rows read, rows changed, rows changed x indices
func (*MysqlStatTables) SetMaxConnections ¶
func (s *MysqlStatTables) SetMaxConnections(maxConns int)
Set the max number of concurrent connections that the mysql client can use