CNS-138: console: distinct query history empty state when statement logging sampling is off - #38408
Draft
jubrad wants to merge 2 commits into
Conversation
Query history is backed by statement logging, which an operator can turn off by setting the sample rate to zero. Until now that produced the generic filter-oriented "No results found." state, giving the user no way to distinguish "sampling is off" from "my filters are too narrow". Read `statement_logging_max_sample_rate` alongside the list query and, when the result set is empty and the cap is zero, render a state that names both ways to raise it. The effective rate is the min of the session rate and this cap, so a zero cap is a hard opt-out.
Gate the sample rate read on an empty result set so it never sits in front of a populated table, make the API module's null contract match its behaviour, reword the remediation copy to cover both deployment modes, and collapse the duplicate list handler in the tests.
Contributor
|
Also have a PR for this : #36533 |
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.
https://linear.app/materializeinc/issue/CNS-138/console-distinct-empty-state-when-the-statement-logging-sample-rate-is
Problem
Query history is backed by statement logging, which an operator can turn off by setting the sample rate to
0. When that happens the console showed the generic filter-oriented "No results found." empty state, so the user could not tell that sampling is off from their filters being too narrow.Solution
console/src/api/materialize/query-history/statementLoggingMaxSampleRate.tsreadsSHOW statement_logging_max_sample_rate, following the existingmaxReplicasPerCluster.tspattern. The effective rate ismin(session statement_logging_sample_rate, system statement_logging_max_sample_rate), so a zero cap is a hard opt-out and reading the cap alone is enough to detect it.QueryHistoryListrenders a distinctSamplingDisabledStatewhen the result set is empty and the cap is0. The copy names both ways to raise it:ALTER SYSTEM SET statement_logging_max_sample_rate, and the Materialize operator's Helm chart values for self-managed. The filter-oriented empty state is unchanged for a non-zero rate.The new query is gated on
enabled: isEmpty, so it never runs (and never delays) the path that renders rows.Testing
console/src/api/materialize/query-history/statementLoggingMaxSampleRate.test.tssnapshots the compiled query. Two new cases inQueryHistoryList.test.tsxcover both empty-state branches. While adding them I foundDEFAULT_FETCH_QUERY_LIST_HANDLERnever matched anything: the schema defaultsdateRangeto a window ending atnew Date(), so its separatequeryHistoryListSchema.parse(...)produced different filters than thePARSED_DEFAULT_SCHEMA_VALUESthe component is rendered with. The handler now reuses the same parsed value.Notes for the reviewer
AppConfigSwitch.🤖 Generated with Claude Code