diff --git a/fe/fe-core/src/main/java/com/starrocks/metric/MetricRepo.java b/fe/fe-core/src/main/java/com/starrocks/metric/MetricRepo.java index cde830641c7b1..154d718ee5f1f 100644 --- a/fe/fe-core/src/main/java/com/starrocks/metric/MetricRepo.java +++ b/fe/fe-core/src/main/java/com/starrocks/metric/MetricRepo.java @@ -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 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 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 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> 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> 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 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; @@ -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); diff --git a/fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java b/fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java index f0a0afe6dccad..ea9040f62bcc3 100644 --- a/fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java +++ b/fe/fe-core/src/main/java/com/starrocks/qe/ConnectProcessor.java @@ -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);