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

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


The following commit(s) were added to refs/heads/master by this push:
     new e60855fbc [KYUUBI #4364] Add metrics for user opened connections with 
session type
e60855fbc is described below

commit e60855fbcb20979155e0399519a22223a7d2e600
Author: fwang12 <[email protected]>
AuthorDate: Sat Feb 18 14:52:00 2023 +0800

    [KYUUBI #4364] Add metrics for user opened connections with session type
    
    ### _Why are the changes needed?_
    
    Add metrics for user opened connections with session type
    
    ### _How was this patch tested?_
    - [ ] Add some test cases that check the changes thoroughly including 
negative and positive cases if possible
    
    - [ ] Add screenshots for manual tests if appropriate
    
    - [x] [Run 
test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests)
 locally before make a pull request
    
    Closes #4364 from turboFei/user_session_type.
    
    Closes #4364
    
    d9505f256 [fwang12] get
    
    Authored-by: fwang12 <[email protected]>
    Signed-off-by: fwang12 <[email protected]>
---
 docs/monitor/metrics.md                                                 | 1 +
 .../src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala        | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/docs/monitor/metrics.md b/docs/monitor/metrics.md
index f128fd1a4..561014c37 100644
--- a/docs/monitor/metrics.md
+++ b/docs/monitor/metrics.md
@@ -49,6 +49,7 @@ These metrics include:
 | `kyuubi.connection.total`                        | `${sessionType}`          
             | counter   | 1.7.0 | <div style='width: 150pt;word-wrap: 
break-word;white-space: normal'> cumulative connection count with session type 
`${sessionType}`</div>                                                          
                                                                                
        |
 | `kyuubi.connection.opened`                       |                           
             | gauge     | 1.2.0 | <div style='width: 150pt;word-wrap: 
break-word;white-space: normal'> current active connection count</div>          
                                                                                
                                                                                
       |
 | `kyuubi.connection.opened`                       | `${user}`                 
             | counter   | 1.2.0 | <div style='width: 150pt;word-wrap: 
break-word;white-space: normal'> current active connections count requested by 
a `${user}`</div>                                                               
                                                                                
        |
+| `kyuubi.connection.opened`                       | 
`${user}`</br>`${sessionType}`         | counter   | 1.7.0 | <div style='width: 
150pt;word-wrap: break-word;white-space: normal'> current active connections 
count requested by a `${user}` with session type `${sessionType}`</div>         
                                                                                
                           |
 | `kyuubi.connection.opened`                       | `${sessionType}`          
             | counter   | 1.7.0 | <div style='width: 150pt;word-wrap: 
break-word;white-space: normal'> current active connections count with session 
type `${sessionType}`</div>                                                     
                                                                                
        |
 | `kyuubi.connection.failed`                       |                           
             | counter   | 1.2.0 | <div style='width: 150pt;word-wrap: 
break-word;white-space: normal'>  cumulative failed connection count</div>      
                                                                                
                                                                                
       |
 | `kyuubi.connection.failed`                       | `${user}`                 
             | counter   | 1.2.0 | <div style='width: 150pt;word-wrap: 
break-word;white-space: normal'> cumulative failed connections for a 
`${user}`</div>                                                                 
                                                                                
                  |
diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala
index 5b731e273..18597dac9 100644
--- a/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala
+++ b/kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSession.scala
@@ -58,11 +58,13 @@ abstract class KyuubiSession(
     ms.incCount(CONN_TOTAL)
     ms.incCount(MetricRegistry.name(CONN_TOTAL, sessionType.toString))
     ms.incCount(MetricRegistry.name(CONN_OPEN, user))
+    ms.incCount(MetricRegistry.name(CONN_OPEN, user, sessionType.toString))
     ms.incCount(MetricRegistry.name(CONN_OPEN, sessionType.toString))
   }
 
   protected def traceMetricsOnClose(): Unit = MetricsSystem.tracing { ms =>
     ms.decCount(MetricRegistry.name(CONN_OPEN, user))
+    ms.decCount(MetricRegistry.name(CONN_OPEN, user, sessionType.toString))
     ms.decCount(MetricRegistry.name(CONN_OPEN, sessionType.toString))
   }
 }

Reply via email to