Commit f5bb11c
[SPARK-50301][SS] Make TransformWithState metrics reflect their intuitive meanings
### What changes were proposed in this pull request?
These changes make the following changes to metrics in TWS:
- `allUpdatesTimeMs` now captures the time it takes to process all the new data with the user's stateful processor.
- `timerProcessingTimeMs` was added to capture the time it takes to process all the user's timers.
- `allRemovalsTimeMs` now captures the time it takes to do TTL cleanup at the end of a micro-batch.
- `commitTimeMs` now captures _only_ the time it takes to commit the state, not the TTL cleanup.
With these metrics, a user can have a fairly clear picture of where time is being spent in a micro-batch that uses TWS:

### Why are the changes needed?
The metrics today misrepresent what they're actually measuring.
### Does this PR introduce _any_ user-facing change?
Yes. Metrics for TWS are changing. However, since TWS is `private[sql]`, this shouldn't impact any real users.
### How was this patch tested?
We don't have any way to test these metrics in _any_ stateful operator for streaming today.
### Was this patch authored or co-authored using generative AI tooling?
No
Closes #48862 from neilramaswamy/spark-50301.
Authored-by: Neil Ramaswamy <[email protected]>
Signed-off-by: Jungtaek Lim <[email protected]>1 parent ea222a3 commit f5bb11c
File tree
2 files changed
+97
-12
lines changed- sql/core/src
- main/scala/org/apache/spark/sql/execution/streaming
- test/scala/org/apache/spark/sql/streaming
2 files changed
+97
-12
lines changedLines changed: 27 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
343 | 343 | | |
344 | 344 | | |
345 | 345 | | |
346 | | - | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
347 | 356 | | |
348 | 357 | | |
349 | 358 | | |
350 | | - | |
| 359 | + | |
351 | 360 | | |
352 | 361 | | |
353 | 362 | | |
| |||
360 | 369 | | |
361 | 370 | | |
362 | 371 | | |
363 | | - | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
364 | 377 | | |
365 | | - | |
| 378 | + | |
366 | 379 | | |
367 | 380 | | |
368 | 381 | | |
| |||
376 | 389 | | |
377 | 390 | | |
378 | 391 | | |
379 | | - | |
380 | | - | |
381 | | - | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
382 | 396 | | |
383 | 397 | | |
384 | 398 | | |
| |||
387 | 401 | | |
388 | 402 | | |
389 | 403 | | |
390 | | - | |
391 | | - | |
392 | | - | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
393 | 408 | | |
394 | 409 | | |
395 | | - | |
396 | | - | |
397 | 410 | | |
398 | 411 | | |
399 | 412 | | |
| |||
419 | 432 | | |
420 | 433 | | |
421 | 434 | | |
| 435 | + | |
| 436 | + | |
422 | 437 | | |
423 | 438 | | |
424 | 439 | | |
| |||
Lines changed: 70 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
401 | 401 | | |
402 | 402 | | |
403 | 403 | | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
404 | 428 | | |
405 | 429 | | |
406 | 430 | | |
| |||
708 | 732 | | |
709 | 733 | | |
710 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
711 | 781 | | |
712 | 782 | | |
713 | 783 | | |
| |||
0 commit comments