fix(server): handle boolean metadata filters in span DSL#11805
fix(server): handle boolean metadata filters in span DSL#11805RogerHYang merged 3 commits intoArize-ai:mainfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
|
Hey @pandego, I actually wasn't able to reproduce this issue on the latest version of Phoenix. Have you been able to reproduce? |
|
Thanks for checking. Here is the exact repro I used:
If you are not seeing it on latest Phoenix, can you share the exact version/commit you tested? |
|
Yes I can repro the issue. |
|
Quick confirmation from my side on latest I tested So boolean metadata is still being cast as float in the filter translator. |
|
Thank you for your contribution! |
fixes #11743
The spans filter DSL currently leaves metadata lookups as raw JSON when compared to booleans. In Postgres this can fail at runtime because JSON values are compared directly against boolean literals.
This change updates the filter translator to cast attribute/metadata JSON lookups to as_boolean() when the other side of the comparison is a boolean literal. Existing string/float behavior is unchanged.
Validation:
Note
Medium Risk
Changes the filter AST translation logic for comparisons involving JSON attributes, which can affect generated SQL and query results. Scope is targeted to boolean literal comparisons and covered by new unit tests, but still impacts runtime filtering behavior.
Overview
Fixes span filter DSL boolean comparisons by detecting boolean literals and translating
metadata[...]/attributes[...]lookups toas_boolean()instead of default string casting.Tightens literal typing by excluding
boolfrom_is_float_constantand adds unit tests covering==, reversed operand order, andis/is notboolean comparisons to ensure correct translation.Written by Cursor Bugbot for commit e36ccf9. This will update automatically on new commits. Configure here.