This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push: new e40c68e913 [Fix](metric) Fix FE max_instances_num_per_user metric (#11313) e40c68e913 is described below commit e40c68e91323f706025379947861418d0483e4fa Author: Lijia Liu <liutang...@yeah.net> AuthorDate: Fri Jul 29 14:14:05 2022 +0800 [Fix](metric) Fix FE max_instances_num_per_user metric (#11313) --- .../java/org/apache/doris/metric/MetricRepo.java | 28 ++++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java b/fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java index c02f942c1a..30b2dab10c 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java +++ b/fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java @@ -38,7 +38,6 @@ import org.apache.doris.service.ExecuteEnv; import org.apache.doris.system.Backend; import org.apache.doris.system.SystemInfoService; -import com.codahale.metrics.Gauge; import com.codahale.metrics.Histogram; import com.codahale.metrics.MetricRegistry; import com.google.common.collect.Sets; @@ -232,6 +231,21 @@ public final class MetricRepo { }; PALO_METRIC_REGISTER.addPaloMetrics(scheduledTabletNum); + GaugeMetric<Long> maxInstanceNum = new GaugeMetric<Long>("max_instances_num_per_user", + MetricUnit.NOUNIT, "max instances num of all current users") { + @Override + public Long getValue() { + try { + return ((QeProcessorImpl) QeProcessorImpl.INSTANCE).getInstancesNumPerUser().values().stream() + .reduce(-1, BinaryOperator.maxBy(Integer::compareTo)).longValue(); + } catch (Throwable ex) { + LOG.warn("Get max_instances_num_per_user error", ex); + return -2L; + } + } + }; + PALO_METRIC_REGISTER.addPaloMetrics(maxInstanceNum); + // qps, rps and error rate // these metrics should be set an init value, in case that metric calculator is not running GAUGE_QUERY_PER_SECOND = new GaugeMetricImpl<>("qps", MetricUnit.NOUNIT, @@ -377,18 +391,6 @@ public final class MetricRepo { HISTO_EDIT_LOG_WRITE_LATENCY = METRIC_REGISTER.histogram( MetricRegistry.name("editlog", "write", "latency", "ms")); - METRIC_REGISTER.register(MetricRegistry.name("palo", "fe", "query", "max_instances_num_per_user"), - (Gauge<Integer>) () -> { - try { - return ((QeProcessorImpl) QeProcessorImpl.INSTANCE).getInstancesNumPerUser().values().stream() - .reduce(-1, BinaryOperator.maxBy(Integer::compareTo)); - } catch (Throwable ex) { - LOG.warn("Get max_instances_num_per_user error", ex); - return -2; - } - } - ); - // init system metrics initSystemMetrics(); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org