[LIVY-1070] Add LivySessionMetrics Codahale gauges for session monitoring - #543
Conversation
|
@roczei , @gyogal , @nileshrathi345 and @ArnavBalyan Thanks..!!!! |
edfd4f1 to
810bd2d
Compare
|
Thanks for the PR! Tested it locally and was able to query the endpoint successfully at http://localhost:8998/metrics/metrics?pretty=true. Could you also update |
Hi @roczei I have updated Please take another look when you have a moment. |
cdf3469 to
5d2610b
Compare
…ring Register 18 livy.sessions.* session count gauges into the MetricRegistry at server startup via LivySessionMetrics.register(). Gauges reflect interactive and batch session counts by state and are exposed via the existing /metrics endpoint. Includes LivySessionMetricsSpec unit tests. Migrate LivySessionMetricsSpec to scalatest 3.2 (AnyFunSpec, should.Matchers).
Document the /metrics/metrics endpoint and the 18 livy.sessions.* Codahale gauges added for session monitoring.
5d2610b to
21a9a94
Compare
roczei
left a comment
There was a problem hiding this comment.
Thanks for adding the documentation! LGTM
What changes were proposed in this pull request?
This PR adds server-side session monitoring gauges for LIVY-1070.
Problem: Livy exposes session state via the REST API (/sessions, /batches) but does not publish session counts as Codahale metrics on the existing /metrics endpoint. External monitoring systems must poll the REST API to observe session distribution.
Solution: Introduce LivySessionMetrics, which registers session count gauges into Livy's MetricRegistry at server startup. Gauges are derived from InteractiveSessionManager and BatchSessionManager and exposed alongside existing Livy metrics via the AdminServlet at /metrics.
Changes
Metrics registered (18 gauges)
Overall (3)
livy.sessions.totallivy.sessions.active.totallivy.sessions.terminal.totalInteractive (8)
livy.sessions.interactive.totallivy.sessions.interactive.{idle,busy,starting,shutting_down,dead,error,killed}Batch (7)
livy.sessions.batch.totallivy.sessions.batch.{starting,running,success,dead,error,killed}Design notes
getValuereturns0on exceptionshuttingdown,succeeded)Compatibility
/metricsAdminServletJIRA: https://issues.apache.org/jira/browse/LIVY-1070
How was this patch tested?
Build
Result: BUILD SUCCESS
Unit tests
Result: 8/8 tests passed
Code coverage
JaCoCo agent enabled during test run (
server/target/jacoco/main.execgenerated).No UI changes in this PR.
Was this patch authored or co-authored using generative AI tooling?
Yes, this was co-authored using Cursor to help generate the new test cases.