Skip to content

Commit 59246d6

Browse files
author
Linyuan QIN 秦林园
committed
Expose metrics of engine startup permit status
1 parent fc654cf commit 59246d6

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

docs/monitor/metrics.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ These metrics include:
6565
| `kyuubi.engine.timeout` | | counter | 1.2.0 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> cumulative timeout engines</div> |
6666
| `kyuubi.engine.failed` | `${user}` | counter | 1.2.0 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> cumulative explicitly failed engine count for a `${user}`</div> |
6767
| `kyuubi.engine.failed` | `${errorType}` | counter | 1.2.0 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> cumulative explicitly failed engine count for a particular `${errorType}`, e.g. `ClassNotFoundException`</div> |
68+
| `kyuubi.engine.startup.permit.limit.total` | | meter | 1.10.1 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> concurrently startup engines permit limit </div> |
69+
| `kyuubi.engine.startup.permit.available` | | gauge | 1.10.1 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> available permits of concurrently startup engines </div> |
70+
| `kyuubi.engine.startup.permit.waiting` | | gauge | 1.10.1 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> startup engines that waiting to acquire permit </div> |
6871
| `kyuubi.backend_service.open_session` | | timer | 1.5.0 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> kyuubi backend service `openSession` method execution time and rate </div> |
6972
| `kyuubi.backend_service.close_session` | | timer | 1.5.0 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> kyuubi backend service `closeSession` method execution time and rate </div> |
7073
| `kyuubi.backend_service.get_info` | | timer | 1.5.0 | <div style='width: 150pt;word-wrap: break-word;white-space: normal'> kyuubi backend service `getInfo` method execution time and rate </div> |

kyuubi-metrics/src/main/scala/org/apache/kyuubi/metrics/MetricsConstants.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ object MetricsConstants {
6060
final val ENGINE_TIMEOUT: String = ENGINE + "timeout"
6161
final val ENGINE_TOTAL: String = ENGINE + "total"
6262

63+
final private val ENGINE_STARTUP_PERMIT: String = ENGINE + "startup.permit."
64+
final val ENGINE_STARTUP_PERMIT_LIMIT: String = ENGINE_STARTUP_PERMIT + "limit"
65+
final val ENGINE_STARTUP_PERMIT_AVAILABLE: String = ENGINE_STARTUP_PERMIT + "available"
66+
final val ENGINE_STARTUP_PERMIT_WAITING: String = ENGINE_STARTUP_PERMIT + "waiting"
67+
6368
final private val OPERATION = KYUUBI + "operation."
6469
final val OPERATION_OPEN: String = OPERATION + "opened"
6570
final val OPERATION_FAIL: String = OPERATION + "failed"

kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionManager.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,14 @@ class KyuubiSessionManager private (name: String) extends SessionManager(name) {
300300
ms.registerGauge(EXEC_POOL_ALIVE, getExecPoolSize, 0)
301301
ms.registerGauge(EXEC_POOL_ACTIVE, getActiveCount, 0)
302302
ms.registerGauge(EXEC_POOL_WORK_QUEUE_SIZE, getWorkQueueSize, 0)
303+
this.engineStartupProcessSemaphore.foreach { semaphore =>
304+
ms.markMeter(ENGINE_STARTUP_PERMIT_LIMIT, semaphore.availablePermits)
305+
ms.registerGauge(
306+
ENGINE_STARTUP_PERMIT_AVAILABLE,
307+
semaphore.availablePermits,
308+
semaphore.availablePermits)
309+
ms.registerGauge(ENGINE_STARTUP_PERMIT_WAITING, semaphore.getQueueLength, 0)
310+
}
303311
}
304312
super.start()
305313
startEngineAliveChecker()

0 commit comments

Comments
 (0)