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

spricoder pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 04f140f8bf remove session metrics when close (#9604)
04f140f8bf is described below

commit 04f140f8bf2ae9ed9c2ec168956bf8c3d04a3b6f
Author: ZhangHongYin <[email protected]>
AuthorDate: Fri Apr 14 12:12:13 2023 +0800

    remove session metrics when close (#9604)
---
 .../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.

Reply via email to