Skip to content

[9.4] [Discover][Traces] Fix nonHighlightingFilters lost in session tab serialization (#261558)#264345

Merged
kibanamachine merged 2 commits into
elastic:9.4from
kibanamachine:backport/9.4/pr-261558
Apr 21, 2026
Merged

[9.4] [Discover][Traces] Fix nonHighlightingFilters lost in session tab serialization (#261558)#264345
kibanamachine merged 2 commits into
elastic:9.4from
kibanamachine:backport/9.4/pr-261558

Conversation

@kibanamachine
Copy link
Copy Markdown
Contributor

Backport

This will backport the following commits from main to 9.4:

Questions ?

Please refer to the Backport tool documentation

…ialization (elastic#261558)

## Summary

Relates to elastic#261234

`nonHighlightingFilters` was silently dropped during `fromStoredTab` /
`toStoredTab` serialization in the Discover session embeddable as part
of [[Discover Sessions as Code] Discover search embeddable: API schema,
transforms, and feature
flag](elastic#255213). This caused the
logs section in the traces flyout to run without the trace context
filter (`trace.id`, `transaction.id`, `span.id`), returning all logs in
the index instead of only the ones correlated to the opened trace
document.

|Before|After|
|-|-|
|<img width="1496" height="965" alt="Screenshot 2026-04-07 at 15 05 34"
src="https://github.com/user-attachments/assets/9a1f21cd-3359-4753-b7d6-3bf1e3cef758"
/>|<img width="1495" height="965" alt="Screenshot 2026-04-07 at 15 03
34"
src="https://github.com/user-attachments/assets/87fb9b18-6bef-49dd-94ec-a3eea1d895f8"
/>|

`nonHighlightingFilters` was introduced in [[One Discover] [Logs UX]Add
support to disable highlighting for certain filters we deem
internal](elastic#239402) to allow
certain filters (trace context constraints) to be applied to the ES
query without affecting result highlighting. The `fromStoredTab` /
`toStoredTab` serialization round-trip was added later in [[Discover
Sessions as Code] Discover search embeddable: API schema, transforms,
and feature flag](elastic#255213) and
never included this field.

~~The fix ensures `nonHighlightingFilters` is read back from the
serialized search source in `fromStoredTab` and written into
`toStoredTab`, and adds the corresponding field to the server-side
schema.~~

The fix avoids exposing `nonHighlightingFilters` as a public API schema
field entirely. Since trace context filters are always runtime-derived
from the opened document (`traceId`, `spanId`, `transactionId`), they
never need to be persisted in the serialized state.

The runtime prop path, `nonHighlightingQuery` →
`createLogEventsRenderer` → `nonHighlightingFilters` on the initial
searchSource, already handles the use case correctly on every mount.

A `syncNonHighlightingFilters` effect has also been added to
`SavedSearchComponentTable` as a defensive measure, consistent with how
other dynamic props (`filters`, `query`, `timeRange`) are synced after
mount.

A defensive e2e test has been added: it opens the minimal trace flyout
(2 correlated logs) and asserts the logs section shows exactly 2
results.

(cherry picked from commit ca6f9ec)
@kibanamachine kibanamachine merged commit 5b7deab into elastic:9.4 Apr 21, 2026
14 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] Jest Integration Tests #4 / workflow with wait step when duration is short should have correct workflow duration

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 2.7MB 2.7MB +257.0B
fleet 2.3MB 2.3MB +257.0B
infra 1.5MB 1.5MB +257.0B
logsShared 98.1KB 98.4KB +257.0B
unifiedDocViewer 672.7KB 672.7KB +15.0B
total +1.0KB

History

cc @iblancof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants