File tree Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Expand file tree Collapse file tree 2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 5555RuleCondition = Union ["LogicalRuleCondition" , "ComparingRuleCondition" , "NotRuleCondition" ]
5656
5757# Maps from Discover's field names to event protocol paths. See Relay's
58- # ``FieldValueProvider `` for supported fields. All fields need to be prefixed
58+ # ``Getter`` implementation for ``Event `` for supported fields. All fields need to be prefixed
5959# with "event.".
6060# List of UI supported search fields is defined in sentry/static/app/utils/fields/index.ts
6161_SEARCH_TO_PROTOCOL_FIELDS = {
111111 "transaction.op" : "contexts.trace.op" ,
112112 "http.status_code" : "contexts.response.status_code" ,
113113 "unreal.crash_type" : "contexts.unreal.crash_type" ,
114+ "profile.id" : "contexts.profile.profile_id" ,
114115 # Computed fields
115116 "transaction.duration" : "duration" ,
116117 "release.build" : "release.build" ,
Original file line number Diff line number Diff line change 66from sentry .snuba .dataset import Dataset
77from sentry .snuba .metrics .extraction import (
88 OnDemandMetricSpec ,
9+ SearchQueryConverter ,
910 apdex_tag_spec ,
1011 cleanup_query ,
1112 failure_tag_spec ,
@@ -653,3 +654,26 @@ def test_to_standard_metrics_query(dirty, clean):
653654 clean_tokens = parse_search_query (clean )
654655
655656 assert cleaned_up_tokens == clean_tokens
657+
658+
659+ @pytest .mark .parametrize (
660+ "query, expected" ,
661+ [
662+ (
663+ "has:profile.id" ,
664+ {
665+ "op" : "not" ,
666+ "inner" : {"op" : "eq" , "name" : "event.contexts.profile.profile_id" , "value" : None },
667+ },
668+ ),
669+ (
670+ "profile.id:abc123" ,
671+ {"op" : "eq" , "name" : "event.contexts.profile.profile_id" , "value" : "abc123" },
672+ ),
673+ ],
674+ )
675+ def test_search_query_converter (query , expected ):
676+ tokens = parse_search_query (query )
677+ converter = SearchQueryConverter (tokens )
678+ condition = converter .convert ()
679+ assert expected == condition
You can’t perform that action at this time.
0 commit comments