Skip to content

Comments

feat: Update trace filtering to support array-based eq/neq filters and numeric filters (gt, gte, lt, lte)#4781

Merged
shrutip90 merged 4 commits intomainfrom
sp/filter-exp
Feb 20, 2026
Merged

feat: Update trace filtering to support array-based eq/neq filters and numeric filters (gt, gte, lt, lte)#4781
shrutip90 merged 4 commits intomainfrom
sp/filter-exp

Conversation

@shrutip90
Copy link
Contributor

@shrutip90 shrutip90 commented Feb 19, 2026

While implementing filtering on dev UI, I was having issues doing neq filter for type along with the "Show only Genkit traces" since that needs a second neq filter. So I have modified the eq/neq filters to take arrays instead to check for multiple eq conditions that will be ORed and multiple neq conditions that will be ANDed.

Also, added numeric filters (gt, gte, lt, lte) that can be used to perform time range filtering on dev UI.

Related to #4439

Checklist (if applicable):

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @shrutip90, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the trace filtering capabilities within the system, particularly for the developer UI. It introduces the ability to filter traces based on multiple equality or inequality conditions using arrays, and adds robust numeric comparison operators for fields like start/end times. These changes provide more granular control and flexibility when searching and analyzing trace data.

Highlights

  • Enhanced Trace Filtering Schema: The TraceQueryFilterSchema now supports array-based values for eq (OR condition) and neq (AND condition) filters, allowing for more flexible matching against multiple values. Additionally, new numeric comparison filters (gt, gte, lt, lte) have been introduced for greater-than, greater-than-or-equal-to, less-than, and less-than-or-equal-to operations, respectively.
  • Implemented Advanced Filtering Logic: The trace store's filtering mechanism has been updated to correctly process the new array-based eq/neq conditions and the numeric comparison filters. This enables more sophisticated querying of trace data.
  • Comprehensive Test Coverage: New unit tests have been added to validate the functionality of both the array-based eq/neq filters (including mixed types) and the numeric comparison filters, ensuring their correct behavior.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • genkit-tools/common/src/types/apis.ts
    • Introduced PrimitiveSchema and FilterValueSchema to allow array values for eq and neq filters.
    • Added gt, gte, lt, lte properties to TraceQueryFilterSchema for numeric comparisons.
  • genkit-tools/telemetry-server/src/file-trace-store.ts
    • Refactored eq and neq filter logic to handle both single primitive values and arrays of primitive values.
    • Implemented filtering logic for gt, gte, lt, and lte conditions, ensuring values are numeric.
  • genkit-tools/telemetry-server/tests/file_store_test.ts
    • Added test cases to verify array-based eq (IN) and neq (NOT IN) filtering.
    • Included a test case for mixed-type array filters (number and string).
    • Added comprehensive test cases for numeric comparison filters (gt, gte, lt, lte), including combined conditions.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request successfully implements array-based inclusion/exclusion filters and numeric comparison filters for trace queries. The logic correctly handles the OR-ing of multiple values in eq filters and the AND-ing of multiple values in neq filters. The addition of numeric filters (gt, gte, lt, lte) is well-implemented and tested. I've provided a suggestion to refactor the filtering logic in file-trace-store.ts to be more concise and slightly more efficient by reducing repeated object key lookups and logic duplication.

Copy link
Contributor

@ssbushi ssbushi left a comment

Choose a reason for hiding this comment

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

LGTM from me

@shrutip90 shrutip90 enabled auto-merge (squash) February 20, 2026 22:04
@shrutip90 shrutip90 merged commit 4396dfe into main Feb 20, 2026
20 checks passed
@shrutip90 shrutip90 deleted the sp/filter-exp branch February 20, 2026 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants