Commit ba674cd 1 parent 092f0ff commit ba674cd Copy full SHA for ba674cd
File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change 55
55
RuleCondition = Union ["LogicalRuleCondition" , "ComparingRuleCondition" , "NotRuleCondition" ]
56
56
57
57
# 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
59
59
# with "event.".
60
60
# List of UI supported search fields is defined in sentry/static/app/utils/fields/index.ts
61
61
_SEARCH_TO_PROTOCOL_FIELDS = {
111
111
"transaction.op" : "contexts.trace.op" ,
112
112
"http.status_code" : "contexts.response.status_code" ,
113
113
"unreal.crash_type" : "contexts.unreal.crash_type" ,
114
+ "profile.id" : "contexts.profile.profile_id" ,
114
115
# Computed fields
115
116
"transaction.duration" : "duration" ,
116
117
"release.build" : "release.build" ,
Original file line number Diff line number Diff line change 6
6
from sentry .snuba .dataset import Dataset
7
7
from sentry .snuba .metrics .extraction import (
8
8
OnDemandMetricSpec ,
9
+ SearchQueryConverter ,
9
10
apdex_tag_spec ,
10
11
cleanup_query ,
11
12
failure_tag_spec ,
@@ -653,3 +654,26 @@ def test_to_standard_metrics_query(dirty, clean):
653
654
clean_tokens = parse_search_query (clean )
654
655
655
656
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