stats

package
v0.0.0-...-55f3543 Latest Latest
Warning

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

Go to latest
Published: May 10, 2016 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Gauge metric type
	Gauge = iota
	// Derive metric type
	Derive
	// Counter metric type
	Counter
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLStats

type MySQLStats struct {
	// contains filtered or unexported fields
}

MySQLStats implements statistics gathering from MySQL database.

func New

func New(connectionString string) (*MySQLStats, error)

New constructs MySQLStats object, returns error when fails. connectionString is passed to sql.Open(), please refer to sql module documentation to learn about syntax.

func (*MySQLStats) Close

func (mysql *MySQLStats) Close() error

Close closes sql resources.

func (*MySQLStats) GetInnodb

func (mysql *MySQLStats) GetInnodb() (Stats, error)

GetInnodb queries database for innodb statistics. If query succeeded appriopriate collection of stats is returned, otherwise error is returned.

func (*MySQLStats) GetMasterStatus

func (mysql *MySQLStats) GetMasterStatus() (Stats, error)

GetMasterStatus queries database for statistics related to it's master role. If query succeeded appriopriate collection of stats is returned, otherwise error is returned.

func (*MySQLStats) GetSlaveStatus

func (mysql *MySQLStats) GetSlaveStatus() (Stats, error)

GetSlaveStatus queries database for statistics related to it's slave role. If query succeeded appriopriate collection of stats is returned, otherwise error is returned.

func (*MySQLStats) GetStatus

func (mysql *MySQLStats) GetStatus(parseInnodb bool) (Stats, error)

GetStatus queries database for status (query is dependendt on mysql version). If query succeeded appriopriate collection of stats is returned, otherwise error is returned.

type Stat

type Stat struct {
	Value  int64
	Type   int
	IsNull bool
}

Stat describes single statistics. Value holds stat value. Type is either TYPE_GAUGE, TYPE_DERIVE or TYPE_COUNTER. IsNull indicates if value is null.

type Stats

type Stats map[string]Stat

Stats is collection of statistics accessible by name (which may include '/').

Jump to

Keyboard shortcuts

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