Skip to content

[flink] add e2e coverage for task/operator-scope metrics - #24742

Open
barryib wants to merge 1 commit into
DataDog:masterfrom
barryib:test/flink-e2e-task-operator-metrics
Open

[flink] add e2e coverage for task/operator-scope metrics#24742
barryib wants to merge 1 commit into
DataDog:masterfrom
barryib:test/flink-e2e-task-operator-metrics

Conversation

@barryib

@barryib barryib commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The Flink e2e suite only ever started a jobmanager+taskmanager with no job running, so it never exercised task/operator-scope metrics (numRecordsIn, watermarks, etc.) — only JVM-level metrics.
  • Submits Flink's bundled StateMachineExample.jar (self-contained, no external deps, runs continuously) as part of dd_environment setup, gated by a WaitFor poll of the taskmanager's /metrics endpoint instead of a blind sleep.
  • Extends test_e2e_discovery (not test_e2e_jobmanager_metrics — task/operator metrics are only exposed via the TaskManager's own endpoint) with presence assertions for representative task and operator metrics, now exercising real tag extraction (job_name, task_name, operator_name, subtask_index) against genuine Flink-emitted data instead of only the hand-written tests/fixtures/metrics.txt fixture used by unit tests.

Stacked on #24740 (counter/gauge fix) since that's what makes flink.task.numRecordsIn/flink.operator.numRecordsIn submit correctly. This diff will include #24740's commits until that PR merges and this branch is rebased onto master — the actual new content here is only flink/tests/conftest.py and flink/tests/test_e2e.py.

Note: this does not assert metric_type=MONOTONIC_COUNT in e2e — the real Agent's monotonic_count sender computes its delta internally and the e2e replay JSON reports the result as gauge regardless, which is why no e2e test in this repo asserts that type. Counter-vs-gauge submission type is already covered by the unit test in #24740.

Test plan

  • ddev env test flink py3.13-1.19 — all e2e tests pass (test_e2e_jobmanager_metrics, test_e2e_discovery, test_e2e_discovery_all_candidates)
  • Re-ran with --recreate to check for flakiness in the new WaitFor gate — passed cleanly twice
  • ddev test --fmt / lint — clean

🤖 Generated with Claude Code

…etrics

test_e2e.py previously only exercised jobmanager/taskmanager JVM-level
metrics, since no Flink job was ever running. Submit the bundled
StateMachineExample.jar so task- and operator-scope metrics (numRecordsIn,
watermarks, etc.) get real coverage, including tag extraction against
genuine Flink-emitted label values instead of the hand-written unit test
fixture.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@barryib
barryib force-pushed the test/flink-e2e-task-operator-metrics branch from 2d631fe to cb69500 Compare July 30, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant