tablestat

package
v0.0.0-...-229c351 Latest Latest
Warning

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

Go to latest
Published: May 15, 2015 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

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

type MysqlStatPerDB struct {
	SizeBytes *metrics.Gauge
}

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

type MysqlStatTables struct {
	DBs map[string]*DBStats
	// contains filtered or unexported fields
}

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) Close

func (s *MysqlStatTables) Close()

Closes connection with database

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) GetDBSizes

func (s *MysqlStatTables) GetDBSizes()

gets sizes of databases

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

Jump to

Keyboard shortcuts

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