Skip to content

fix: use older prometheus client for flink apps - #159

Merged
varkey98 merged 2 commits into
mainfrom
simpleclient-shared-meter-registry
Oct 30, 2026
Merged

varkey98 merged 2 commits into
mainfrom
simpleclient-shared-meter-registry

Conversation

@varkey98

@varkey98 varkey98 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Description

Moves platform-metrics back to a single Prometheus client, the legacy simpleclient (io.prometheus.client 0.16.0), and drops the new client 1.x stack (io.prometheus.metrics).

Background. The new Prometheus client stack was added in #149 for Flink only. It gave Flink TaskManagers a shared PrometheusRegistry and scrape endpoint through SharedMeterRegistry.getOrCreatePrometheusRegistry(...), with the existing simpleclient CollectorRegistry bridged onto it. Non-Flink services never depended on it and continued to use simpleclient. This PR reverts that Flink-only stack.

Motivation. In Flink apps, the platform metrics registry and the Flink metrics reporter both live in /opt/flink/lib, on the parent-first classpath. Exposing them on one scrape endpoint needed both Prometheus client stacks side by side, plus the prometheus-metrics-simpleclient-bridge. Flink's own flink-metrics-prometheus is built on simpleclient, so using simpleclient everywhere removes the second stack, the bridge, and roughly 15 jars from the Flink image.

Changes

  • SharedMeterRegistry is rewritten on simpleclient. It serves one CollectorRegistry over simpleclient_httpserver, and callers attach their own registries to that endpoint:
    • start(serviceName, port) initialises PlatformMetricsRegistry for Flink and starts the HTTP server once per JVM.
    • register(CollectorRegistry) / unregister(handle) attach and detach an external registry, such as the Flink reporter's, using a delegating Collector.
    • boundPort() returns the port the server is actually listening on.
  • PlatformMetricsRegistry: removes getPrometheusRegistry() and the new-client bridge registration. Platform metrics are exposed via CollectorRegistry.defaultRegistry.
  • Dependencies:
    • Removes micrometer-registry-prometheus, prometheus-metrics-exporter-httpserver, prometheus-metrics-instrumentation-dropwizard and prometheus-metrics-simpleclient-bridge from platform-metrics.
    • Removes prometheus-metrics-exporter-servlet-jakarta from platform-service-framework.
    • Adds simpleclient_httpserver.
    • Removes the prometheus 1.x version and its aliases from libs.versions.toml.
  • Lockfiles relocked.

Breaking API change: SharedMeterRegistry.getOrCreatePrometheusRegistry(...) and PlatformMetricsRegistry.getPrometheusRegistry(), both added in #149, are removed. The only known caller is BridgingPrometheusReporter in flink-application-framework, which is updated in a companion change to use start / register / unregister. Consumers have to move to that flink-application-framework release together with this one. Pairing an older framework with this version fails at runtime with NoSuchMethodError.

Testing

  • New SharedMeterRegistryTest, run against an ephemeral port:
    • platform and external registry metrics are served in one scrape;
    • unregister removes the external registry's metrics;
    • a restart keeps the port and reinitialises;
    • a distribution summary with percentiles and a histogram produces _bucket and quantile= series;
    • an OpenMetrics Accept header returns 200 with an OpenMetrics content type.
  • ./gradlew build passes.
  • End to end:
    • Published to mavenLocal and built flink-application-framework, raw-span-grouper-flink and api-anomaly-detector-flink against it.
    • Deployed raw-span-grouper-flink on saas-dev. The TaskManager :9249/metrics returns 200, with Flink flink_taskmanager_* metrics, platform JVM/process metrics and app metrics in one response. The JobManager endpoint also returns 200.
    • Every metric that the flink-apps and flink-dashboard Grafana dashboards queried before is still exposed under the same name.

Checklist:

  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules (the companion flink-application-framework change is merged after this is released)

Documentation

platform-metrics/README.md is updated with the new SharedMeterRegistry API.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Test Results

37 tests  +5   37 ✅ +5   18s ⏱️ ±0s
10 suites +1    0 💤 ±0 
10 files   +1    0 ❌ ±0 

Results for commit 2e2e85e. ± Comparison against base commit d1ff27a.

♻️ This comment has been updated with latest results.

@varkey98
varkey98 force-pushed the simpleclient-shared-meter-registry branch from 69194f1 to 2e2e85e Compare October 30, 2026 13:23
@varkey98 varkey98 changed the title fix: use older prometheus client eveywhere fix: use older prometheus client for flink apps Oct 30, 2026
@varkey98
varkey98 merged commit f5e5511 into main Oct 30, 2026
7 of 8 checks passed
@varkey98
varkey98 deleted the simpleclient-shared-meter-registry branch October 30, 2026 14:56
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.

2 participants