I deleted a Flink TaskManager pod five times on EKS, in two phases. In the first two deletions, Flink restarted the job and reported RUNNING again about 5 seconds later, Kubernetes had a new pod Ready in 2 seconds, and the Kubernetes metrics in Splunk Observability Cloud didn't move: available replicas 1 in every 10 s point, container restarts 0.
Flink's own restart counter told a different story. In the second phase, 3 pod deletions added 7 to Flink's numRestarts, and with the OpenTelemetry Flink receiver sending to Splunk, Splunk's flink.job.restart.count rose by exactly 7 over the same window. Each restart was in a Splunk data point 17 to 21 seconds after Flink's REST API showed it.
TL;DR
- Job state: the first RESTARTING stretch after each deletion lasted 5.0 to 5.1 s. A dashboard that polls state every 10 s or more can miss stretches that short.
- Kubernetes view in Splunk, first two deletions:
k8s.deployment.availablestayed at 1 in every 10 s point (rollup min) whilekubectlsaw 0 for about 2 s, andk8s.container.restartsstayed at 0, because a deleted pod is replaced, not restarted.- Flink's restart counter: +1 per deletion in the first phase, but +3, +2 and +2 in the second. Splunk's counter matched Flink's REST API: +7 and +7.
- The receiver also sent checkpoint counters and JVM GC for both the JobManager and the TaskManagers: 29
flink.*metric names in all.

Why restarts, not job state
A Flink job with a restart strategy heals itself: lose a TaskManager and it goes RESTARTING, then RUNNING again. For background on watching restarts and checkpoints, see Flink's monitoring guide and the AWS Managed Flink lifecycle post. Two Flink issues frame what I measured: FLINK-23807 ("use numRestarts to detect restarts in tests") and FLINK-34907 ("jobRunningTs should be the timestamp that all tasks are running").
I'm a code owner of the OpenTelemetry Flink metrics receiver, so I wanted numbers: what job state, Kubernetes and Splunk each show when a TaskManager disappears, and whether the receiver's restart count in Splunk matches Flink's own.
The setup
- EKS, two nodes. Flink 1.20.5 (
flink:1.20-java17) as a session cluster: one JobManager, one TaskManager with 2 slots. - The job: Flink's StateMachine example at parallelism 2, checkpoints every 5 s, fixed-delay restarts with a 5 s delay.
- Splunk OTel Collector chart 0.163.1 on the cluster, which sends the Kubernetes metrics.
- A watcher on the other node read Flink's REST API once a second: job state, tasks running,
numRestarts, checkpoint counts, plus Flink's own state-change timestamps. - Deleting the TaskManager pod stands in for losing a TaskManager pod, as in a node drain or an eviction. I didn't test out-of-memory kills or containers restarting in place.
Phase 1 had no Flink receiver and two deletions 45 s apart. Phase 2 added the receiver and three deletions 49 to 54 s apart (the lab waits for RUNNING, then 30 s).
Phase 1: what job state and Kubernetes showed
Two deletions, 45 seconds apart:
| Deletion | Flink RESTARTING after | Not RUNNING | New pod Ready after | kubectl available min |
Splunk available min | Flink restarts |
|---|---|---|---|---|---|---|
| 1 | 1.2 s | 5.1 s | 2.0 s | 0 | 1 | +1 |
| 2 | 1.1 s | 5.0 s | 2.0 s | 0 | 1 | +1 |
"Not RUNNING" runs from Flink's RESTARTING timestamp to its next RUNNING timestamp. My one-second samples never caught the job saying RUNNING with a task not yet running, so a RUNNING-before-tasks gap like the one FLINK-34907 is about didn't show at this sampling; a gap under a second could still be there.
kubectl read 0 available TaskManagers for about 2 seconds each time. I read k8s.deployment.available in Splunk with rollup='min', so a dip inside a 10 s point would survive, and every point was 1. The chart sets no collection_interval for its k8s_cluster receiver, which reports every 10 s by default, so a 2-second replacement usually falls between two reports. That's why Flink's own restart counter is the signal to bring into Splunk for this.
k8s.container.restarts stayed at 0 too. Splunk held a series for 3 TaskManager pods: the original and two replacements, each with 0 restarts. A deleted pod is replaced, so the restart count of a container never moves.

Phase 2: the receiver in Splunk
For the Flink receiver I ran the upstream contrib Collector (0.165.0) next to the Splunk agent, sending OTLP to the agent on its node. This is the config from the lab's k8s/30-collector.yaml:
receivers:
flink_metrics:
endpoint: http://flink-jobmanager:8081
collection_interval: 10s
processors:
resource:
attributes:
- {key: deployment.environment, value: flink-lab, action: upsert}
batch:
timeout: 5s
exporters:
otlphttp:
endpoint: http://${env:HOST_IP}:4318
service:
pipelines:
metrics:
receivers: [flink_metrics]
processors: [resource, batch]
exporters: [otlphttp]
HOST_IP comes from the pod's status.hostIP. Collector 0.165.0 logs that otlphttp is a deprecated alias for otlp_http.
Then three more deletions. Flink's numRestarts rose by 3 for the first, then 2 and 2: 7 restarts from 3 deletions. The first RESTARTING stretch after each was still 5.0 s, but it wasn't the whole story: the job was back at RUNNING with its count settled 21, 16 and 16 s after the deletions, and the watcher saw RESTARTING in 33 of 152 one-second samples, against 8 of 80 in phase 1.
To compare like with like, the lab read both counts at the same two instants, 11:24:50 and 11:27:20 UTC, with no restart within 15 seconds of either:
| At 11:24:50 | At 11:27:20 | Increase | |
|---|---|---|---|
Flink REST API numRestarts |
2 | 9 | +7 |
Splunk flink.job.restart.count |
2 | 9 | +7 |
Splunk lists flink.job.restart.count as a CUMULATIVE_COUNTER, and I read it with rollup='latest', so each point holds the running total, not a per-point delta. Here's the chart in Splunk, with the same SignalFlow:
data('flink.job.restart.count', filter=filter('deployment.environment', 'flink-lab'), rollup='latest').max().publish()

