ShowMerit

Count Flink Restarts in Splunk With OpenTelemetry: 3 Pod Deletions, 7 Restarts

I deleted a Flink TaskManager pod 5 times on EKS. In the first 2, job state blinked for 5 s and Splunk's Kubernetes metrics didn't move. Then 3 deletions made 7 Flink restarts, and the OpenTelemetry Flink receiver put exactly 7 in Splunk.

Rechecked 1 Dec 2026: works with splunk-otel-collector chart 0.163.1 and 0.165.0 (on a GitHub runner)

Abhimanyu BajajPublished 16 Nov 20268 min readTested in eu-central-1Lab codeLab evidence

Run this yourself

On your AWS account

The full lab with your own AWS account and Splunk token. Follow the steps below, then run its clean up step so nothing keeps running.

git clone https://github.com/Abhimanyu9988/showmerit.git
cd showmerit/labs/count-flink-restarts-in-splunk-with-opentelemetry-3-pod

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.available stayed at 1 in every 10 s point (rollup min) while kubectl saw 0 for about 2 s, and k8s.container.restarts stayed 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.

Flink's numRestarts read every second against Splunk's flink.job.restart.count in 10 second points, both rising from 2 to 9 over three pod deletions

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

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.

Splunk chart of k8s.deployment.available for flink-taskmanager with rollup min, from my Splunk org

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()

Splunk chart of flink.job.restart.count rising in steps from 2 to 9 between 11:25 and 11:27 UTC

How soon Splunk showed each restart

For each of the 7 restarts, from the second Flink's REST API first showed it:

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

Sources

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.

Read next

OpenTelemetry code owner for two Collector components. Writes hands-on AWS container guides, each tested in a lab. See the proof