feat(snuba): Allow customizing attribute sort (default or natural)#334
Open
phacops wants to merge 1 commit into
Open
feat(snuba): Allow customizing attribute sort (default or natural)#334phacops wants to merge 1 commit into
phacops wants to merge 1 commit into
Conversation
Add an opt-in `sort` field to the OrderBy message on both TraceItemAttributeNamesRequest and TraceItemAttributeValuesRequest so callers can choose between default (lexicographic) and natural ordering when ordering attribute names/values alphabetically. The new `Sort` enum offers SORT_DEFAULT (lexicographic, e.g. "item10" before "item2") and SORT_NATURAL (digit runs compared numerically, e.g. "item2" before "item10"). The field is additive and backwards compatible: leaving `sort` unset (SORT_UNSPECIFIED) preserves the historical lexicographic ordering, so existing callers are unaffected. It only applies to textual columns (COLUMN_NAME / COLUMN_VALUE) and is ignored for COLUMN_COUNT. Regenerates the committed Rust bindings and adds Python example tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017A2WYa5y2PyvFt99kpe4aa
|
The latest Buf updates on your PR. Results from workflow ci / buf-checks (pull_request).
|
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.
Summary
Adds an opt-in
sortfield to theOrderBymessage on bothTraceItemAttributeNamesRequestandTraceItemAttributeValuesRequest, lettingcallers choose between default (lexicographic) and natural ordering when
ordering attribute names/values alphabetically.
This is a follow-up to #316, which added opt-in
order_byto these twoendpoints. That change let callers pick what to order by (name/value vs.
count); this change lets them pick how the textual ordering is applied.
What changed
A new nested
Sortenum is added to eachOrderBymessage:SORT_UNSPECIFIED(0)SORT_DEFAULT; preserves historical behaviour when unsetSORT_DEFAULT(1)item10beforeitem2)SORT_NATURAL(2)item2beforeitem10)The
sortfield only applies to textual columns (COLUMN_NAME/COLUMN_VALUE) and is ignored forCOLUMN_COUNT.Backwards compatibility
The change is purely additive (new enum + new field at tag
3on eachOrderBy). Leavingsortunset keeps the existing lexicographic ordering, soexisting callers are unaffected. Verified with
buf breaking --against main(no breaking changes) and
buf lint(clean).Generated code & tests
rust/src/sentry_protos.snuba.v1.rs)via
make build-rust;cargo checkpasses.Cargo.lockpicks up thealready-bumped
sentry_protoscrate version (0.34.1 → 0.35.0).names and values requests, including a serialization round-trip. Full
Python suite passes (53 tests).
Test plan
make build-rustregenerates with no spurious diff;cargo checkpassespython py/generate.py+pytest py/tests/→ 53 passedbuf lint→ cleanbuf breaking --against '.git#branch=main'→ no breaking changes🤖 Generated with Claude Code
https://claude.ai/code/session_017A2WYa5y2PyvFt99kpe4aa
Generated by Claude Code