[CELEBORN-2380] Support JmxSink for exposing metrics as JMX MBeans#3758
[CELEBORN-2380] Support JmxSink for exposing metrics as JMX MBeans#3758senthh wants to merge 8 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new metrics sink (JmxSink) to expose Celeborn metrics as JMX MBeans using Dropwizard Metrics’ JmxReporter, along with the required build/distribution updates so the sink can be enabled via standard metrics.properties configuration.
Changes:
- Add
JmxSinkimplementation backed by DropwizardJmxReporter. - Add
io.dropwizard.metrics:metrics-jmxto Maven + SBT builds and update binary licensing metadata. - Update config templates, Helm chart config, and monitoring docs to document/illustrate enabling the sink.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| project/CelebornBuild.scala | Adds metrics-jmx to SBT dependencies for the common module. |
| pom.xml | Adds metrics-jmx to Maven dependency management. |
| common/pom.xml | Adds metrics-jmx as a common-module dependency (version via parent management). |
| common/src/main/scala/org/apache/celeborn/common/metrics/sink/JmxSink.scala | Introduces the new JmxSink implementation using JmxReporter. |
| conf/metrics.properties.template | Adds commented example to enable the JMX sink. |
| charts/celeborn/files/conf/metrics.properties | Adds commented example to enable the JMX sink in Helm chart config. |
| docs/monitoring.md | Documents JmxSink in the list of supported sinks. |
| LICENSE-binary | Registers io.dropwizard.metrics:metrics-jmx in the binary license list. |
| dev/deps/dependencies-server | Adds metrics-jmx-4.2.25.jar to the server dependency manifest. |
| dev/deps/dependencies-client-tez | Adds metrics-jmx-4.2.25.jar to the Tez client dependency manifest. |
| dev/deps/dependencies-client-mr | Adds metrics-jmx-4.2.25.jar to the MR client dependency manifest. |
| dev/deps/dependencies-client-spark-4.1 | Adds metrics-jmx-4.2.25.jar to the Spark 4.1 client dependency manifest. |
| dev/deps/dependencies-client-spark-4.0 | Adds metrics-jmx-4.2.25.jar to the Spark 4.0 client dependency manifest. |
| dev/deps/dependencies-client-spark-3.5 | Adds metrics-jmx-4.2.25.jar to the Spark 3.5 client dependency manifest. |
| dev/deps/dependencies-client-spark-3.4 | Adds metrics-jmx-4.2.25.jar to the Spark 3.4 client dependency manifest. |
| dev/deps/dependencies-client-spark-3.3 | Adds metrics-jmx-4.2.25.jar to the Spark 3.3 client dependency manifest. |
| dev/deps/dependencies-client-spark-3.2 | Adds metrics-jmx-4.2.25.jar to the Spark 3.2 client dependency manifest. |
| dev/deps/dependencies-client-spark-3.1 | Adds metrics-jmx-4.2.25.jar to the Spark 3.1 client dependency manifest. |
| dev/deps/dependencies-client-spark-3.0 | Adds metrics-jmx-4.2.25.jar to the Spark 3.0 client dependency manifest. |
| dev/deps/dependencies-client-flink-2.3 | Adds metrics-jmx-4.2.25.jar to the Flink 2.3 client dependency manifest. |
| dev/deps/dependencies-client-flink-2.2 | Adds metrics-jmx-4.2.25.jar to the Flink 2.2 client dependency manifest. |
| dev/deps/dependencies-client-flink-2.1 | Adds metrics-jmx-4.2.25.jar to the Flink 2.1 client dependency manifest. |
| dev/deps/dependencies-client-flink-2.0 | Adds metrics-jmx-4.2.25.jar to the Flink 2.0 client dependency manifest. |
| dev/deps/dependencies-client-flink-1.20 | Adds metrics-jmx-4.2.25.jar to the Flink 1.20 client dependency manifest. |
| dev/deps/dependencies-client-flink-1.19 | Adds metrics-jmx-4.2.25.jar to the Flink 1.19 client dependency manifest. |
| dev/deps/dependencies-client-flink-1.18 | Adds metrics-jmx-4.2.25.jar to the Flink 1.18 client dependency manifest. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@senthh, thanks for first contribution. Please fix failure of Integration Test / celeborn_integration_test. |
@SteNicholas Thanks for the response and yes I have fixed the Integration test failures |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3758 +/- ##
============================================
+ Coverage 58.05% 58.22% +0.18%
Complexity 228 228
============================================
Files 397 398 +1
Lines 27931 27955 +24
Branches 2725 2728 +3
============================================
+ Hits 16212 16275 +63
+ Misses 10530 10488 -42
- Partials 1189 1192 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@senthh, please rebase the latest main branch and add change in |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…d MBean lifecycle Add a JmxSinkSuite (extending the existing sink-level test coverage) that verifies JmxSink is loaded by MetricsSystem from the metrics configuration via its reflection-based (Properties, MetricRegistry) constructor, and that start()/stop() register and unregister metric MBeans in the platform MBeanServer under the "metrics" JMX domain.
…metrics config Adding the commented JmxSink line to charts/celeborn/files/conf/metrics.properties changes the rendered config, and therefore the celeborn.apache.org/conf-hash checksum annotation on the master and worker StatefulSets. Update the expected hashes in the helm-unittest suites accordingly.
…, spark-4.2 dep - Publish MBeans under a configurable, Celeborn-specific JMX domain (default "celeborn") via `*.sink.jmx.domain`, instead of JmxReporter's global default "metrics" domain, to avoid MBean collisions with other Dropwizard users in the same JVM. - Ensure JmxSinkSuite always stops the MetricsSystem/reporter via try/finally, and add coverage for the configured-domain path and report(). - Add metrics-jmx to dev/deps/dependencies-client-spark-4.2 (new profile on main).
@SteNicholas I have rebased and addressed the integration test failure and code coverage issue too now |
…obal MBeanServer Use a unique JMX domain per run and assert on the before/after MBean delta instead of absolute presence, so the test is not affected by MBeans already present in (or leaked by a prior failed run into) the JVM-global MBeanServer.
|
@SteNicholas Hi Nicol, I have addressed Co-pilot's review |
SteNicholas
left a comment
There was a problem hiding this comment.
@senthh, thanks for updates. I left some comments for the updates. PTAL.
… a space Format the disabled JmxSink example as `# *.sink.jmx.class=...` (space after the comment marker) in conf/metrics.properties.template and the Helm chart metrics.properties, per review. Update the master/worker StatefulSet conf-hash test expectations for the changed chart config.
@SteNicholas Thanks for the reviews, I have addressed the points which you mentioned. It will be helpful if you re-review and share me your further input/feedback so that I can work to resolve. |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 31 out of 31 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
service/src/test/scala/org/apache/celeborn/server/common/metrics/sink/JmxSinkSuite.scala:53
- In this test,
metricsSystem.start(true)is called before thetry/finally. Ifstart()throws (e.g., due to a bad metrics config or missing dependency),stop()won’t run and can leak sinks/MBeans into subsequent tests in the same JVM.
Since the JmxSink ships in 0.7.0 (the main branch version), enable it by default in the Helm chart's metrics.properties alongside the other sinks instead of leaving it commented out. Update the master/worker StatefulSet conf-hash test expectations accordingly.
|
@SteNicholas Thanks for approving this PR; I see that the spark4 4.2 failure is an infra issue — 'the hosted runner lost communication with the server' — unrelated to this change; could you re-run the failed job? |
What changes were proposed in this pull request?
This PR adds a new
JmxSinkmetrics sink that exposes Celeborn metrics as JMX MBeans.JmxSink(common/src/main/scala/org/apache/celeborn/common/metrics/sink/JmxSink.scala), backed by Dropwizard Metrics'JmxReporter. It follows the existingSinkcontract and is loaded reflectively byMetricsSystemvia the standard(Properties, MetricRegistry)constructor, so no changes toMetricsSystemare required.io.dropwizard.metrics:metrics-jmxdependency (which containsJmxReporterin Dropwizard Metrics 4.x) to both the Maven build (pom.xmldependency management +common/pom.xml) and the SBT build (project/CelebornBuild.scala), pinned to the existing${codahale.metrics.version}(4.2.25).conf/metrics.properties.templateandcharts/celeborn/files/conf/metrics.propertiesshowing how to enable the sink.JmxSinkindocs/monitoring.md.metrics-jmx-4.2.25.jarin alldev/deps/dependencies-*manifests (server + client profiles) and addio.dropwizard.metrics:metrics-jmxtoLICENSE-binary, since the artifact is now bundled in the distributions.Enabling the sink is opt-in: