Documentation
¶
Index ¶
- Constants
- func NewClickHouseRepo(config query.Config, conn *clickhouse.Conn) query.MonitorRepo
- func NewConfig(startTime, endTime time.Time, limit, offset int) query.Config
- func NewConfigWithDefault() query.Config
- func NewDASRepo(db middleware.Pool) query.DASRepo
- func NewDASRepoWithGlobal() query.DASRepo
- func NewEmptyQuery() query.Query
- func NewMySQLRepo(config query.Config, conn *mysql.Conn) query.MonitorRepo
- func NewService(config query.Config, dasRepo query.DASRepo) query.Service
- func NewServiceWithDefault(config query.Config) query.Service
- type ClickhouseRepo
- func (cr *ClickhouseRepo) Close() error
- func (cr *ClickhouseRepo) GetByDBName(serviceName, dbName string) ([]query.Query, error)
- func (cr *ClickhouseRepo) GetBySQLID(serviceName, sqlID string) (query.Query, error)
- func (cr *ClickhouseRepo) GetByServiceNames(serviceNames []string) ([]query.Query, error)
- type Config
- func (c *Config) GetEndTime() time.Time
- func (c *Config) GetLimit() int
- func (c *Config) GetOffset() int
- func (c *Config) GetStartTime() time.Time
- func (c *Config) IsValid() bool
- func (c *Config) SetEndTime(endTime time.Time)
- func (c *Config) SetLimit(limit int)
- func (c *Config) SetOffset(offset int)
- func (c *Config) SetStartTime(startTime time.Time)
- type DASRepo
- type MySQLRepo
- type Querier
- func (q *Querier) GetByDBID(dbID int) ([]query.Query, error)
- func (q *Querier) GetByMySQLClusterID(mysqlClusterID int) ([]query.Query, error)
- func (q *Querier) GetByMySQLServerID(mysqlServerID int) ([]query.Query, error)
- func (q *Querier) GetBySQLID(mysqlServerID int, sqlID string) ([]query.Query, error)
- type Query
- func (q *Query) GetAvgExecTime() float64
- func (q *Query) GetDBName() string
- func (q *Query) GetExample() string
- func (q *Query) GetExecCount() int
- func (q *Query) GetFingerprint() string
- func (q *Query) GetRowsExaminedMax() int
- func (q *Query) GetSQLID() string
- func (q *Query) GetTotalExecTime() float64
- func (q *Query) SetDBName(dbName string)
- type Service
- func (s *Service) GetByDBID(dbID int) error
- func (s *Service) GetByHostInfo(hostIP string, portNum int) error
- func (s *Service) GetByMySQLClusterID(mysqlClusterID int) error
- func (s *Service) GetByMySQLServerID(mysqlServerID int) error
- func (s *Service) GetBySQLID(mysqlServerID int, sqlID string) error
- func (s *Service) GetConfig() query.Config
- func (s *Service) GetQueries() []query.Query
- func (s *Service) Marshal() ([]byte, error)
- func (s *Service) Save(mysqlClusterID, mysqlServerID, dbID int, sqlID string) error
Constants ¶
const QueriesStruct = "Queries"
Variables ¶
This section is empty.
Functions ¶
func NewClickHouseRepo ¶
func NewClickHouseRepo(config query.Config, conn *clickhouse.Conn) query.MonitorRepo
NewClickHouseRepo returns a new query.MonitorRepo
func NewConfigWithDefault ¶
NewConfigWithDefault returns a new query.Config with default value
func NewDASRepo ¶
func NewDASRepo(db middleware.Pool) query.DASRepo
NewDASRepo returns query.DASRepo
func NewDASRepoWithGlobal ¶
NewDASRepoWithGlobal returns query.DASRepo with global mysql pool
func NewMySQLRepo ¶
NewMySQLRepo returns a new query.MonitorRepo
func NewService ¶
NewService returns a new query.Service
Types ¶
type ClickhouseRepo ¶
type ClickhouseRepo struct {
// contains filtered or unexported fields
}
func (*ClickhouseRepo) GetByDBName ¶
func (cr *ClickhouseRepo) GetByDBName(serviceName, dbName string) ([]query.Query, error)
GetByDBName returns query.Query list by dbNameS
func (*ClickhouseRepo) GetBySQLID ¶
func (cr *ClickhouseRepo) GetBySQLID(serviceName, sqlID string) (query.Query, error)
GetBySQLID returns query.Query by SQL ID
func (*ClickhouseRepo) GetByServiceNames ¶
func (cr *ClickhouseRepo) GetByServiceNames(serviceNames []string) ([]query.Query, error)
GetByServiceNames returns query.Query list by serviceNames
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
func (*Config) GetStartTime ¶
GetStartTime returns the start time
func (*Config) SetEndTime ¶
SetEndTime sets the end time
func (*Config) SetStartTime ¶
SetStartTime sets the start time
type DASRepo ¶
type DASRepo struct {
Database middleware.Pool
}
func (*DASRepo) Execute ¶
func (dr *DASRepo) Execute(command string, args ...interface{}) (middleware.Result, error)
Execute executes given command and placeholders on the middleware
func (*DASRepo) Save ¶
func (dr *DASRepo) Save(mysqlClusterID, mysqlServerID, dbID int, sqlID string, startTime, endTime time.Time, limit, offset int) error
Save saves sql information into the middleware
func (*DASRepo) Transaction ¶
func (dr *DASRepo) Transaction() (middleware.Transaction, error)
Transaction returns a middleware.Transaction that could execute multiple commands as a transaction
type MySQLRepo ¶
type MySQLRepo struct {
// contains filtered or unexported fields
}
func (*MySQLRepo) GetByDBName ¶
GetByDBName returns query.query list by dbName
func (*MySQLRepo) GetBySQLID ¶
GetBySQLID return query.query by SQL ID
type Querier ¶
type Querier struct {
// contains filtered or unexported fields
}
Querier include config of query and connection pool of DAS repo
func NewQuerier ¶
NewQuerier return *Querier
func NewQuerierWithGlobal ¶
NewQuerierWithGlobal return *Querier with global DASRepo
func (*Querier) GetByMySQLClusterID ¶
GetByMySQLClusterID get queries by mysql cluster id
func (*Querier) GetByMySQLServerID ¶
GetByMySQLServerID get queries by mysql server id
type Query ¶
type Query struct {
SQLID string `middleware:"sql_id" json:"sql_id"`
Fingerprint string `middleware:"fingerprint" json:"fingerprint"`
Example string `middleware:"example" json:"example"`
DBName string `middleware:"db_name" json:"db_name"`
ExecCount int `middleware:"exec_count" json:"exec_count"`
TotalExecTime float64 `middleware:"total_exec_time" json:"total_exec_time"`
AvgExecTime float64 `middleware:"avg_exec_time" json:"avg_exec_time"`
RowsExaminedMax int `middleware:"rows_examined_max" json:"rows_examined_max"`
}
Query include several members of a query
func (*Query) GetAvgExecTime ¶
GetAvgExecTime returns the average execution time
func (*Query) GetExecCount ¶
GetExecCount returns the execution count
func (*Query) GetFingerprint ¶
GetFingerprint returns the fingerprint
func (*Query) GetRowsExaminedMax ¶
GetRowsExaminedMax returns the maximum row examined
func (*Query) GetTotalExecTime ¶
GetTotalExecTime returns the total execution time
type Service ¶
type Service struct {
Queries []query.Query `json:"queries"`
// contains filtered or unexported fields
}
func (*Service) GetByHostInfo ¶ added in v1.1.1
GetByHostInfo gets the query slice by the mysql server host ip and port number
func (*Service) GetByMySQLClusterID ¶
GetByMySQLClusterID gets the query slice by the mysql cluster identity
func (*Service) GetByMySQLServerID ¶
GetByMySQLServerID gets the query slice by the mysql server identity
func (*Service) GetBySQLID ¶
GetBySQLID gets the query by the mysql server identity and the sql identity
func (*Service) GetQueries ¶
GetQueries returns the query slice