Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(autocomplete): Implement key autocomplete for eap items #6978

Merged
merged 44 commits into from
Mar 20, 2025

Conversation

volokluev
Copy link
Member

@volokluev volokluev commented Mar 18, 2025

Requires #6970 to be merged
Requires getsentry/sentry#87511 to be merged

Resolves https://github.com/getsentry/eap-planning/issues/204

Implements the key autocomplete without the intersecting attributes filter, no longer supports attribute pagination:

See summarized decision here:

https://www.notion.so/sentry/Deprecating-pagination-in-autocomplete-APIs-1b98b10e4b5d80ab832ff700d49f15c3

Base automatically changed from volo/value_autocomplete_impl to master March 18, 2025 22:34
@volokluev volokluev marked this pull request as ready for review March 20, 2025 17:30
@volokluev volokluev requested review from a team as code owners March 20, 2025 17:30
Copy link

codecov bot commented Mar 20, 2025

❌ 1 Tests Failed:

Tests completed Failed Passed Skipped
2797 1 2796 11
View the top 1 failed test(s) by shortest run time
tests.web.rpc.v1.test_endpoint_trace_item_attribute_names.TestTraceItemAttributeNamesEAPItems::test_response_metadata
Stack Traces | 0.468s run time
Traceback (most recent call last):
  File ".../rpc/v1/test_endpoint_trace_item_attribute_names.py", line 330, in test_response_metadata
    res = EndpointTraceItemAttributeNames().execute(req)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../web/rpc/__init__.py", line 159, in execute
    return self.__after_execute(in_msg, out, error)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../web/rpc/__init__.py", line 212, in __after_execute
    raise error
  File ".../web/rpc/__init__.py", line 146, in execute
    out = self._execute(in_msg)
          ^^^^^^^^^^^^^^^^^^^^^
  File ".../rpc/v1/endpoint_trace_item_attribute_names.py", line 415, in _execute
    attributes=convert_co_occurring_results_to_attributes(in_msg, res),
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".../rpc/v1/endpoint_trace_item_attribute_names.py", line 350, in convert_co_occurring_results_to_attributes
    data.sort(key=lambda row: row.get("attr_key", ""))
TypeError: '<' not supported between instances of 'list' and 'tuple'

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

Copy link
Member

@onkar onkar left a comment

Choose a reason for hiding this comment

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

LGTM, added a couple of nits.

Comment on lines 82 to 85
map_elems = []
for key, val in ATTRIBUTE_MAPPINGS.items():
map_elems.append(key)
map_elems.append(val)
Copy link
Member

Choose a reason for hiding this comment

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

Are these map_elems intended to be used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

@@ -300,7 +338,18 @@ def t(row: Row) -> TraceItemAttributeNamesResponse.Attribute:
name=attr_name, type=getattr(AttributeKey.Type, attr_type)
)

return list(map(t, query_res.result.get("data", [])))
data = query_res.result.get("data", [])
Copy link
Member

Choose a reason for hiding this comment

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

nit: If "data" is not present in query_res.result, then we get an empty list, which is further extended but not persisted back to the result. Should it be persisted?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, the query_res variable is not used for anything after this function. Also, the data key in practice is always present

@@ -166,6 +166,12 @@ def _execute(
self, in_msg: TraceItemAttributeValuesRequest
) -> TraceItemAttributeValuesResponse:
in_msg.limit = in_msg.limit or 1000
# HACK (Volo): for backwards compatibility. eap_spans used to store this value,
# eap_items does not
if in_msg.key == "sentry.service":
Copy link
Member

Choose a reason for hiding this comment

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

I don't think sentry.service is used anywhere on the sentry side, probably safe to remove

Copy link
Member Author

Choose a reason for hiding this comment

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

it is, I checked with folks this morning

@volokluev volokluev merged commit d88bc15 into master Mar 20, 2025
32 checks passed
@volokluev volokluev deleted the volo/eap/key_autocomplete_impl branch March 20, 2025 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants