Documentation ¶
Index ¶
- Constants
- func ValidateConfig(config *Config) error
- type Analyzer
- type AnalyzerFactory
- type AnalyzerInstance
- type ByQueryTime
- type Config
- type Interval
- type IntervalIter
- type IntervalIterFactory
- type Manager
- type RealAnalyzer
- func (a *RealAnalyzer) Config() Config
- func (a *RealAnalyzer) SetConfig(config Config)
- func (a *RealAnalyzer) Start() error
- func (a *RealAnalyzer) Status() map[string]string
- func (a *RealAnalyzer) Stop() error
- func (a *RealAnalyzer) String() string
- func (a *RealAnalyzer) TakeOverPerconaServerRotation() error
- type Report
- type Result
- type Worker
Constants ¶
const MIN_SLOWLOG_ROTATION_SIZE = 4096
Variables ¶
This section is empty.
Functions ¶
func ValidateConfig ¶ added in v1.0.5
Types ¶
type Analyzer ¶ added in v1.0.11
type Analyzer interface { Start() error Stop() error Status() map[string]string String() string Config() Config SetConfig(Config) }
An Analyzer runs a Worker at each Interval. Analyzers are responsible for MySQL: configuring, restarts, etc. The Worker is only ran when MySQL is configured and ready. Analyzers are also responsible for making Reports from the Results returned by Workers. The Worker determines the type of Analyzer: slowlog or perfschema. Analyzers are ran by the QAN Manager.
type AnalyzerFactory ¶ added in v1.0.11
type AnalyzerFactory interface {
Make(config Config, name string, mysqlConn mysql.Connector, restartChan <-chan bool, tickChan chan time.Time) Analyzer
}
An AnalyzerFactory makes an Analyzer, real or mock.
type AnalyzerInstance ¶ added in v1.0.11
type AnalyzerInstance struct {
// contains filtered or unexported fields
}
An AnalyzerInstnace is an Analyzer ran by a Manager, one per MySQL instance as configured.
type ByQueryTime ¶
type ByQueryTime []*event.QueryClass
func (ByQueryTime) Len ¶
func (a ByQueryTime) Len() int
func (ByQueryTime) Less ¶
func (a ByQueryTime) Less(i, j int) bool
func (ByQueryTime) Swap ¶
func (a ByQueryTime) Swap(i, j int)
type Config ¶
type Config struct { proto.ServiceInstance // Manager CollectFrom string // "slowlog" or "perfschema" Start []mysql.Query Stop []mysql.Query MaxWorkers int Interval uint // minutes, "How often to report" MaxSlowLogSize int64 // bytes, 0 = no max RemoveOldSlowLogs bool // after rotating for MaxSlowLogSize // Worker ExampleQueries bool // only fingerprints if false WorkerRunTime uint // seconds // Report ReportLimit uint }
type Interval ¶
type Interval struct { Number int StartTime time.Time // UTC StopTime time.Time // UTC // slowlog Filename string // slow_query_log_file StartOffset int64 // bytes @ StartTime EndOffset int64 // bytes @ StopTime }
An Interval represents a period during which queries are fetched, aggregated, and reported. Intervals are created and sent by an IntervalIter. Analyzers use Intervals to set up and run Workers.
type IntervalIter ¶
type IntervalIter interface { Start() Stop() IntervalChan() chan *Interval TickChan() chan time.Time }
An IntervalIter sends Intervals.
type IntervalIterFactory ¶
type IntervalIterFactory interface {
Make(analyzerType string, mysqlConn mysql.Connector, tickChan chan time.Time) IntervalIter
}
An IntervalIterFactory makes an IntervalIter, real or mock.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
A Manager runs AnalyzerInstances, one per MySQL instance as configured.
func NewManager ¶
type RealAnalyzer ¶ added in v1.0.11
type RealAnalyzer struct {
// contains filtered or unexported fields
}
func NewRealAnalyzer ¶ added in v1.0.11
func (*RealAnalyzer) Config ¶ added in v1.0.12
func (a *RealAnalyzer) Config() Config
func (*RealAnalyzer) SetConfig ¶ added in v1.0.12
func (a *RealAnalyzer) SetConfig(config Config)
func (*RealAnalyzer) Start ¶ added in v1.0.11
func (a *RealAnalyzer) Start() error
func (*RealAnalyzer) Status ¶ added in v1.0.11
func (a *RealAnalyzer) Status() map[string]string
func (*RealAnalyzer) Stop ¶ added in v1.0.11
func (a *RealAnalyzer) Stop() error
func (*RealAnalyzer) String ¶ added in v1.0.11
func (a *RealAnalyzer) String() string
func (*RealAnalyzer) TakeOverPerconaServerRotation ¶ added in v1.0.12
func (a *RealAnalyzer) TakeOverPerconaServerRotation() error
Disable Percona Server slow log rotation and handle internally using the max_slowlog_size value. The slow log worker must rotate slow logs by itself to ensure full and proper parsing across rotations.
type Report ¶
type Report struct { proto.ServiceInstance // MySQL instance StartTs time.Time // of interval, UTC EndTs time.Time // of interval, UTC RunTime float64 // seconds parsing data Global *event.GlobalClass // metrics for all data Class []*event.QueryClass // per-class metrics // slow log: SlowLogFile string `json:",omitempty"` // not slow_query_log_file if rotated SlowLogFileSize int64 `json:",omitempty"` StartOffset int64 `json:",omitempty"` // parsing starts EndOffset int64 `json:",omitempty"` // parsing stops, but... StopOffset int64 `json:",omitempty"` // ...parsing didn't complete if stop < end }
Final QAN data struct, composed of a Result{} and metatdata, sent to the data.Spooler by the manager running the slow log or perfomance schema (pfs) parser.
type Result ¶
type Result struct { Global *event.GlobalClass // metrics for all data Class []*event.QueryClass // per-class metrics RunTime float64 // seconds parsing data, hopefully < interval StopOffset int64 // slow log offset where parsing stopped, should be <= end offset Error string `json:",omitempty"` }
Data for an interval from slow log or performance schema (pfs) parser, passed to MakeReport() which wraps it in a Report{} with metadata.