Skip to content

Commit

Permalink
[Enhancement] add metrics for analysis error (StarRocks#50250)
Browse files Browse the repository at this point in the history
Signed-off-by: jingdan <[email protected]>
  • Loading branch information
DanJing-coder committed Aug 27, 2024
1 parent a9c3128 commit 1d6d55c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/metric/MetricRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ public final class MetricRepo {
public static LongCounterMetric COUNTER_QUERY_QUEUE_TOTAL;
public static LongCounterMetric COUNTER_QUERY_QUEUE_TIMEOUT;

public static LongCounterMetric COUNTER_QUERY_ANALYSIS_ERR;
public static LongCounterMetric COUNTER_QUERY_INTERNAL_ERR;

public static LongCounterMetric COUNTER_UNFINISHED_BACKUP_JOB;
public static LongCounterMetric COUNTER_UNFINISHED_RESTORE_JOB;

Expand Down Expand Up @@ -404,6 +407,13 @@ public Long getValue() {
"counter of image succeeded in pushing to other frontends");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_IMAGE_PUSH);

COUNTER_QUERY_ANALYSIS_ERR = new LongCounterMetric("query_analysis_err", MetricUnit.REQUESTS,
"total analysis error query");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_QUERY_ANALYSIS_ERR);
COUNTER_QUERY_INTERNAL_ERR = new LongCounterMetric("query_internal_err", MetricUnit.REQUESTS,
"total internal error query");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_QUERY_INTERNAL_ERR);

COUNTER_TXN_REJECT =
new LongCounterMetric("txn_reject", MetricUnit.REQUESTS, "counter of rejected transactions");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_TXN_REJECT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,12 @@ public void auditAfterExec(String origStmt, StatementBase parsedStmt, PQueryStat
MetricRepo.COUNTER_QUERY_ERR.increase(1L);
ResourceGroupMetricMgr.increaseQueryErr(ctx, 1L);
ctx.getAuditEventBuilder().setDigest(computeStatementDigest(parsedStmt));
//represent analysis err
if (ctx.getState().getErrType() == QueryState.ErrType.ANALYSIS_ERR) {
MetricRepo.COUNTER_QUERY_ANALYSIS_ERR.increase(1L);
} else {
MetricRepo.COUNTER_QUERY_INTERNAL_ERR.increase(1L);
}
} else {
// ok query
MetricRepo.COUNTER_QUERY_SUCCESS.increase(1L);
Expand Down

0 comments on commit 1d6d55c

Please sign in to comment.