Skip to content

[spark] Expose Paimon metrics via JMX for Prometheus scraping#7647

Open
junmuz wants to merge 1 commit intoapache:masterfrom
junmuz:spark_paimon_metrics
Open

[spark] Expose Paimon metrics via JMX for Prometheus scraping#7647
junmuz wants to merge 1 commit intoapache:masterfrom
junmuz:spark_paimon_metrics

Conversation

@junmuz
Copy link
Copy Markdown
Contributor

@junmuz junmuz commented Apr 14, 2026

Purpose

Bridge Paimon commit metrics into Spark's MetricsSystem using a Codahale MetricRegistry so they are accessible as JMX MBeans. This enables jmx_prometheus_javaagent to scrape Paimon metrics (commit duration, files added/deleted, records appended, partitions written, etc.).

  • Add SparkMetricGroup extending MetricGroupImpl to dual-register metrics in both Paimon's internal registry and a shared Codahale registry
  • Add PaimonMetricsSource singleton with its own JmxReporter to register MBeans immediately (bypasses Spark MetricsSystem snapshot limitation)
  • Wire SparkMetricRegistry to use SparkMetricGroup
  • Add withMetricRegistry() to V1 commit path in PaimonSparkWriter

Tests

  • Unit tests for SparkMetricGroup: gauge/counter/histogram registration, lazy value updates, close cleanup, name sanitization, collision handling, backward compatibility with getMetrics()
    • Integration tests verifying commit metrics appear in the Codahale registry after writes and update correctly on subsequent commits

Bridge Paimon commit metrics into Spark's MetricsSystem using a Codahale
MetricRegistry so they are accessible as JMX MBeans. This enables
jmx_prometheus_javaagent to scrape Paimon metrics (commit duration,
files added/deleted, records appended, partitions written, etc.).

- Add SparkMetricGroup extending MetricGroupImpl to dual-register metrics
  in both Paimon's internal registry and a shared Codahale registry
- Add PaimonMetricsSource singleton with its own JmxReporter to register
  MBeans immediately (bypasses Spark MetricsSystem snapshot limitation)
- Wire SparkMetricRegistry to use SparkMetricGroup
- Add withMetricRegistry() to V1 commit path in PaimonSparkWriter

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant