Skip to content

[9.3] [Streams] Use original request for rules client when in default space (#247014)#247275

Merged
cesco-f merged 2 commits intoelastic:9.3from
cesco-f:backport/9.3/pr-247014
Dec 22, 2025
Merged

[9.3] [Streams] Use original request for rules client when in default space (#247014)#247275
cesco-f merged 2 commits intoelastic:9.3from
cesco-f:backport/9.3/pr-247014

Conversation

@cesco-f
Copy link
Copy Markdown
Contributor

@cesco-f cesco-f commented Dec 22, 2025

Backport

This will backport the following commits from main to 9.3:

Questions ?

Please refer to the Backport tool documentation

…elastic#247014)

Related to elastic#239968.

## Summary

Optimizes the `QueryService` to use the original request when operating
from the default space, only creating a fake request bound to the
default space when the request originates from a non-default space.

## Problem

Previously, `QueryService.getClientWithRequest()` was unconditionally
creating a fake request bound to the default space for the rules client,
even when the original request was already coming from the default
space. This was unnecessary overhead.

## Solution

- Added `SpacesPluginStart` as an optional dependency in
`StreamsPluginStartDependencies`
- Modified the logic to check the current space ID:
- If the request is from the **default space** → use the original
request
- If the request is from a **non-default space** → use the fake request
bound to the default space

(cherry picked from commit 1a8a9dd)

# Conflicts:
#	x-pack/platform/plugins/shared/streams/server/lib/streams/assets/query/query_service.ts
@cesco-f cesco-f requested review from a team as code owners December 22, 2025 14:40
@cesco-f cesco-f added the backport This PR is a backport of another PR label Dec 22, 2025
@cesco-f cesco-f enabled auto-merge (squash) December 22, 2025 14:40
@github-actions github-actions bot added the author:actionable-obs PRs authored by the actionable obs team label Dec 22, 2025
Copy link
Copy Markdown
Contributor

@CoenWarmer CoenWarmer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cesco-f cesco-f merged commit 64354ee into elastic:9.3 Dec 22, 2025
13 checks passed
@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #68 / discover/tabs discover - ES|QL controls should add an ES|QL multi - value control

Metrics [docs]

✅ unchanged

History

@cesco-f cesco-f deleted the backport/9.3/pr-247014 branch December 23, 2025 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author:actionable-obs PRs authored by the actionable obs team backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants