[KYUUBI #1318] Increase CONN_OPEN iff openSession is successful

<!--
Thanks for sending a pull request!

Here are some tips for you:
  1. If this is your first time, please read our contributor guidelines: https://kyuubi.readthedocs.io/en/latest/community/contributions.html
  2. If the PR is related to an issue in https://github.com/apache/incubator-kyuubi/issues, add '[KYUUBI #XXXX]' in your PR title, e.g., '[KYUUBI #XXXX] Your PR title ...'.
  3. If the PR is unfinished, add '[WIP]' in your PR title, e.g., '[WIP][KYUUBI #XXXX] Your PR title ...'.
-->

### _Why are the changes needed?_
<!--
Please clarify why the changes are needed. For instance,
  1. If you add a feature, you can talk about the use case of it.
  2. If you fix a bug, you can clarify why it is a bug.
-->
The CONN_OPEN count should be increased when the openSession succeeds, otherwise, when the open session fails, CONN_FAIL+CONN_OPEN! =CONN_TOTAL

### _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/latest/develop_tools/testing.html#running-tests) locally before make a pull request

Closes #1319 from jiaoqingbo/kyuubi2.

Closes #1318

8988aede [jiaoqingbo] [KYUUBI #1318] The CONN_OPEN count should be increased when the openSession succeeds

Authored-by: jiaoqingbo <1178404354@qq.com>
Signed-off-by: Cheng Pan <chengpan@apache.org>
This commit is contained in:
jiaoqingbo 2021-11-02 12:46:14 +08:00 committed by Cheng Pan
parent fd17dd0ae4
commit c78fe427ed
No known key found for this signature in database
GPG Key ID: 8001952629BCC75D

View File

@ -67,11 +67,13 @@ class KyuubiSessionImpl(
override def open(): Unit = {
MetricsSystem.tracing { ms =>
ms.incCount(CONN_TOTAL)
ms.incCount(MetricRegistry.name(CONN_OPEN, user))
}
withZkClient(sessionConf) { zkClient =>
val (host, port) = engine.getOrCreate(zkClient)
openSession(host, port)
MetricsSystem.tracing { ms =>
ms.incCount(MetricRegistry.name(CONN_OPEN, user))
}
}
// we should call super.open after kyuubi session is already opened
super.open()