fix: handle default columns in logs and traces explorer #9722
+150
−4
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.

Root Cause Analysis: Logs Columns Applied in Traces Explorer
Problem
Sometimes default column options from Logs Explorer (
timestamp,body) are incorrectly applied in Traces Explorer, causing query failures because Traces queries don't support Logs-specific columns.Root Cause
Issue 1: Shared URL Parameter Without Validation
The
optionsURL parameter is shared between Logs and Traces explorers. When navigating from Logs to Traces, the URL may still contain Logs columns. ThetracesLoaderConfig.url()loader accepts any columns from the URL without validating they're valid for Traces.Flow:
/logs?options={"selectColumns":[{"name":"body","signal":"logs"},...]}/traces?options={"selectColumns":[{"name":"body","signal":"logs"},...]}tracesLoaderConfig.url()reads columns from URL → finds columns withlength > 0preferencesLoaderuses URL columns (priority:['local', 'url', 'default'])Issue 2: localStorage Contamination
Similar issue with localStorage - if
TRACES_LIST_OPTIONScontains Logs columns (from corruption or incorrect storage), they're loaded without validation.Issue 3: Incorrect Default Columns in View Selection
The
updateOrRestoreSelectColumnsfunction inExplorerOptions.tsxalways useddefaultTraceSelectedColumnsregardless of the current data source, causing incorrect fallback behavior.Solution
Fix 1: Column Validation in Loaders
Added validation in
tracesLoaderConfig.tsto filter out invalid columns:signal !== 'traces'body)timestampwithsignal='logs'Fix 2: Correct Default Columns Based on Data Source
Updated
updateOrRestoreSelectColumnsto use the correct default columns based onsourcepage:defaultTraceSelectedColumnsdefaultLogsSelectedColumnsImpact
Testing