Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ByQueryTime ¶
type ByQueryTime []*mysqlLog.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
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 FileIntervalIter ¶
type FileIntervalIter struct {
// contains filtered or unexported fields
}
Implements IntervalIter:
func NewFileIntervalIter ¶
func NewFileIntervalIter(logger *pct.Logger, filename FilenameFunc, tickChan chan time.Time) *FileIntervalIter
func (*FileIntervalIter) IntervalChan ¶
func (i *FileIntervalIter) IntervalChan() chan *Interval
func (*FileIntervalIter) Start ¶
func (i *FileIntervalIter) Start()
func (*FileIntervalIter) Stop ¶
func (i *FileIntervalIter) Stop()
type FileIntervalIterFactory ¶
type FileIntervalIterFactory struct {
// contains filtered or unexported fields
}
func NewFileIntervalIterFactory ¶
func NewFileIntervalIterFactory(logChan chan *proto.LogEntry) *FileIntervalIterFactory
func (*FileIntervalIterFactory) Make ¶
func (f *FileIntervalIterFactory) Make(filename FilenameFunc, tickChan chan time.Time) IntervalIter
type Interval ¶
type Interval struct {
Number int
Filename string // slow_query_log_file
StartTime time.Time // UTC
StopTime time.Time // UTC
StartOffset int64 // bytes @ StartTime
EndOffset int64 // bytes @ StopTime
}
A slice of the MySQL slow log:
type IntervalIter ¶
type IntervalIter interface {
Start()
Stop()
IntervalChan() chan *Interval
}
Used by Manager.run() to start a Worker:
type IntervalIterFactory ¶
type IntervalIterFactory interface {
Make(filename FilenameFunc, tickChan chan time.Time) IntervalIter
}
Used by Manager.Start() to create an IntervalIter that ticks at Config.Interval minutes:
type Job ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func NewManager(logger *pct.Logger, mysqlFactory mysql.ConnectionFactory, clock ticker.Manager, iterFactory IntervalIterFactory, workerFactory WorkerFactory, spool data.Spooler, im *instance.Repo) *Manager
type Report ¶
type Report struct {
proto.ServiceInstance
StartTs time.Time // UTC
EndTs time.Time // UTC
SlowLogFile string // not slow_query_log_file if rotated
StartOffset int64 // parsing starts
EndOffset int64 // parsing stops, but...
StopOffset int64 // ...parsing didn't complete if stop < end
RunTime float64 // seconds
Global *mysqlLog.GlobalClass
Class []*mysqlLog.QueryClass
}
func MakeReport ¶
type Result ¶
type Result struct {
StopOffset int64
RunTime float64
Error string `json:",omitempty"`
Global *mysqlLog.GlobalClass
Classes []*mysqlLog.QueryClass
}
type SlowLogWorker ¶
type SlowLogWorker struct {
// contains filtered or unexported fields
}
func NewSlowLogWorker ¶
func NewSlowLogWorker(logger *pct.Logger, name string) *SlowLogWorker
func (*SlowLogWorker) Name ¶
func (w *SlowLogWorker) Name() string
func (*SlowLogWorker) Status ¶
func (w *SlowLogWorker) Status() string
type SlowLogWorkerFactory ¶
type SlowLogWorkerFactory struct {
// contains filtered or unexported fields
}
func NewSlowLogWorkerFactory ¶
func NewSlowLogWorkerFactory(logChan chan *proto.LogEntry) *SlowLogWorkerFactory
func (*SlowLogWorkerFactory) Make ¶
func (f *SlowLogWorkerFactory) Make(name string) Worker
type WorkerFactory ¶
Click to show internal directories.
Click to hide internal directories.