Skip to content

Commit a39e170

Browse files
committed
fix(matrix): 修复SQL拼接格式及代码格式问题
- 修正access_logs相关SQL语句中GROUP BY和ORDER BY的换行格式 - 修复SQL语句中consumer IS NOT NULL的断行问题 - 优化MatrixLogServiceImpl中buildBizClause方法的变量声明格式 - 删除GenericSlsQueryRequest类中多余的空行,提升代码整洁度
1 parent 503f2c1 commit a39e170

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed

himarket-server/src/main/java/com/alibaba/himarket/dto/params/sls/GenericSlsQueryRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public class GenericSlsQueryRequest {
9090

9191
/** 时间间隔(秒,用于时序图表聚合) */
9292
private Integer interval;
93-
93+
9494
/** 业务类型,用于区分不同的产品类型(如 MCP_SERVER, MODEL_API 等) */
9595
private String bizType;
9696
}

himarket-server/src/main/java/com/alibaba/himarket/service/gateway/factory/MatrixPresetSqlRegistry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ public MatrixPresetSqlRegistry() {
507507
+ " risklabel, COUNT(1) AS cnt FROM access_logs "
508508
+ WHERE_PLACEHOLDER
509509
+ " AND JSON_VALID(ai_log) AND JSON_UNQUOTE(JSON_EXTRACT(ai_log,"
510-
+ " '$.safecheck_status')) = 'reqeust deny' GROUP BY risklabel ORDER BY cnt"
511-
+ " DESC",
510+
+ " '$.safecheck_status')) = 'reqeust deny' GROUP BY risklabel"
511+
+ " ORDER BY cnt DESC",
512512
null,
513513
null));
514514
presets.put(
@@ -520,8 +520,8 @@ public MatrixPresetSqlRegistry() {
520520
+ " FROM access_logs "
521521
+ WHERE_PLACEHOLDER
522522
+ " AND JSON_VALID(ai_log) AND JSON_UNQUOTE(JSON_EXTRACT(ai_log,"
523-
+ " '$.safecheck_status')) = 'reqeust deny' AND consumer IS NOT NULL GROUP"
524-
+ " BY consumer ORDER BY cnt DESC",
523+
+ " '$.safecheck_status')) = 'reqeust deny' AND consumer IS NOT"
524+
+ " NULL GROUP BY consumer ORDER BY cnt DESC",
525525
null,
526526
null));
527527

himarket-server/src/main/java/com/alibaba/himarket/service/impl/MatrixLogServiceImpl.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,7 @@ private String buildWhereClause(GenericSlsQueryRequest request, MapSqlParameterS
197197
* </ul>
198198
*/
199199
private String buildBizClause(GenericSlsQueryRequest request) {
200-
boolean isMcp =
201-
request.getBizType() != null && request.getBizType().equals("MCP_SERVER");
200+
boolean isMcp = request.getBizType() != null && request.getBizType().equals("MCP_SERVER");
202201

203202
if (isMcp) {
204203
return "AND REGEXP_LIKE(path, '^/mcp-servers')";

0 commit comments

Comments
 (0)