feat(eap): Sort trace item attributes by frequency#7833
Draft
feat(eap): Sort trace item attributes by frequency#7833
Conversation
Return attribute keys sorted by frequency (count) in descending order, with alphabetical ordering as a tiebreaker. This makes it easier for users to discover the most commonly used attributes in their traces. Previously, attributes were returned in alphabetical order only, which buried frequently-used attributes among less important ones. Changes: - Modified query to group by attribute key and count occurrences - Updated ORDER BY to sort by count DESC, then attr_key ASC - Added tests to verify frequency-based sorting behavior Refs EAP-432 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Return attribute keys sorted by frequency (count) in descending order, with alphabetical ordering as a tiebreaker for attributes with the same frequency.
This change makes it easier for users to discover the most commonly used attributes in their traces by surfacing them first in the results.
Motivation
Previously, attributes were returned in alphabetical order only, which meant frequently-used, important attributes could be buried among less relevant ones. By sorting by frequency first, users can quickly identify which attributes are most prevalent in their data.
Changes
count DESC, thenattr_key ASCas a tiebreakertest_sorted_by_frequency: Verifies alphabetical sorting when attributes have equal frequencytest_frequency_ordering_with_specific_attributes: Validates sorting with filtered resultsTechnical Details
The query now uses
count()withGROUP BY attr_keyinstead ofdistinct(), which allows us to order by frequency. Non-stored attributes (likesentry.service) are assigned a very high count to ensure they appear first.Refs EAP-432
🤖 Generated with Claude Code