How soon Splunk showed each restart
For each of the 7 restarts, from the second Flink's REST API first showed it:
- To the end of the first 10 s Splunk point holding it: 17 to 21 s.
- To a Splunk query that returned it, polling every 3 s during the deletions: 20 to 25 s.
The receiver reads every 10 s and the batch processor waits up to 5 s, so most of that delay is the path I chose. A 5 s collection_interval should shorten it; I didn't test that.
Checkpoints and JVM GC
Between the same two instants, failed checkpoints matched: +2 in Flink, +2 in Splunk. Completed checkpoints were +53 in Flink's REST API and +58 in Splunk. A 10 s Splunk point holds a value scraped somewhere inside it, and with a checkpoint every 5 s that timing can shift each instant by about 2, so up to about 4 overall. A gap of 5 is more than timing explains, and I didn't find the rest. Until then, I'd use completed checkpoints in Splunk as a rate, not an exact tally.
flink.jvm.gc.collections.count arrived for the JobManager (G1 young and old generation, 2 series) and for the TaskManagers (8 series across the pods).
Run it in your own account in 3 steps
Step 1: Create the cluster (the EKS cluster took 7m28s in my run)
git clone https://github.com/Abhimanyu9988/showmerit.git
cd showmerit/labs/count-flink-restarts-in-splunk-with-opentelemetry-3-pod
export AWS_REGION=eu-central-1 TF_VAR_region=eu-central-1 LAB_NAME=flink-lab TF_VAR_lab_name=flink-lab
export SPLUNK_REALM=us1 SPLUNK_ACCESS_TOKEN=your-ingest-token SPLUNK_API_TOKEN=your-api-token
terraform init && terraform apply -auto-approve
Step 2: Without the receiver (about 6 minutes)
Run ./reproduce.sh. It installs the Splunk OTel Collector chart, starts Flink and the job, deletes the TaskManager twice, and reads the Kubernetes metrics back from Splunk next to kubectl.
Step 3: With the receiver (about 4 minutes)
Run ./fix.sh. It starts the contrib Collector with the Flink receiver, deletes the TaskManager three more times, and compares Splunk's counters with Flink's REST API at the same instants.
To alert on it, a detector on the increase of flink.job.restart.count per job over a few minutes catches restarts that job state and pod health don't show.
Help build it
Flink can report how long a job has spent in each state in total. Its metrics page lists <jobStatus>TimeTotal, in milliseconds (so restartingTimeTotal for RESTARTING), and says whether these metrics are reported depends on the metrics.job.status.enable setting, for example:
metrics.job.status.enable: [CURRENT_TIME, TOTAL_TIME]
In this run, the only flink.job.* metrics the receiver sent were the checkpoint count, checkpoints in progress, the last checkpoint's size and time, and the restart count: no time spent restarting. A total like that would keep a 5-second outage even with a 10-second scrape. I opened issue #53170 to add it as an optional metric. If you'd like to build it, comment there and I'll help you get started.
Clean up (the cluster costs money while it runs)
./cleanup.sh
terraform destroy -auto-approve
What I didn't test
- Why some deletions counted more than one restart. The first phase counted one per deletion and the second phase two or three, with the receiver running and the deletions 49 to 54 s apart instead of 45 s. I recorded the counts, not the cause.
- Total time not RUNNING per deletion when it counted several restarts. I measured the first RESTARTING stretch and the RESTARTING samples per phase.
- Other failures: a crashing job, a lost JobManager, or a node failure. Only TaskManager pod deletions.
- Scale. One job, one TaskManager with 2 slots, one restart strategy, and a 10 s collection interval.
Sources
- Monitoring Apache Flink Applications 101
- Deep dive into the Amazon Managed Service for Apache Flink application lifecycle (part 2)
- FLINK-34907: jobRunningTs should be the timestamp that all tasks are running
- FLINK-23807: use numRestarts to detect restarts in tests
- Flink 1.20 metrics: job status metrics
- Flink metrics receiver (OpenTelemetry Collector contrib)
Disclosure: I work at Splunk, part of Cisco, and I'm a code owner of the OpenTelemetry Flink metrics receiver. This is my personal writing; the post isn't sponsored or reviewed by my employer.
I built this in a disposable AWS lab. The lab code and raw output are public. Drafted with AI assistance and reviewed by me.