Add anomaly detail and time filters - #1316
Draft
heyglassy wants to merge 1 commit into
Draft
Conversation
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.
What changed
--period,--from, and--tofiltering topscale insights anomaliesWhy
The anomalies command previously only listed the API's default window and could not retrieve the query correlations attached to a specific anomaly. This makes historical investigation and root-cause analysis available directly from the CLI.
Before and after
This came out of an investigation into July 24 anomalies. Before this change, the CLI could only list summary records from the API's default window: there was no CLI invocation that could select July 24 or retrieve one anomaly by ID. Investigating a possible cause required fetching 47 Query Insights fingerprints and drilling into them individually. The result was execution data like this, which was not linked to an anomaly (
tagswas empty):{ "started_at": "2026-07-24T19:15:34.000Z", "total_duration_millis": 3968, "rows_read": 3, "rows_returned": 1, "shard_queries": 6, "error_message": null, "tags": [] }After this change, the historical anomalies can be requested directly:
The returned ID can then be used to fetch the anomaly's complete detail payload:
This real anomaly had no correlations recorded, so the API omitted
correlations. When correlations are present, the same detail response includes their coefficient, keyspace, fingerprint, normalized SQL, and tablet type.Impact
Users can select a supported named period or explicit time range, then drill into an anomaly without leaving
pscale. Existing list usage remains compatible and continues to use the API default window when no time flags are provided.Validation
go test ./internal/cmd/insights ./internal/planetscalego test ./...git diff --check