Documentation ¶
Index ¶
- Constants
- Variables
- func InitManager(s *model.Storage) chan struct{}
- type DefaultTask
- func (at *DefaultTask) Audit() (*model.AuditPlanReportV2, error)
- func (at DefaultTask) FullSyncSQLs(sqls []*SQL) error
- func (at DefaultTask) GetSQLs(args map[string]interface{}) ([]Head, []map[string]string, uint64, error)
- func (at DefaultTask) PartialSyncSQLs(sqls []*SQL) error
- func (at DefaultTask) Start() error
- func (at DefaultTask) Stop() error
- type Head
- type Manager
- func (mgr *Manager) Audit(apName string) (*model.AuditPlanReportV2, error)
- func (mgr *Manager) GetSQLs(apName string, args map[string]interface{}) ([]Head, []map[string]string, uint64, error)
- func (mgr *Manager) SyncTask(apName string) error
- func (mgr *Manager) UploadSQLs(apName string, sqls []*SQL, isPartialSync bool) error
- type Meta
- type OracleTopSQLTask
- func (at *OracleTopSQLTask) Audit() (*model.AuditPlanReportV2, error)
- func (at OracleTopSQLTask) FullSyncSQLs(sqls []*SQL) error
- func (at *OracleTopSQLTask) GetSQLs(args map[string]interface{}) ([]Head, []map[string]string, uint64, error)
- func (at OracleTopSQLTask) PartialSyncSQLs(sqls []*SQL) error
- func (at OracleTopSQLTask) Start() error
- func (at OracleTopSQLTask) Stop() error
- type SQL
- type SchemaMetaTask
- func (at *SchemaMetaTask) Audit() (*model.AuditPlanReportV2, error)
- func (at SchemaMetaTask) FullSyncSQLs(sqls []*SQL) error
- func (at *SchemaMetaTask) GetSQLs(args map[string]interface{}) ([]Head, []map[string]string, uint64, error)
- func (at SchemaMetaTask) PartialSyncSQLs(sqls []*SQL) error
- func (at SchemaMetaTask) Start() error
- func (at SchemaMetaTask) Stop() error
- type Task
Constants ¶
View Source
const ( TypeDefault = "default" TypeMySQLSlowLog = "mysql_slow_log" TypeMySQLMybatis = "mysql_mybatis" TypeMySQLSchemaMeta = "mysql_schema_meta" TypeOracleTopSQL = "oracle_top_sql" TypeAllAppExtract = "all_app_extract" )
View Source
const ( InstanceTypeAll = "" InstanceTypeMySQL = "mysql" InstanceTypeOracle = "Oracle" )
Variables ¶
View Source
var ErrAuditPlanExisted = errors.New(errors.DataExist, fmt.Errorf("audit plan existed"))
View Source
var ErrAuditPlanNotExist = errors.New(errors.DataNotExist, fmt.Errorf("audit plan not exist"))
View Source
var MetaMap = map[string]Meta{}
View Source
var Metas = []Meta{ { Type: TypeDefault, Desc: "自定义", InstanceType: InstanceTypeAll, }, { Type: TypeMySQLSlowLog, Desc: "慢日志", InstanceType: InstanceTypeMySQL, }, { Type: TypeMySQLMybatis, Desc: "Mybatis 扫描", InstanceType: InstanceTypeMySQL, }, { Type: TypeMySQLSchemaMeta, Desc: "库表元数据", InstanceType: InstanceTypeMySQL, Params: []*params.Param{ ¶ms.Param{ Key: paramKeyCollectIntervalMinute, Desc: "采集周期(分钟)", Value: "60", Type: params.ParamTypeInt, }, ¶ms.Param{ Key: "collect_view", Desc: "是否采集视图信息", Value: "0", Type: params.ParamTypeBool, }, }, }, { Type: TypeOracleTopSQL, Desc: "Oracle TOP SQL", InstanceType: InstanceTypeOracle, Params: []*params.Param{ { Key: paramKeyCollectIntervalMinute, Desc: "采集周期(分钟)", Value: "60", Type: params.ParamTypeInt, }, { Key: "top_n", Desc: "Top N", Value: "3", Type: params.ParamTypeInt, }, { Key: "order_by_column", Desc: "V$SQLAREA中的排序字段", Value: oracle.DynPerformanceViewSQLAreaColumnElapsedTime, Type: params.ParamTypeString, }, }, }, { Type: TypeAllAppExtract, Desc: "应用程序SQL抓取", InstanceType: InstanceTypeAll, }, }
Functions ¶
func InitManager ¶
Types ¶
type DefaultTask ¶ added in v1.2202.0
type DefaultTask struct {
// contains filtered or unexported fields
}
func NewDefaultTask ¶ added in v1.2202.0
func NewDefaultTask(entry *logrus.Entry, ap *model.AuditPlan) *DefaultTask
func (*DefaultTask) Audit ¶ added in v1.2202.0
func (at *DefaultTask) Audit() (*model.AuditPlanReportV2, error)
func (DefaultTask) FullSyncSQLs ¶ added in v1.2202.0
func (DefaultTask) PartialSyncSQLs ¶ added in v1.2202.0
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is the struct managing the persistent AuditPlans. It is *goroutine-safe*, since all exported methods are protected by a lock.
All audit plan operations except select should go through Manager.
func GetManager ¶
func GetManager() *Manager
func (*Manager) Audit ¶ added in v1.2202.0
func (mgr *Manager) Audit(apName string) (*model.AuditPlanReportV2, error)
type Meta ¶ added in v1.2201.0
type OracleTopSQLTask ¶ added in v1.2202.0
type OracleTopSQLTask struct {
// contains filtered or unexported fields
}
OracleTopSQLTask implement the Task interface.
OracleTopSQLTask is a loop task which collect Top SQL from oracle instance.
func NewOracleTopSQLTask ¶ added in v1.2202.0
func NewOracleTopSQLTask(entry *logrus.Entry, ap *model.AuditPlan) *OracleTopSQLTask
func (*OracleTopSQLTask) Audit ¶ added in v1.2202.0
func (at *OracleTopSQLTask) Audit() (*model.AuditPlanReportV2, error)
func (OracleTopSQLTask) FullSyncSQLs ¶ added in v1.2202.0
func (OracleTopSQLTask) PartialSyncSQLs ¶ added in v1.2202.0
type SchemaMetaTask ¶ added in v1.2202.0
type SchemaMetaTask struct {
// contains filtered or unexported fields
}
func NewSchemaMetaTask ¶ added in v1.2202.0
func NewSchemaMetaTask(entry *logrus.Entry, ap *model.AuditPlan) *SchemaMetaTask
func (*SchemaMetaTask) Audit ¶ added in v1.2202.0
func (at *SchemaMetaTask) Audit() (*model.AuditPlanReportV2, error)
func (SchemaMetaTask) FullSyncSQLs ¶ added in v1.2202.0
func (SchemaMetaTask) PartialSyncSQLs ¶ added in v1.2202.0
Click to show internal directories.
Click to hide internal directories.