Commit 3d45d5d
Add starts with filter options (#6062)
* Add "starts with" and "does not start with" filters for stacks/frames
This commit adds two new string filter types to match "contains" and "does not contain":
- starts_with: matches strings that start with the specified prefix
- not_starts_with: matches strings that do not start with the specified prefix
Changes:
- proto: Added starts_with and not_starts_with fields to StringCondition message
- backend: Updated matchesStringCondition() to handle new filter types using bytes.HasPrefix
- frontend UI: Added "Starts With" and "Not Starts With" options to filter dropdown
- frontend types: Updated ProfileFilter interface and createStringCondition() for new match types
- tests: Added 4 comprehensive tests covering stack and frame filters with both new filter types
The implementation follows the same pattern as existing contains/not_contains filters,
with case-insensitive matching and proper null handling.
* [pre-commit.ci lite] apply automatic fixes
* Fix: Add NotStartsWith to negative condition checks
The NotStartsWith filter was being treated as a positive condition, causing
incorrect filter logic. Stack filters with negative conditions need ALL
functions to not match (AND logic), while positive conditions need ANY
function to match (OR logic).
Fixed in 4 functions:
- handleUnsymbolizedFunctionCondition
- matchesFunctionNameInRange
- matchesSystemNameInRange
- matchesFilenameInRange
This fixes the failing TestStackFilterFunctionNameNotStartsWith test.
* Fix test compatibility with NewRecordReader API change
NewRecordReader now returns (reader, error) instead of just reader.
Updated all 4 test cases to handle the error return value.
---------
Co-authored-by: Claude <[email protected]>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>1 parent 801f32b commit 3d45d5d
File tree
10 files changed
+532
-13
lines changed- gen/proto
- go/parca/query/v1alpha1
- swagger/parca
- query/v1alpha1
- pkg/query
- proto/parca/query/v1alpha1
10 files changed
+532
-13
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1763 | 1763 | | |
1764 | 1764 | | |
1765 | 1765 | | |
| 1766 | + | |
| 1767 | + | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
1766 | 1774 | | |
1767 | 1775 | | |
1768 | 1776 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
808 | 808 | | |
809 | 809 | | |
810 | 810 | | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
811 | 819 | | |
812 | 820 | | |
813 | 821 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
715 | 715 | | |
716 | 716 | | |
717 | 717 | | |
718 | | - | |
719 | | - | |
| 718 | + | |
| 719 | + | |
720 | 720 | | |
721 | | - | |
722 | | - | |
| 721 | + | |
| 722 | + | |
723 | 723 | | |
724 | 724 | | |
725 | 725 | | |
726 | 726 | | |
727 | 727 | | |
728 | 728 | | |
729 | | - | |
730 | | - | |
| 729 | + | |
| 730 | + | |
731 | 731 | | |
732 | 732 | | |
733 | | - | |
| 733 | + | |
734 | 734 | | |
735 | 735 | | |
736 | 736 | | |
| |||
771 | 771 | | |
772 | 772 | | |
773 | 773 | | |
774 | | - | |
| 774 | + | |
775 | 775 | | |
776 | 776 | | |
777 | 777 | | |
| |||
802 | 802 | | |
803 | 803 | | |
804 | 804 | | |
805 | | - | |
| 805 | + | |
806 | 806 | | |
807 | 807 | | |
808 | 808 | | |
| |||
1003 | 1003 | | |
1004 | 1004 | | |
1005 | 1005 | | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
1006 | 1012 | | |
1007 | 1013 | | |
1008 | 1014 | | |
| |||
0 commit comments