You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ta...@apache.org on 2023/04/18 02:37:24 UTC

[iotdb] branch rel/1.1 updated: Open [To rel/1.1][IOTDB-5762][Metric] remove session metrics when close (#9625)

This is an automated email from the ASF dual-hosted git repository.

tanxinyu pushed a commit to branch rel/1.1
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/rel/1.1 by this push:
     new 0fcd92a7f2  Open [To rel/1.1][IOTDB-5762][Metric] remove session metrics when close (#9625)
0fcd92a7f2 is described below

commit 0fcd92a7f2ed13cfce62799d33bc688cf86ca738
Author: ZhangHongYin <46...@users.noreply.github.com>
AuthorDate: Tue Apr 18 10:37:18 2023 +0800

     Open [To rel/1.1][IOTDB-5762][Metric] remove session metrics when close (#9625)
---
 .../java/org/apache/iotdb/db/query/control/SessionManager.java     | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/server/src/main/java/org/apache/iotdb/db/query/control/SessionManager.java b/server/src/main/java/org/apache/iotdb/db/query/control/SessionManager.java
index 93198c34da..a0ba7d8d37 100644
--- a/server/src/main/java/org/apache/iotdb/db/query/control/SessionManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/query/control/SessionManager.java
@@ -35,6 +35,7 @@ import org.apache.iotdb.db.mpp.plan.statement.sys.AuthorStatement;
 import org.apache.iotdb.db.query.control.clientsession.IClientSession;
 import org.apache.iotdb.db.service.basic.BasicOpenSessionResp;
 import org.apache.iotdb.metrics.utils.MetricLevel;
+import org.apache.iotdb.metrics.utils.MetricType;
 import org.apache.iotdb.rpc.RpcUtils;
 import org.apache.iotdb.rpc.TSStatusCode;
 import org.apache.iotdb.service.rpc.thrift.TSConnectionInfo;
@@ -146,6 +147,12 @@ public class SessionManager implements SessionManagerMBean {
 
   public boolean closeSession(IClientSession session, Consumer<Long> releaseByQueryId) {
     releaseSessionResource(session, releaseByQueryId);
+    MetricService.getInstance()
+        .remove(
+            MetricType.HISTOGRAM,
+            Metric.SESSION_IDLE_TIME.toString(),
+            Tag.NAME.toString(),
+            String.valueOf(session.getId()));
     // TODO we only need to do so when query is killed by time out
     //    // close the socket.
     //    // currently, we only focus on RPC service.