@@ -104,7 +104,7 @@ class OrganizationTraceItemAttributesEndpointBase(OrganizationEventsV2EndpointBa
104104 publish_status = {
105105 "GET" : ApiPublishStatus .PRIVATE ,
106106 }
107- owner = ApiOwner .VISIBILITY
107+ owner = ApiOwner .DATA_BROWSING
108108 feature_flags = [
109109 "organizations:ourlogs-enabled" ,
110110 "organizations:visibility-explore-view" ,
@@ -231,7 +231,9 @@ def get(self, request: Request, organization: Organization) -> Response:
231231 )
232232
233233 use_sentry_conventions = features .has (
234- "organizations:performance-sentry-conventions-fields" , organization , actor = request .user
234+ "organizations:performance-sentry-conventions-fields" ,
235+ organization ,
236+ actor = request .user ,
235237 )
236238
237239 sentry_sdk .set_tag ("feature.use_sentry_conventions" , use_sentry_conventions )
@@ -248,7 +250,9 @@ def get(self, request: Request, organization: Organization) -> Response:
248250 referrer = resolve_attribute_referrer (trace_item_type , attribute_type )
249251 column_definitions = get_column_definitions (trace_item_type )
250252 resolver = SearchResolver (
251- params = snuba_params , config = SearchResolverConfig (), definitions = column_definitions
253+ params = snuba_params ,
254+ config = SearchResolverConfig (),
255+ definitions = column_definitions ,
252256 )
253257 query_filter , _ , _ = resolver .resolve_query (query_string )
254258 meta = resolver .resolve_meta (referrer = referrer .value )
@@ -287,16 +291,22 @@ def data_fn(offset: int, limit: int):
287291 attribute_keys = {}
288292 for attribute in rpc_response .attributes :
289293 if attribute .name and can_expose_attribute (
290- attribute .name , trace_item_type , include_internal = include_internal
294+ attribute .name ,
295+ trace_item_type ,
296+ include_internal = include_internal ,
291297 ):
292298 attr_key = as_attribute_key (
293- attribute .name , serialized ["attribute_type" ], trace_item_type
299+ attribute .name ,
300+ serialized ["attribute_type" ],
301+ trace_item_type ,
294302 )
295303 public_alias = attr_key ["name" ]
296304 replacement = translate_to_sentry_conventions (public_alias , trace_item_type )
297305 if public_alias != replacement :
298306 attr_key = as_attribute_key (
299- replacement , serialized ["attribute_type" ], trace_item_type
307+ replacement ,
308+ serialized ["attribute_type" ],
309+ trace_item_type ,
300310 )
301311
302312 attribute_keys [attr_key ["name" ]] = attr_key
@@ -312,12 +322,16 @@ def data_fn(offset: int, limit: int):
312322 ),
313323 [
314324 as_attribute_key (
315- attribute .name , serialized ["attribute_type" ], trace_item_type
325+ attribute .name ,
326+ serialized ["attribute_type" ],
327+ trace_item_type ,
316328 )
317329 for attribute in rpc_response .attributes
318330 if attribute .name
319331 and can_expose_attribute (
320- attribute .name , trace_item_type , include_internal = include_internal
332+ attribute .name ,
333+ trace_item_type ,
334+ include_internal = include_internal ,
321335 )
322336 ],
323337 )
@@ -375,7 +389,7 @@ def data_fn(offset: int, limit: int):
375389
376390 with handle_query_errors ():
377391 tag_values = executor .execute ()
378- tag_values .sort (key = lambda tag : tag .value )
392+ tag_values .sort (key = lambda tag : tag .value or "" )
379393 return tag_values
380394
381395 return self .paginate (
@@ -425,7 +439,11 @@ def resolve_attribute_key(
425439 resolved_attr , context_definition = self .resolver .resolve_attribute (key )
426440 if context_definition :
427441 resolved_attr = self .resolver .map_context_to_original_column (context_definition )
428- return resolved_attr .search_type , resolved_attr .proto_definition , context_definition
442+ return (
443+ resolved_attr .search_type ,
444+ resolved_attr .proto_definition ,
445+ context_definition ,
446+ )
429447
430448 def execute (self ) -> list [TagValue ]:
431449 func = self .autocomplete_function .get (self .key )
@@ -545,7 +563,8 @@ def semver_build_autocomplete_function(self):
545563 def semver_package_autocomplete_function (self ):
546564 packages = (
547565 Release .objects .filter (
548- organization_id = self .snuba_params .organization_id , package__startswith = self .query
566+ organization_id = self .snuba_params .organization_id ,
567+ package__startswith = self .query ,
549568 )
550569 .values_list ("package" )
551570 .distinct ()
0 commit comments