Skip to content
Merged
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
10 changes: 8 additions & 2 deletions fe/fe-core/src/main/java/org/apache/doris/metric/MetricRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public final class MetricRepo {
public static Histogram HISTO_QUERY_LATENCY;
public static AutoMappedMetric<Histogram> USER_HISTO_QUERY_LATENCY;
public static AutoMappedMetric<GaugeMetricImpl<Long>> USER_GAUGE_QUERY_INSTANCE_NUM;
public static AutoMappedMetric<GaugeMetricImpl<Integer>> USER_GAUGE_CONNECTIONS;
public static AutoMappedMetric<LongCounterMetric> USER_COUNTER_QUERY_INSTANCE_BEGIN;
public static AutoMappedMetric<LongCounterMetric> BE_COUNTER_QUERY_RPC_ALL;
public static AutoMappedMetric<LongCounterMetric> BE_COUNTER_QUERY_RPC_FAILED;
Expand Down Expand Up @@ -228,10 +229,15 @@ public Long getValue() {
generateBackendsTabletMetrics();

// connections
GaugeMetric<Integer> connections = new GaugeMetric<Integer>("connection_total", MetricUnit.CONNECTIONS,
"total connections") {
USER_GAUGE_CONNECTIONS = addLabeledMetrics("user", () ->
new GaugeMetricImpl<>("connection_total", MetricUnit.CONNECTIONS,
"total connections", 0));
GaugeMetric<Integer> connections = new GaugeMetric<Integer>("connection_total",
MetricUnit.CONNECTIONS, "total connections") {
@Override
public Integer getValue() {
ExecuteEnv.getInstance().getScheduler().getUserConnectionMap()
.forEach((k, v) -> USER_GAUGE_CONNECTIONS.getOrAdd(k).setValue(v.get()));
return ExecuteEnv.getInstance().getScheduler().getConnectionNum();
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,4 +194,8 @@ public String getQueryIdByTraceId(String traceId) {
public Map<Integer, ConnectContext> getConnectionMap() {
return connectionMap;
}

public Map<String, AtomicInteger> getUserConnectionMap() {
return connByUser;
}
}