Skip to content

Sql insight ce #3100

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 29, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sqle/api/controller/v1/audit_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ type GetAuditPlanMetasResV1 struct {
type AuditPlanMetaV1 struct {
Type string `json:"audit_plan_type"`
Desc string `json:"audit_plan_type_desc"`
Tips string `json:"audit_plan_type_tips"`
InstanceType string `json:"instance_type"`
Params []AuditPlanParamResV1 `json:"audit_plan_params,omitempty"`
HighPriorityConditions []HighPriorityConditionResV1 `json:"high_priority_conditions"`
Expand Down Expand Up @@ -94,6 +95,9 @@ func ConvertAuditPlanMetaWithInstanceIdToRes(ctx context.Context, meta auditplan
Desc: locale.Bundle.LocalizeMsgByCtx(ctx, meta.Desc),
InstanceType: meta.InstanceType,
}
if meta.Tips != nil {
res.Tips = locale.Bundle.LocalizeMsgByCtx(ctx, meta.Tips)
}
if meta.Params != nil && len(meta.Params()) > 0 {
paramsRes := make([]AuditPlanParamResV1, 0, len(meta.Params()))
for _, p := range meta.Params(instanceId) {
Expand Down
3 changes: 3 additions & 0 deletions sqle/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -12839,6 +12839,9 @@ var doc = `{
"audit_plan_type_desc": {
"type": "string"
},
"audit_plan_type_tips": {
"type": "string"
},
"high_priority_conditions": {
"type": "array",
"items": {
Expand Down
3 changes: 3 additions & 0 deletions sqle/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -12823,6 +12823,9 @@
"audit_plan_type_desc": {
"type": "string"
},
"audit_plan_type_tips": {
"type": "string"
},
"high_priority_conditions": {
"type": "array",
"items": {
Expand Down
2 changes: 2 additions & 0 deletions sqle/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,8 @@ definitions:
type: string
audit_plan_type_desc:
type: string
audit_plan_type_tips:
type: string
high_priority_conditions:
items:
$ref: '#/definitions/v1.HighPriorityConditionResV1'
Expand Down
18 changes: 12 additions & 6 deletions sqle/locale/active.en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ ApMetaAliRdsMySQLAuditLog = "AliRDS MySQL audit log"
ApMetaAliRdsMySQLSlowLog = "AliRDS MySQL slow log"
ApMetaAllAppExtract = "Application SQL extraction"
ApMetaBaiduRdsMySQLSlowLog = "Baidu Cloud RDS MySQL slow log"
ApMetaMDBSlowLog = "slow log(Monitor DB)"
ApMetaCollectTime = "collect time"
ApMetaCustom = "Custom"
ApMetaDB2TopSQL = "DB2 Top SQL"
ApMetaDistributedLock = "Distributed Lock"
ApMetaDmTopSQL = "DM TOP SQL"
ApMetaHuaweiRdsMySQLSlowLog = "Huawei Cloud RDS MySQL slow log"
ApMetaMDBSlowLog = "slow log(Monitor DB)"
ApMetaMySQLProcesslist = "Processlist"
ApMetaMySQLSchemaMeta = "Database schema metadata"
ApMetaObForOracleTopSQL = "OceanBase For Oracle TOP SQL"
ApMetaOracleTopSQL = "Oracle TOP SQL"
ApMetaPerformanceCollect = "Performance indicator collection"
ApMetaPerformanceCollectTips = "Performance indicator collection will incur a large performance overhead, so please enable it with caution."
ApMetaPostgreSQLTopSQL = "TOP SQL"
ApMetaQueries = "QPS"
ApMetaSchemaMeta = "Database schema metadata"
ApMetaSlowLog = "Slow log"
ApMetaThreadsConnected = "ThreadsConnected"
ApMetaTiDBAuditLog = "TiDB audit log"
ApMetaTopSQL = "Top SQL"
ApMetricEngine = "engine"
Expand All @@ -39,6 +44,7 @@ ApMetricNameBufferGetCounter = "Logical read count"
ApMetricNameBufferReadAvg = "Average logical read count"
ApMetricNameCPUTimeAvg = "Average CPU time (μs)"
ApMetricNameCPUTimeTotal = "Total CPU time (s)"
ApMetricNameChecksum = "checksum"
ApMetricNameCounter = "Execution count"
ApMetricNameCounterMoreThan = "Occurrence count > "
ApMetricNameDBUser = "User"
Expand All @@ -56,6 +62,8 @@ ApMetricNameLastReceiveTimestamp = "Last time matched to fingerprint"
ApMetricNameLockMode = "lock mode"
ApMetricNameLockType = "lock type"
ApMetricNameLockWaitCounter = "Lock wait count"
ApMetricNameLockWaitTimeAvg = "Average lock wait time(ms) "
ApMetricNameLockWaitTimeMax = "Max lock wait time(ms)"
ApMetricNameLockWaitTimeTotal = "Total lock wait time (ms)"
ApMetricNameLogicReadPageTotal = "Total logical read pages"
ApMetricNameMaxQueryTime = "Max execution time"
Expand All @@ -71,6 +79,8 @@ ApMetricNameQueryTimeTotal = "Total execution time(s)"
ApMetricNameQueryTimeTotalMS = "Total execution time(ms)"
ApMetricNameRowExaminedAvg = "Average examined rows"
ApMetricNameRowExaminedAvgMoreThan = "Average examined rows > "
ApMetricNameRowsAffectedAvg = "Average affected rows"
ApMetricNameRowsAffectedMax = "Max affected rows"
ApMetricNameTable = "table name"
ApMetricNameTransactionStarted = "transaction started"
ApMetricNameTrxWaitStarted = "transaction wait started"
Expand Down Expand Up @@ -219,6 +229,7 @@ OprDelAuditPlanWithName = "Delete audit plan, name: %v"
OprDelGlobalRuleTemplateWithName = "Delete global rule template, name: %v"
OprDelRuleTemplateWithName = "Delete rule template, name: %v"
OprDelSchedulingWorkflowWithNameAndDB = "Cancel scheduled workflow, name: %v, db instance: %v"
OprEditAuditPlanWithName = "Edit audit plan, name: %v"
OprEditDingConfig = "Edit DingTalk configuration"
OprEditGlobalConfig = "Edit global configuration"
OprEditGlobalRuleTemplateWithName = "Edit global rule template, name: %v"
Expand Down Expand Up @@ -344,8 +355,3 @@ WorkflowStepStateApprove = "Approved"
WorkflowStepStateReject = "Rejected"
WorkflowStepTypeSQLAudit = "Auditing"
WorkflowStepTypeSQLExecute = "Executing"
ApMetricNameLockWaitTimeAvg = "Average lock wait time(ms) "
ApMetricNameLockWaitTimeMax = "Max lock wait time(ms)"
ApMetricNameRowsAffectedMax = "Max affected rows"
ApMetricNameRowsAffectedAvg = "Average affected rows"
ApMetricNameChecksum = "checksum"
18 changes: 12 additions & 6 deletions sqle/locale/active.zh.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@ ApMetaAliRdsMySQLAuditLog = "阿里RDS MySQL审计日志"
ApMetaAliRdsMySQLSlowLog = "阿里RDS MySQL慢日志"
ApMetaAllAppExtract = "应用程序SQL抓取"
ApMetaBaiduRdsMySQLSlowLog = "百度云RDS MySQL慢日志"
ApMetaMDBSlowLog = "慢日志(监控库)"
ApMetaCollectTime = "采集时间"
ApMetaCustom = "自定义"
ApMetaDB2TopSQL = "DB2 Top SQL"
ApMetaDistributedLock = "分布式锁"
ApMetaDmTopSQL = "DM TOP SQL"
ApMetaHuaweiRdsMySQLSlowLog = "华为云RDS MySQL慢日志"
ApMetaMDBSlowLog = "慢日志(监控库)"
ApMetaMySQLProcesslist = "processlist 列表"
ApMetaMySQLSchemaMeta = "库表元数据"
ApMetaObForOracleTopSQL = "OceanBase For Oracle TOP SQL"
ApMetaOracleTopSQL = "Oracle TOP SQL"
ApMetaPerformanceCollect = "性能指标采集"
ApMetaPerformanceCollectTips = "性能指标采集将产生较大性能开销,请谨慎开启"
ApMetaPostgreSQLTopSQL = "TOP SQL"
ApMetaQueries = "QPS"
ApMetaSchemaMeta = "库表元数据"
ApMetaSlowLog = "慢日志"
ApMetaThreadsConnected = "线程数"
ApMetaTiDBAuditLog = "TiDB审计日志"
ApMetaTopSQL = "Top SQL"
ApMetricEngine = "引擎"
Expand All @@ -39,6 +44,7 @@ ApMetricNameBufferGetCounter = "逻辑读次数"
ApMetricNameBufferReadAvg = "平均逻辑读次数"
ApMetricNameCPUTimeAvg = "平均 CPU 时间(μs)"
ApMetricNameCPUTimeTotal = "CPU时间占用(s)"
ApMetricNameChecksum = "校验和"
ApMetricNameCounter = "执行次数"
ApMetricNameCounterMoreThan = "出现次数 > "
ApMetricNameDBUser = "用户"
Expand All @@ -56,6 +62,8 @@ ApMetricNameLastReceiveTimestamp = "最后一次匹配到该指纹的时间"
ApMetricNameLockMode = "锁模式"
ApMetricNameLockType = "锁类型"
ApMetricNameLockWaitCounter = "锁等待次数"
ApMetricNameLockWaitTimeAvg = "平均锁等待时间(ms)"
ApMetricNameLockWaitTimeMax = "锁最大等待时间(ms)"
ApMetricNameLockWaitTimeTotal = "锁等待时间(ms)"
ApMetricNameLogicReadPageTotal = "逻辑读页数"
ApMetricNameMaxQueryTime = "最长执行时间(s)"
Expand All @@ -71,6 +79,8 @@ ApMetricNameQueryTimeTotal = "总执行时间(s)"
ApMetricNameQueryTimeTotalMS = "总执行时间(ms)"
ApMetricNameRowExaminedAvg = "平均扫描行数"
ApMetricNameRowExaminedAvgMoreThan = "平均扫描行数 > "
ApMetricNameRowsAffectedAvg = "平均影响行数"
ApMetricNameRowsAffectedMax = "最大影响行数"
ApMetricNameTable = "表名"
ApMetricNameTransactionStarted = "持有锁事务开始时间"
ApMetricNameTrxWaitStarted = "等待锁事务开始时间"
Expand Down Expand Up @@ -219,6 +229,7 @@ OprDelAuditPlanWithName = "删除智能扫描任务,任务名:%v"
OprDelGlobalRuleTemplateWithName = "删除全局规则模板,模板名:%v"
OprDelRuleTemplateWithName = "删除规则模板,模板名:%v"
OprDelSchedulingWorkflowWithNameAndDB = "取消定时上线,工单名称:%v, 数据源名: %v"
OprEditAuditPlanWithName = "编辑智能扫描任务,任务名:%v"
OprEditDingConfig = "修改钉钉配置"
OprEditGlobalConfig = "修改全局配置"
OprEditGlobalRuleTemplateWithName = "编辑全局规则模板,模板名:%v"
Expand Down Expand Up @@ -344,8 +355,3 @@ WorkflowStepStateApprove = "通过"
WorkflowStepStateReject = "驳回"
WorkflowStepTypeSQLAudit = "审批"
WorkflowStepTypeSQLExecute = "上线"
ApMetricNameLockWaitTimeAvg = "平均锁等待时间(ms)"
ApMetricNameLockWaitTimeMax = "锁最大等待时间(ms)"
ApMetricNameRowsAffectedMax = "最大影响行数"
ApMetricNameRowsAffectedAvg = "平均影响行数"
ApMetricNameChecksum = "校验和"
49 changes: 27 additions & 22 deletions sqle/locale/message_zh.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ var (
OprDelGlobalRuleTemplateWithName = &i18n.Message{ID: "OprDelGlobalRuleTemplateWithName", Other: "删除全局规则模板,模板名:%v"}

OprAddAuditPlanWithName = &i18n.Message{ID: "OprAddAuditPlanWithName", Other: "创建智能扫描任务,任务名:%v"}
OprEditAuditPlanWithName = &i18n.Message{ID: "OprDelAuditPlanWithName", Other: "编辑智能扫描任务,任务名:%v"}
OprEditAuditPlanWithName = &i18n.Message{ID: "OprEditAuditPlanWithName", Other: "编辑智能扫描任务,任务名:%v"}
OprDelAuditPlanWithName = &i18n.Message{ID: "OprDelAuditPlanWithName", Other: "删除智能扫描任务,任务名:%v"}

OprAddSchedulingWorkflowWithNameAndDB = &i18n.Message{ID: "OprAddSchedulingWorkflowWithNameAndDB", Other: "设置定时上线,工单名称:%v, 数据源名: %v"}
Expand Down Expand Up @@ -361,27 +361,32 @@ var (
ApMetricNameQueryTimeAvgMoreThan = &i18n.Message{ID: "ApMetricNameQueryTimeAvgMoreThan", Other: "平均执行时间(s) > "}
ApMetricNameRowExaminedAvgMoreThan = &i18n.Message{ID: "ApMetricNameRowExaminedAvgMoreThan", Other: "平均扫描行数 > "}

ApMetaCustom = &i18n.Message{ID: "ApMetaCustom", Other: "自定义"}
ApMetaMySQLSchemaMeta = &i18n.Message{ID: "ApMetaMySQLSchemaMeta", Other: "库表元数据"}
ApMetaMySQLProcesslist = &i18n.Message{ID: "ApMetaMySQLProcesslist", Other: "processlist 列表"}
ApMetaAliRdsMySQLSlowLog = &i18n.Message{ID: "ApMetaAliRdsMySQLSlowLog", Other: "阿里RDS MySQL慢日志"}
ApMetaAliRdsMySQLAuditLog = &i18n.Message{ID: "ApMetaAliRdsMySQLAuditLog", Other: "阿里RDS MySQL审计日志"}
ApMetaBaiduRdsMySQLSlowLog = &i18n.Message{ID: "ApMetaBaiduRdsMySQLSlowLog", Other: "百度云RDS MySQL慢日志"}
ApMetaHuaweiRdsMySQLSlowLog = &i18n.Message{ID: "ApMetaHuaweiRdsMySQLSlowLog", Other: "华为云RDS MySQL慢日志"}
ApMetaOracleTopSQL = &i18n.Message{ID: "ApMetaOracleTopSQL", Other: "Oracle TOP SQL"}
ApMetaAllAppExtract = &i18n.Message{ID: "ApMetaAllAppExtract", Other: "应用程序SQL抓取"}
ApMetaTiDBAuditLog = &i18n.Message{ID: "ApMetaTiDBAuditLog", Other: "TiDB审计日志"}
ApMetaSlowLog = &i18n.Message{ID: "ApMetaSlowLog", Other: "慢日志"}
ApMetaMDBSlowLog = &i18n.Message{ID: "ApMetaMDBSlowLog", Other: "慢日志(监控库)"}
ApMetaTopSQL = &i18n.Message{ID: "ApMetaTopSQL", Other: "Top SQL"}
ApMetaDB2TopSQL = &i18n.Message{ID: "ApMetaDB2TopSQL", Other: "DB2 Top SQL"}
ApMetaSchemaMeta = &i18n.Message{ID: "ApMetaSchemaMeta", Other: "库表元数据"}
ApMetaDistributedLock = &i18n.Message{ID: "ApMetaDistributedLock", Other: "分布式锁"}
ApMetaDmTopSQL = &i18n.Message{ID: "ApMetaDmTopSQL", Other: "DM TOP SQL"}
ApMetaObForOracleTopSQL = &i18n.Message{ID: "ApMetaObForOracleTopSQL", Other: "OceanBase For Oracle TOP SQL"}
ApMetaPostgreSQLTopSQL = &i18n.Message{ID: "ApMetaPostgreSQLTopSQL", Other: "TOP SQL"}
ApMetricQueryTimeAvg = &i18n.Message{ID: "ApMetricQueryTimeAvg", Other: "平均查询时间(s)"}
ApMetricRowExaminedAvg = &i18n.Message{ID: "ApMetricRowExaminedAvg", Other: "平均扫描行数"}
ApMetaCustom = &i18n.Message{ID: "ApMetaCustom", Other: "自定义"}
ApMetaMySQLSchemaMeta = &i18n.Message{ID: "ApMetaMySQLSchemaMeta", Other: "库表元数据"}
ApMetaMySQLProcesslist = &i18n.Message{ID: "ApMetaMySQLProcesslist", Other: "processlist 列表"}
ApMetaAliRdsMySQLSlowLog = &i18n.Message{ID: "ApMetaAliRdsMySQLSlowLog", Other: "阿里RDS MySQL慢日志"}
ApMetaAliRdsMySQLAuditLog = &i18n.Message{ID: "ApMetaAliRdsMySQLAuditLog", Other: "阿里RDS MySQL审计日志"}
ApMetaBaiduRdsMySQLSlowLog = &i18n.Message{ID: "ApMetaBaiduRdsMySQLSlowLog", Other: "百度云RDS MySQL慢日志"}
ApMetaHuaweiRdsMySQLSlowLog = &i18n.Message{ID: "ApMetaHuaweiRdsMySQLSlowLog", Other: "华为云RDS MySQL慢日志"}
ApMetaOracleTopSQL = &i18n.Message{ID: "ApMetaOracleTopSQL", Other: "Oracle TOP SQL"}
ApMetaAllAppExtract = &i18n.Message{ID: "ApMetaAllAppExtract", Other: "应用程序SQL抓取"}
ApMetaTiDBAuditLog = &i18n.Message{ID: "ApMetaTiDBAuditLog", Other: "TiDB审计日志"}
ApMetaSlowLog = &i18n.Message{ID: "ApMetaSlowLog", Other: "慢日志"}
ApMetaMDBSlowLog = &i18n.Message{ID: "ApMetaMDBSlowLog", Other: "慢日志(监控库)"}
ApMetaTopSQL = &i18n.Message{ID: "ApMetaTopSQL", Other: "Top SQL"}
ApMetaDB2TopSQL = &i18n.Message{ID: "ApMetaDB2TopSQL", Other: "DB2 Top SQL"}
ApMetaSchemaMeta = &i18n.Message{ID: "ApMetaSchemaMeta", Other: "库表元数据"}
ApMetaDistributedLock = &i18n.Message{ID: "ApMetaDistributedLock", Other: "分布式锁"}
ApMetaDmTopSQL = &i18n.Message{ID: "ApMetaDmTopSQL", Other: "DM TOP SQL"}
ApMetaObForOracleTopSQL = &i18n.Message{ID: "ApMetaObForOracleTopSQL", Other: "OceanBase For Oracle TOP SQL"}
ApMetaPostgreSQLTopSQL = &i18n.Message{ID: "ApMetaPostgreSQLTopSQL", Other: "TOP SQL"}
ApMetricQueryTimeAvg = &i18n.Message{ID: "ApMetricQueryTimeAvg", Other: "平均查询时间(s)"}
ApMetricRowExaminedAvg = &i18n.Message{ID: "ApMetricRowExaminedAvg", Other: "平均扫描行数"}
ApMetaPerformanceCollect = &i18n.Message{ID: "ApMetaPerformanceCollect", Other: "性能指标采集"}
ApMetaPerformanceCollectTips = &i18n.Message{ID: "ApMetaPerformanceCollectTips", Other: "性能指标采集将产生较大性能开销,请谨慎开启"}
ApMetaCollectTime = &i18n.Message{ID: "ApMetaCollectTime", Other: "采集时间"}
ApMetaThreadsConnected = &i18n.Message{ID: "ApMetaThreadsConnected", Other: "线程数"}
ApMetaQPS = &i18n.Message{ID: "ApMetaQueries", Other: "QPS"}

ApPriorityHigh = &i18n.Message{ID: "ApPriorityHigh", Other: "高优先级"}

Expand Down
6 changes: 6 additions & 0 deletions sqle/model/sql_manage_insight_ce.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@

package model

import "time"

func (s *Storage) createSqlManageRawSQLs(sqls []*SQLManageRawSQL) error {
return nil
}

func (s *Storage) RemoveExpiredSqlInsightRecord(expiredTime time.Time) (int64, error) {
return 0, nil
}
30 changes: 17 additions & 13 deletions sqle/server/auditplan/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
type Meta struct {
Type string `json:"audit_plan_type"`
Desc *i18n.Message `json:"audit_plan_type_desc"`
Tips *i18n.Message `json:"audit_plan_type_tips"`
InstanceType string `json:"instance_type"`
// instanceId means gen `enums` by db conn, default is a constant definition
Params func(instanceId ...string) params.Params `json:"audit_plan_params,omitempty"`
Expand All @@ -26,23 +27,25 @@ type Meta struct {
type MetaBuilder struct {
Type string
Desc *i18n.Message
Tips *i18n.Message
TaskHandlerFn func() interface{}
}

const (
TypeDefault = "default"
TypeMySQLSlowLog = scannerCmd.TypeMySQLSlowLog
TypeMySQLMybatis = scannerCmd.TypeMySQLMybatis
TypeMySQLSchemaMeta = "mysql_schema_meta"
TypeMySQLProcesslist = "mysql_processlist"
TypeAliRdsMySQLSlowLog = "ali_rds_mysql_slow_log"
TypeAliRdsMySQLAuditLog = "ali_rds_mysql_audit_log"
TypeHuaweiRdsMySQLSlowLog = "huawei_rds_mysql_slow_log"
TypeOracleTopSQL = "oracle_top_sql"
TypeAllAppExtract = "all_app_extract"
TypeBaiduRdsMySQLSlowLog = "baidu_rds_mysql_slow_log"
TypeTDMySQLDistributedLock = "tdsql_for_innodb_distributed_lock"
TypeSQLFile = scannerCmd.TypeSQLFile
TypeDefault = "default"
TypeMySQLSlowLog = scannerCmd.TypeMySQLSlowLog
TypeMySQLMybatis = scannerCmd.TypeMySQLMybatis
TypeMySQLSchemaMeta = "mysql_schema_meta"
TypeMySQLProcesslist = "mysql_processlist"
TypeMySQLPerformanceCollect = "mysql_performance_collect"
TypeAliRdsMySQLSlowLog = "ali_rds_mysql_slow_log"
TypeAliRdsMySQLAuditLog = "ali_rds_mysql_audit_log"
TypeHuaweiRdsMySQLSlowLog = "huawei_rds_mysql_slow_log"
TypeOracleTopSQL = "oracle_top_sql"
TypeAllAppExtract = "all_app_extract"
TypeBaiduRdsMySQLSlowLog = "baidu_rds_mysql_slow_log"
TypeTDMySQLDistributedLock = "tdsql_for_innodb_distributed_lock"
TypeSQLFile = scannerCmd.TypeSQLFile
)

const (
Expand Down Expand Up @@ -136,6 +139,7 @@ func buildMeta(b MetaBuilder) Meta {
return Meta{
Type: b.Type,
Desc: b.Desc,
Tips: b.Tips,
InstanceType: taskMeta.InstanceType(),
Params: func(instanceId ...string) params.Params {
return taskMeta.Params(instanceId...)
Expand Down
11 changes: 11 additions & 0 deletions sqle/server/auditplan/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ const MetricNameWaitingLockConnectionId string = "waiting_lock_connection_id"
const MetricNameGrantedLockTrxId string = "granted_lock_trx_id"
const MetricNameWaitingLockTrxId string = "waiting_lock_trx_id"

// sql insight
const MetricNameSqlInsightCollectTime = "collect_time"
const MetricNameSqlInsightThreadsConnected = "Threads_connected"
const MetricNameSqlInsightQueries = "Queries"
const MetricNameSqlInsightQPS = "QPS"

var ALLMetric = map[string]MetricType{
MetricNameCounter: MetricTypeInt, // MySQL slow log
MetricNameLastReceiveTimestamp: MetricTypeString, // MySQL slow log
Expand Down Expand Up @@ -107,6 +113,11 @@ var ALLMetric = map[string]MetricType{
MetricNameRowsAffectedMax: MetricTypeInt, // TD MYSQL Monitor DB Slow Log
MetricNameRowsAffectedAvg: MetricTypeFloat, // TD MYSQL Monitor DB Slow Log
MetricNameChecksum: MetricTypeString, // TD MYSQL Monitor DB Slow Log

MetricNameSqlInsightCollectTime: MetricTypeTime,
MetricNameSqlInsightThreadsConnected: MetricTypeInt,
MetricNameSqlInsightQueries: MetricTypeInt,
MetricNameSqlInsightQPS: MetricTypeFloat,
}

func LoadMetrics(info map[string]interface{}, metrics []string) Metrics {
Expand Down
2 changes: 1 addition & 1 deletion sqle/server/auditplan/task_type_mysql_processlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (at *MySQLProcessListTaskV2) ExtractSQL(logger *logrus.Entry, ap *AuditPlan
}
}

if err := model.GetStorage().CreateSqlManageRawSQLs(rawSQLs); err != nil {
if err := persist.CreateSqlManageRawSQLs(rawSQLs); err != nil {
logger.Errorf("MySQLProcessListTaskV2 create sql manage raw sql failed, error: %v", err)
}

Expand Down
Loading
Loading