Skip to content

Add name filter to metrics - #23719

Merged
gabotechs merged 3 commits into
mainfrom
gabotechs/filter-metrics-by-name
Jul 28, 2026
Merged

Add name filter to metrics#23719
gabotechs merged 3 commits into
mainfrom
gabotechs/filter-metrics-by-name

Conversation

@gabotechs

@gabotechs gabotechs commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

  • Closes #.

Rationale for this change

Precedes #23720.

While displaying a plan with metrics, allow filtering them by name, not just by category or type.

This is very useful when writing snapshot tests where only a specific metrics needs to be asserted, without other unrelated metrics polluting the snapshot assertion.

Regardless of what happens with #23720, I think this PR is still worth it, as it allows creating some really nice insta tests asserting runtime properties reliably by just cherry picking the runtime metrics relevant for that specific test. This is relevant not only within DataFusion codebase, but also for other people's codebases using DataFusion and relying on insta for snapshot testing, See an example of this here: https://github.com/apache/datafusion/pull/23720/changes#diff-8281405e117428077c19c07afbbe59fed303a3460096e958f761d34f0899b618

What changes are included in this PR?

While displaying metrics, allows filtering them by name

Are these changes tested?

Yes, by a new small test.

Are there any user-facing changes?

People using the metrics display API will be able to filter metrics by name.

@github-actions github-actions Bot added physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate labels Jul 20, 2026
@codecov-commenter

codecov-commenter commented Jul 20, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.62921% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.88%. Comparing base (e8a65f2) to head (403c4d3).
⚠️ Report is 9 commits behind head on main.

Files with missing lines Patch % Lines
datafusion/physical-plan/src/display.rs 95.08% 0 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #23719      +/-   ##
==========================================
+ Coverage   80.66%   80.88%   +0.21%     
==========================================
  Files        1095     1095              
  Lines      372294   375556    +3262     
  Branches   372294   375556    +3262     
==========================================
+ Hits       300324   303771    +3447     
+ Misses      54055    53978      -77     
+ Partials    17915    17807     -108     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gabotechs
gabotechs force-pushed the gabotechs/filter-metrics-by-name branch from f743c5a to bd0852b Compare July 27, 2026 09:41
@gabotechs
gabotechs marked this pull request as ready for review July 27, 2026 09:42
@gabotechs

Copy link
Copy Markdown
Contributor Author

I'm opening this one for review, I think it's worth having it regardless of the other PR I'm mentioning in the description. cc @2010YOUY01

@kosiew kosiew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gabotechs
Looks good overall. I only have one small suggestion that could make the API contract a bit clearer for callers.

Comment thread datafusion/physical-plan/src/display.rs
@gabotechs
gabotechs force-pushed the gabotechs/filter-metrics-by-name branch from 2c01ff8 to 403c4d3 Compare July 28, 2026 08:21
@gabotechs

Copy link
Copy Markdown
Contributor Author

Thanks @kosiew for the review!

@gabotechs
gabotechs added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 1b32517 Jul 28, 2026
72 checks passed
@gabotechs
gabotechs deleted the gabotechs/filter-metrics-by-name branch July 28, 2026 09:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-expr Changes to the physical-expr crates physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants