Skip to content

Emit estimated tasks per datastream as an INFO-level metric - #1048

Open
harshOSS wants to merge 1 commit into
linkedin:masterfrom
harshOSS:hmadhav/emit-estimated-tasks-per-datastream-metric
Open

Emit estimated tasks per datastream as an INFO-level metric#1048
harshOSS wants to merge 1 commit into
linkedin:masterfrom
harshOSS:hmadhav/emit-estimated-tasks-per-datastream-metric

Conversation

@harshOSS

Copy link
Copy Markdown
Collaborator

Summary

Add a per-datastream estimatedNumTasks gauge metric (with an accompanying INFO log) that reports the estimated number of tasks calculated for each stream during elastic task assignment.

  • Previously we only emitted the numTasksCappedByMaxTasks meter, which fires only when the estimate exceeds the datastream's maxTasks. There was no visibility into the estimated task count for streams that were not capped.
  • This change emits the estimated (uncapped) task count per datastream, so operators can observe the calculated value for every stream, compare it against the actual numTasks (which is capped at maxTasks), and understand scaling behavior.
  • The metric is emitted from StickyPartitionAssignmentStrategy.validateNumTasksAgainstMaxTasks() — the common code path shared by both StickyPartitionAssignmentStrategy (partition-count-based estimate) and LoadBasedPartitionAssignmentStrategy (throughput/load-based estimate) — so both strategies are covered. The gauge is registered/declared/unregistered alongside the existing per-datastream gauges (numTasks, actualPartitionsPerTask).

Metric name: StickyPartitionAssignmentStrategy.<datastreamTaskPrefix>.estimatedNumTasks

Testing Done

  • Local code review completed
  • Unit tests added/updated — extended testElasticTaskPartitionAssignmentCreatesAtMostMaxTasks to assert the new gauge reports the uncapped estimate (13) while numTasks reports the capped actual (5)
  • TestStickyPartitionAssignmentStrategy (15 tests) and TestLoadBasedPartitionAssignmentStrategy pass under JDK 17
  • checkstyleMain and checkstyleTest pass

🤖 Generated with GitHub Copilot CLI

Add a per-datastream `estimatedNumTasks` gauge in
StickyPartitionAssignmentStrategy that reports the estimated number of
tasks calculated for each stream during elastic task assignment. Unlike
the existing `numTasksCappedByMaxTasks` meter, which is only emitted when
the estimate exceeds maxTasks, this gauge is emitted for every stream and
records the uncapped estimate. An accompanying INFO log surfaces the same
value per datastream.
The metric is emitted from validateNumTasksAgainstMaxTasks, the common
choke point shared by StickyPartitionAssignmentStrategy and
LoadBasedPartitionAssignmentStrategy, so both strategies are covered.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant