Documentation ¶
Index ¶
- type MysqlStatDBs
- func (s *MysqlStatDBs) Collect()
- func (s *MysqlStatDBs) FlushQueryResponseTime() error
- func (s *MysqlStatDBs) FormatGraphite(w io.Writer) error
- func (s *MysqlStatDBs) GetBackups()
- func (s *MysqlStatDBs) GetBinlogFiles()
- func (s *MysqlStatDBs) GetBinlogStats()
- func (s *MysqlStatDBs) GetGlobalStatus()
- func (s *MysqlStatDBs) GetInnodbStats()
- func (s *MysqlStatDBs) GetNumLongRunQueries()
- func (s *MysqlStatDBs) GetOldestQuery()
- func (s *MysqlStatDBs) GetOldestTrx()
- func (s *MysqlStatDBs) GetQueriesPerSecond()
- func (s *MysqlStatDBs) GetQueryResponseTime()
- func (s *MysqlStatDBs) GetReadOnly()
- func (s *MysqlStatDBs) GetSSL()
- func (s *MysqlStatDBs) GetSecurity()
- func (s *MysqlStatDBs) GetSessions()
- func (s *MysqlStatDBs) GetSlaveLag()
- func (s *MysqlStatDBs) GetSlaveStats()
- func (s *MysqlStatDBs) GetStackedQueries()
- func (s *MysqlStatDBs) GetVersion()
- type MysqlStatMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MysqlStatDBs ¶ added in v1.0.2
type MysqlStatDBs struct { util.MysqlStat Metrics *MysqlStatMetrics //collection of metrics MasterHostname string // contains filtered or unexported fields }
MysqlStatDBs represents collection of metrics and connection to database
func New ¶
func New(m *metrics.MetricContext, user, password, host, config string, options map[string]string) (*MysqlStatDBs, error)
New initializes mysqlstat arguments: metrics context, username, password, path to config file for mysql. username and password can be left as "" if a config file is specified. options is used to specify a separate timestamp table to gather replication lag (similar to pt-heartbeat). If options is empty, replication lag will be determined using SHOW SLAVE STATUS;
func (*MysqlStatDBs) Collect ¶ added in v1.0.2
func (s *MysqlStatDBs) Collect()
Collect launches metrics collectors. sql.DB is safe for concurrent use by multiple goroutines so launching each metric collector as its own goroutine is safe
func (*MysqlStatDBs) FlushQueryResponseTime ¶ added in v1.0.2
func (s *MysqlStatDBs) FlushQueryResponseTime() error
FlushQueryResponseTime flushes the Response Time Histogram
func (*MysqlStatDBs) FormatGraphite ¶ added in v1.0.2
func (s *MysqlStatDBs) FormatGraphite(w io.Writer) error
FormatGraphite returns []string of metric values of the form: "metric_name metric_value" This is the form that stats-collector uses to send messages to graphite
func (*MysqlStatDBs) GetBackups ¶ added in v1.0.2
func (s *MysqlStatDBs) GetBackups()
GetBackups collects information about backup processes TODO: Find a better method than parsing output from ps
func (*MysqlStatDBs) GetBinlogFiles ¶ added in v1.0.2
func (s *MysqlStatDBs) GetBinlogFiles()
GetBinlogFiles collects status on binary logs
func (*MysqlStatDBs) GetBinlogStats ¶ added in v1.0.2
func (s *MysqlStatDBs) GetBinlogStats()
GetBinlogStats collect statistics about binlog (position etc)
func (*MysqlStatDBs) GetGlobalStatus ¶ added in v1.0.2
func (s *MysqlStatDBs) GetGlobalStatus()
GetGlobalStatus collects information returned by global status
func (*MysqlStatDBs) GetInnodbStats ¶ added in v1.0.2
func (s *MysqlStatDBs) GetInnodbStats()
GetInnodbStats collects metrics related to InnoDB engine
func (*MysqlStatDBs) GetNumLongRunQueries ¶ added in v1.0.2
func (s *MysqlStatDBs) GetNumLongRunQueries()
GetNumLongRunQueries collects number of long running queries
func (*MysqlStatDBs) GetOldestQuery ¶ added in v1.0.2
func (s *MysqlStatDBs) GetOldestQuery()
GetOldestQuery collects the time of oldest query in seconds
func (*MysqlStatDBs) GetOldestTrx ¶ added in v1.0.2
func (s *MysqlStatDBs) GetOldestTrx()
GetOldestTrx collects information about oldest transaction
func (*MysqlStatDBs) GetQueriesPerSecond ¶ added in v1.0.2
func (s *MysqlStatDBs) GetQueriesPerSecond()
func (*MysqlStatDBs) GetQueryResponseTime ¶ added in v1.0.2
func (s *MysqlStatDBs) GetQueryResponseTime()
GetQueryResponseTime collects various query response times
func (*MysqlStatDBs) GetReadOnly ¶ added in v1.0.2
func (s *MysqlStatDBs) GetReadOnly()
func (*MysqlStatDBs) GetSSL ¶ added in v1.0.2
func (s *MysqlStatDBs) GetSSL()
GetSSL checks whether or not SSL is enabled
func (*MysqlStatDBs) GetSecurity ¶ added in v1.0.2
func (s *MysqlStatDBs) GetSecurity()
GetSecurity collects information about users without authentication
func (*MysqlStatDBs) GetSessions ¶ added in v1.0.2
func (s *MysqlStatDBs) GetSessions()
GetSessions collects statistics about sessions
func (*MysqlStatDBs) GetSlaveLag ¶ added in v1.0.2
func (s *MysqlStatDBs) GetSlaveLag()
GetSlaveLag determines replication lag by querying for the latest timestamp in a heartbeat table. (Similar to the table used in pt-heartbeat).
func (*MysqlStatDBs) GetSlaveStats ¶ added in v1.0.2
func (s *MysqlStatDBs) GetSlaveStats()
GetSlaveStats returns statistics regarding mysql replication
func (*MysqlStatDBs) GetStackedQueries ¶ added in v1.0.2
func (s *MysqlStatDBs) GetStackedQueries()
GetStackedQueries collects information about stacked queries. It can be used to detect application bugs which result in multiple instance of the same query "stacking up"/ executing at the same time
func (*MysqlStatDBs) GetVersion ¶ added in v1.0.2
func (s *MysqlStatDBs) GetVersion()
GetVersion collects version information about current instance version is of the form '1.2.34-56.7' or '9.8.76a-54.3-log' want to represent version in form '1.234567' or '9.876543'
type MysqlStatMetrics ¶
type MysqlStatMetrics struct { //GetSlave Stats SlaveSecondsBehindMaster *metrics.Gauge SlaveSeqFile *metrics.Gauge SlavePosition *metrics.Counter ReplicationRunning *metrics.Gauge RelayLogSpace *metrics.Gauge //GetGlobalStatus AbortedConnects *metrics.Counter BinlogCacheDiskUse *metrics.Counter BinlogCacheUse *metrics.Counter ComAlterTable *metrics.Counter ComBegin *metrics.Counter ComCommit *metrics.Counter ComCreateTable *metrics.Counter ComDelete *metrics.Counter ComDeleteMulti *metrics.Counter ComDropTable *metrics.Counter ComInsert *metrics.Counter ComInsertSelect *metrics.Counter ComReplace *metrics.Counter ComReplaceSelect *metrics.Counter ComRollback *metrics.Counter ComSelect *metrics.Counter ComUpdate *metrics.Counter ComUpdateMulti *metrics.Counter CreatedTmpDiskTables *metrics.Counter CreatedTmpFiles *metrics.Counter CreatedTmpTables *metrics.Counter InnodbLogOsWaits *metrics.Gauge InnodbRowLockWaits *metrics.Counter InnodbRowLockTimeAvg *metrics.Gauge InnodbRowLockTimeMax *metrics.Counter PreparedStmtCount *metrics.Gauge PreparedStmtPct *metrics.Gauge Queries *metrics.Counter SortMergePasses *metrics.Counter ThreadsConnected *metrics.Gauge Uptime *metrics.Counter ThreadsRunning *metrics.Gauge //GetOldestQueryS OldestQueryS *metrics.Gauge //GetOldestTrxS OldestTrxS *metrics.Gauge //BinlogFiles BinlogFiles *metrics.Gauge BinlogSize *metrics.Gauge //GetNumLongRunQueries ActiveLongRunQueries *metrics.Gauge //GetVersion Version *metrics.Gauge //GetBinlogStats BinlogSeqFile *metrics.Gauge BinlogPosition *metrics.Counter //GetStackedQueries IdenticalQueriesStacked *metrics.Gauge IdenticalQueriesMaxAge *metrics.Gauge //GetSessions ActiveSessions *metrics.Gauge BusySessionPct *metrics.Gauge CurrentSessions *metrics.Gauge CurrentConnectionsPct *metrics.Gauge LockedSessions *metrics.Gauge MaxConnections *metrics.Gauge SessionTablesLocks *metrics.Gauge SessionGlobalReadLocks *metrics.Gauge SessionsCopyingToTable *metrics.Gauge SessionsStatistics *metrics.Gauge UnauthenticatedSessions *metrics.Gauge //GetInnodbStats OSFileReads *metrics.Gauge OSFileWrites *metrics.Gauge AdaptiveHash *metrics.Gauge AvgBytesPerRead *metrics.Gauge BufferPoolHitRate *metrics.Gauge BufferPoolSize *metrics.Gauge CacheHitPct *metrics.Gauge InnodbCheckpointAge *metrics.Gauge InnodbCheckpointAgeTarget *metrics.Gauge DatabasePages *metrics.Gauge DictionaryCache *metrics.Gauge DictionaryMemoryAllocated *metrics.Gauge FileSystem *metrics.Gauge FreeBuffers *metrics.Gauge FsyncsPerSec *metrics.Gauge InnodbHistoryLinkList *metrics.Gauge InnodbLastCheckpointAt *metrics.Gauge LockSystem *metrics.Gauge InnodbLogFlushedUpTo *metrics.Gauge LogIOPerSec *metrics.Gauge InnodbLogSequenceNumber *metrics.Gauge InnodbMaxCheckpointAge *metrics.Gauge InnodbModifiedAge *metrics.Gauge ModifiedDBPages *metrics.Gauge OldDatabasePages *metrics.Gauge PageHash *metrics.Gauge PagesFlushedUpTo *metrics.Gauge PagesMadeYoung *metrics.Gauge PagesRead *metrics.Gauge InnodbLogWriteRatio *metrics.Gauge InnodbPendingCheckpointWrites *metrics.Gauge InnodbPendingLogWrites *metrics.Gauge PendingReads *metrics.Gauge PendingWritesLRU *metrics.Gauge ReadsPerSec *metrics.Gauge RecoverySystem *metrics.Gauge TotalMem *metrics.Gauge TotalMemByReadViews *metrics.Gauge TransactionID *metrics.Gauge InnodbTransactionsNotStarted *metrics.Gauge InnodbUndo *metrics.Gauge WritesPerSec *metrics.Gauge //GetBackups BackupsRunning *metrics.Gauge //GetSecurity UnsecureUsers *metrics.Gauge //Query response time metrics QueryResponsePctl50 *metrics.Gauge QueryResponsePctl75 *metrics.Gauge QueryResponsePctl90 *metrics.Gauge QueryResponsePctl95 *metrics.Gauge QueryResponsePctl99 *metrics.Gauge QueryResponsePctl999 *metrics.Gauge //GetSSL HasSSL *metrics.Gauge //GetReadOnly IsReadOnly *metrics.Gauge IsSuperReadOnly *metrics.Gauge //Queries Per Second QueriesPerSecond *metrics.Gauge }
MysqlStatMetrics represents metrics being collected about the server/database
func MysqlStatMetricsNew ¶
func MysqlStatMetricsNew(m *metrics.MetricContext) *MysqlStatMetrics
MysqlStatMetricsNew initializes metrics and registers with metriccontext