Skip to content

Commit

Permalink
[Enhancement] add metrics for analysis error (#50250)
Browse files Browse the repository at this point in the history
Signed-off-by: jingdan <[email protected]>
  • Loading branch information
DanJing-coder authored Aug 26, 2024
1 parent 9c69ffb commit 9b4611a
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 @@ -112,6 +112,9 @@ public final class MetricRepo {
public static LongCounterMetric COUNTER_QUERY_QUEUE_SLOT_PENDING;
public static LongCounterMetric COUNTER_QUERY_QUEUE_SLOT_RUNNING;

public static LongCounterMetric COUNTER_QUERY_ANALYSIS_ERR;
public static LongCounterMetric COUNTER_QUERY_INTERNAL_ERR;

public static final MetricWithLabelGroup<LongCounterMetric> COUNTER_QUERY_QUEUE_CATEGORY_SLOT_PENDING =
new MetricWithLabelGroup<>("category",
() -> new LongCounterMetric("query_queue_v2_category_pending_slots", MetricUnit.REQUESTS,
Expand Down Expand Up @@ -457,6 +460,13 @@ public Long getValue() {
COUNTER_SHORTCIRCUIT_RPC = new LongCounterMetric("shortcircuit_rpc", MetricUnit.REQUESTS, "total shortcircuit rpc");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_SHORTCIRCUIT_RPC);

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 @@ -216,6 +216,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 9b4611a

Please sign in to comment.