Repository navigation
fix: use older prometheus client for flink apps - #159
Merged
Merged
Conversation
varkey98
requested review from
anujgoyal1,
puneet-traceable and
sidharth-jain23
October 30, 2026 07:42
varkey98
force-pushed
the
simpleclient-shared-meter-registry
branch
from
October 30, 2026 13:23
69194f1 to
2e2e85e
Compare
tim-mwangi
approved these changes
Oct 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Moves
platform-metricsback to a single Prometheus client, the legacy simpleclient (io.prometheus.client0.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
PrometheusRegistryand scrape endpoint throughSharedMeterRegistry.getOrCreatePrometheusRegistry(...), with the existing simpleclientCollectorRegistrybridged 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 theprometheus-metrics-simpleclient-bridge. Flink's ownflink-metrics-prometheusis built on simpleclient, so using simpleclient everywhere removes the second stack, the bridge, and roughly 15 jars from the Flink image.Changes
SharedMeterRegistryis rewritten on simpleclient. It serves oneCollectorRegistryoversimpleclient_httpserver, and callers attach their own registries to that endpoint:start(serviceName, port)initialisesPlatformMetricsRegistryfor 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 delegatingCollector.boundPort()returns the port the server is actually listening on.PlatformMetricsRegistry: removesgetPrometheusRegistry()and the new-client bridge registration. Platform metrics are exposed viaCollectorRegistry.defaultRegistry.micrometer-registry-prometheus,prometheus-metrics-exporter-httpserver,prometheus-metrics-instrumentation-dropwizardandprometheus-metrics-simpleclient-bridgefromplatform-metrics.prometheus-metrics-exporter-servlet-jakartafromplatform-service-framework.simpleclient_httpserver.prometheus1.x version and its aliases fromlibs.versions.toml.Breaking API change:
SharedMeterRegistry.getOrCreatePrometheusRegistry(...)andPlatformMetricsRegistry.getPrometheusRegistry(), both added in #149, are removed. The only known caller isBridgingPrometheusReporterinflink-application-framework, which is updated in a companion change to usestart/register/unregister. Consumers have to move to thatflink-application-frameworkrelease together with this one. Pairing an older framework with this version fails at runtime withNoSuchMethodError.Testing
SharedMeterRegistryTest, run against an ephemeral port:unregisterremoves the external registry's metrics;_bucketandquantile=series;Acceptheader returns 200 with an OpenMetrics content type../gradlew buildpasses.flink-application-framework,raw-span-grouper-flinkandapi-anomaly-detector-flinkagainst it.raw-span-grouper-flinkon saas-dev. The TaskManager:9249/metricsreturns 200, with Flinkflink_taskmanager_*metrics, platform JVM/process metrics and app metrics in one response. The JobManager endpoint also returns 200.flink-appsandflink-dashboardGrafana dashboards queried before is still exposed under the same name.Checklist:
flink-application-frameworkchange is merged after this is released)Documentation
platform-metrics/README.mdis updated with the newSharedMeterRegistryAPI.