Monitoring and Metrics
On this page
Out of the box, Flink jobs that run in a Bring-Your-Own-Cloud (BYOC) workspace expose metrics by using:
- JMX (Java Management Extensions)
- Prometheus (HTTP endpoint scraping)
This page describes what is already configured in your BYOC deployment so you can plug the data into your own monitoring stack (for example, Prometheus + Grafana).
Setting up or operating Prometheus / Grafana itself is outside the scope of this documentation and remains entirely under your control.
What’s Pre-configured?
1. Pod-level Prometheus Annotations
Every Flink pod (JobManager and TaskManager) includes annotations that instruct a Prometheus scraper to collect metrics automatically:
1annotations:
2 prometheus.io/path: /metrics
3 prometheus.io/port: "9999"
4 prometheus.io/scrape: "true"- prometheus.io/path: The HTTP path where metrics are exposed (
/metrics). - prometheus.io/port: The container port (
9999) where the metrics endpoint listens. - prometheus.io/scrape: Indicates that the pod should be scraped (
true).
If you already run a Prometheus operator in the same cluster, it can discover these pods automatically based on the annotations.
2. Baseline Flink Configuration
The following metric reporters are enabled by default in the Flink cluster configuration shipped with BYOC:
1metrics.reporters: jmx,promappmgr
2
3# JMX Reporter
4metrics.reporter.jmx.factory.class: org.apache.flink.metrics.jmx.JMXReporterFactory
5metrics.reporter.jmx.port: 10000-10240 # Port range for JMX
6
7# Prometheus Reporter
8metrics.reporter.promappmgr.factory.class: org.apache.flink.metrics.prometheus.PrometheusReporterFactoryNext Steps
- Scrape the Metrics
- Point your in-cluster Prometheus deployment at the Kubernetes namespace (or use
ServiceMonitorobjects) so it detects pods with theprometheus.io/scrape: "true"annotation. For more details, visit the official Prometheus documentation website.
- Point your in-cluster Prometheus deployment at the Kubernetes namespace (or use
- Visualize in Grafana
- Build your own using the Prometheus data source.
- Define Alerts
- Define alert rules in Prometheus or Grafana Alerting to monitor job health (e.g., restart count, checkpoint failures, backpressure).
- Export to Other Observability Tools
Exporting to Dynatrace
Dynatrace can discover this endpoint automatically in Kubernetes, without installing OneAgent on the Flink pods, through annotation-based Prometheus scraping. Metrics reach Dynatrace through an in-cluster ActiveGate, directly from the pod annotations.
- Enable Flink's built-in Prometheus reporter for both the JobManager and TaskManager, under
flinkConfigurationin the Deployment spec, or in Deployment Defaults to apply it to every Deployment. Setmetrics.reporter.prom.factory.classtoorg.apache.flink.metrics.prometheus.PrometheusReporterFactoryandmetrics.reporter.prom.portto9249, Flink's default Prometheus exporter port. Standardize on this port (or another of your choosing) on both pod types, and make sure it matches the pod annotation in step 3.
1flinkConfiguration:
2 metrics.reporter.prom.factory.class: org.apache.flink.metrics.prometheus.PrometheusReporterFactory
3 metrics.reporter.prom.port: 9249Port 9100 is the conventional default for Prometheus's node_exporter, a different tool. You can still use it for the Flink reporter if you configure it explicitly, but it isn't Flink's own default port.
- Flink exposes roughly four to five times as many metrics by default as a typical microservice. Filter them at the source with
metrics.reporter.prom.filter.includesormetrics.reporter.prom.filter.excludes, notmetrics.reporter.prom.scope.variables(which controls tag and label variables, not metric selection), so Dynatrace ingests only high-value data points such as checkpoints, memory, and backpressure. For example:
1flinkConfiguration:
2 metrics.reporter.prom.filter.includes: "*:*checkpoint*,*numRecords*,*backPressure*:counter,gauge"Test any filter pattern against your actual metrics endpoint output before you lock it in. Exact metric names might vary slightly by Flink version.
- Add the following annotations to the pod template for both the JobManager and TaskManager, using the port from step 1:
1metadata:
2 annotations:
3 metrics.dynatrace.com/scrape: "true"
4 metrics.dynatrace.com/port: "9249"- Make sure an in-cluster ActiveGate is deployed, and that Kubernetes Platform Monitoring (annotated Prometheus scraping) is enabled in Dynatrace's Kubernetes settings.
Once metrics start flowing, query them in Dynatrace's Data Explorer or chart them on a dashboard, for example checkpoint success and failure ratios, backpressure across pipeline tasks, and JVM memory and CPU usage. For anything beyond this setup, see Dynatrace's Prometheus metrics monitoring documentation.
No additional configuration inside Ververica Cloud: Bring-Your-Own-Cloud is required. All metrics are emitted automatically once the Flink cluster starts.
Reference Links
- Apache Flink: Metrics
- Prometheus: Scrape Classes