You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-func (s *Storage) HasSQLManageRecords(sourceId string, source string) (bool, error) {+func (s *Storage) HasSQLManageRecords(sourceId uint, source string) (bool, error) {
info := struct {
Count int64 `gorm:"column:cnt"`
}{}
err := s.db.Raw(`SELECT COUNT(*) AS cnt FROM sql_manage_records WHERE source_id = ? AND source = ? AND deleted_at IS NULL`, sourceId, source).Scan(&info).Error
if err != nil {
return false, err
}
return info.Count > 0, nil
}
Suggestion importance[1-10]: 8
__
Why: The suggestion corrects the inconsistent parameter type for sourceId by aligning it with its use in related functions, which can prevent potential type conversion issues.
Why: The suggestion improves naming consistency by renaming ApMetricUserClientIP to ApMetricClientIP, which aligns with naming in other language files. The improved code snippet correctly reflects this change.
Medium
常量命名大小写一致
建议将常量 MetricNameUserClientIp 的 Ip 部分修改为大写 IP,以确保命名与其它相关常量一致。保持一致的命名风格有助于后续的维护和避免错误。
Why: The suggestion standardizes the constant name by capitalizing IP in MetricNameUserClientIp, ensuring consistency with other constants. The improved code snippet accurately implements this modification.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
关联的 issue
https://github.com/actiontech/sqle-ee/issues/2615
描述你的变更
确认项(pr提交后操作)
Tip
请在指定复审人之前,确认并完成以下事项,完成后✅
not_compatibleneed_update_docDescription
新增用户客户端IP、租户名称、请求时长指标
添加SQL记录检查函数以判断记录存在
更新本地化翻译消息及指标常量映射
修正指标名称不一致问题
Diagram Walkthrough
File Walkthrough
message_zh.go
新增并调整i18n消息配置sqle/locale/message_zh.go
ApMetricUserClientIP国际化消息ApMetricNameTenantName和ApMetricNameRequestTimeinstance_audit_plan.go
增加SQL记录检查新方法sqle/model/instance_audit_plan.go
HasSQLManageRecords方法检查SQL记录存在性metrics.go
扩展指标常量定义sqle/server/auditplan/metrics.go
MetricNameUserClientIP、MetricNameTenantName、MetricNameRequestTimeactive.en.toml
更新英文本地化指标翻译sqle/locale/active.en.toml
ApMetaOceanBaseForMySQLFullCollectApMetricUserClientIP、ApMetricNameRequestTime、ApMetricNameTenantName英文翻译
active.zh.toml
更新中文本地化指标翻译sqle/locale/active.zh.toml
ApMetaOceanBaseForMySQLFullCollectApMetricUserClientIP、ApMetricNameRequestTime、ApMetricNameTenantName中文翻译