chore(explore): Migrate logs and spans to nuqs#116278
Draft
nsdeschenes wants to merge 12 commits into
Draft
Conversation
Extract reusable nuqs parsers (mode, extrapolate, fields, sortBys, groupBys, visualizes, aggregateFields, crossEvents) and a serializeQueryParamsToLocation helper. Export parseAggregateField, parseCrossEvents, and validateSort so the parsers can use them.
Replace manual location/navigate wiring in SpansQueryParamsProvider with nuqs useQueryStates. Add getReadableQueryParamsFromParsed and getSpansQueryParamsUpdate to work with parsed nuqs values. Export key constants so the provider can reference them directly.
Replace manual location/navigate wiring in LogsLocationQueryParamsProvider with nuqs useQueryStates. Add getReadableQueryParamsFromParsed and getLogsQueryParamsUpdate to work with parsed nuqs values. Legacy aggregate params (logsAggregate, logsAggregateParam, logsGroupBy) are cleared when aggregateFields are set.
Replace direct navigate calls with useSetQueryParamsAggregateCursor in AggregatesTable and add useSetQueryParamsAggregateSortBys onClick handler in LogsAggregateTable so sorting works through context setters instead of only through link href.
Contributor
Author
|
@sentry review |
Contributor
Author
|
@cursor review |
Contributor
📊 Type Coverage Diff
🔍 9 new type safety issues introduced
Non-null assertions (
Type assertions (
This is informational only and does not block the PR. |
Move defaultMode, defaultCursor, getValidSortBys, getValidAggregateSortBys, and normalizeAggregateFields from logs/spans queryParams into shared modules to eliminate identical copy-pasted implementations. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Un-export constants, types, and functions that are only used internally. Remove dead isDefaultFields functions from logs and spans query params. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix serializeQueryParamsToLocation to preserve array types for multi-parser values instead of collapsing single-element arrays - Fix SentryNuqsTestingAdapter to read from location.query when location.search is empty, matching how test mocks set query params - Migrate useTab to route mode and table changes through nuqs setQueryParams instead of direct navigate calls - Stabilize readableQueryParams memoization in providers to prevent extra re-renders from nuqs reference changes - Add table param to spansQueryParamsParsers and WritableQueryParams - Use renderHookWithProviders in useStreamingTimeseriesResult tests Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
…grate-logs-and-spans-to-nuqs
Keep parsed span query params in sync with local writes while nuqs updates the URL, and preserve referenced aggregate fields when switching modes. Co-Authored-By: OpenAI Codex <noreply@openai.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 5c773d3. Configure here.
Remove the spans query-param optimistic mirror and use the Explore query-param API for attribute breakdown tab changes instead of rebuilding the URL from location.query. Co-Authored-By: OpenAI Codex <noreply@openai.com>
When Pagination emits an undefined aggregate cursor, remove the aggregate cursor query parameter so the table returns to page 1. Co-Authored-By: GPT-5 Codex <codex@openai.com>
Move the common aggregate field defaulting logic into the shared query params helper so spans and logs use the same implementation. Co-Authored-By: GPT-5 Codex <codex@openai.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.

This PR is an attempt to migrate the query params for logs and spans from react router over to nuqs.