Skip to content
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

[Enhancement] add metrics for analysis error (backport #50250) #50275

Closed
wants to merge 1 commit into from
Closed
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
52 changes: 52 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 @@ -95,6 +95,43 @@ public final class MetricRepo {
public static LongCounterMetric COUNTER_QUERY_QUEUE_TOTAL;
public static LongCounterMetric COUNTER_QUERY_QUEUE_TIMEOUT;

<<<<<<< HEAD
=======
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,
"the number of current pending slots for each category"));
public static final MetricWithLabelGroup<LongCounterMetric> COUNTER_QUERY_QUEUE_CATEGORY_SLOT_RUNNING =
new MetricWithLabelGroup<>("category",
() -> new LongCounterMetric("query_queue_v2_category_running_slots", MetricUnit.REQUESTS,
"the number of current running slots for each category"));
public static final MetricWithLabelGroup<LongCounterMetric> COUNTER_QUERY_QUEUE_CATEGORY_SLOT_ALLOCATED_TOTAL =
new MetricWithLabelGroup<>("category",
() -> new LongCounterMetric("query_queue_v2_category_total_allocated_slots", MetricUnit.REQUESTS,
"the accumulated value of allocated slots for each category"));
public static final MetricWithLabelGroup<GaugeMetricImpl<Integer>> GAUGE_QUERY_QUEUE_CATEGORY_WEIGHT =
new MetricWithLabelGroup<>("category",
() -> new GaugeMetricImpl<>("query_queue_v2_category_weight", MetricUnit.REQUESTS,
"the weight of each category"));
public static final MetricWithLabelGroup<GaugeMetricImpl<Integer>> GAUGE_QUERY_QUEUE_CATEGORY_SLOT_MIN_SLOTS =
new MetricWithLabelGroup<>("category",
() -> new GaugeMetricImpl<>("query_queue_v2_category_min_slots", MetricUnit.REQUESTS,
"the min slots of each category"));
public static final MetricWithLabelGroup<LongCounterMetric> COUNTER_QUERY_QUEUE_CATEGORY_SLOT_STATE =
new MetricWithLabelGroup<>("category",
() -> new LongCounterMetric("query_queue_v2_category_state", MetricUnit.REQUESTS,
"the current state of each category"));

public static LongCounterMetric COUNTER_UNFINISHED_BACKUP_JOB;
public static LongCounterMetric COUNTER_UNFINISHED_RESTORE_JOB;

>>>>>>> 9b4611a06f ([Enhancement] add metrics for analysis error (#50250))
public static LongCounterMetric COUNTER_LOAD_ADD;
public static LongCounterMetric COUNTER_LOAD_FINISHED;
public static LongCounterMetric COUNTER_EDIT_LOG_WRITE;
Expand Down Expand Up @@ -374,6 +411,21 @@ public Long getValue() {
"counter of image succeeded in pushing to other frontends");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_IMAGE_PUSH);

<<<<<<< HEAD
=======
COUNTER_SHORTCIRCUIT_QUERY = new LongCounterMetric("shortcircuit_query", MetricUnit.REQUESTS, "total shortcircuit query");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_SHORTCIRCUIT_QUERY);
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);

>>>>>>> 9b4611a06f ([Enhancement] add metrics for analysis error (#50250))
COUNTER_TXN_REJECT =
new LongCounterMetric("txn_reject", MetricUnit.REQUESTS, "counter of rejected transactions");
STARROCKS_METRIC_REGISTER.addMetric(COUNTER_TXN_REJECT);
Expand Down
10 changes: 10 additions & 0 deletions fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,16 @@ public void auditAfterExec(String origStmt, StatementBase parsedStmt, PQueryStat
// err query
MetricRepo.COUNTER_QUERY_ERR.increase(1L);
ResourceGroupMetricMgr.increaseQueryErr(ctx, 1L);
<<<<<<< HEAD
=======
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);
}
>>>>>>> 9b4611a06f ([Enhancement] add metrics for analysis error (#50250))
} else {
// ok query
MetricRepo.COUNTER_QUERY_SUCCESS.increase(1L);
Expand Down
Loading