[Observability] Fix KQL autocomplete in custom threshold rule creation#250044
Merged
Conversation
Contributor
|
Pinging @elastic/obs-ux-management-team (Team:obs-ux-management) |
Contributor
miguelmartin-elastic
left a comment
There was a problem hiding this comment.
lgtm. Tested it locally ✅
miguelmartin-elastic
approved these changes
Jan 22, 2026
Contributor
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Module Count
Async chunks
Page load bundle
History
|
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.
It closes #249869
Related to: #246674
Summary
kqlservice is now injected directly into the rule expression component via a factory functionkqlin their plugin dependencieskqlfrom optional to required plugins in the observability plugin manifestTechnical details
Problem
The custom threshold rule can be opened from multiple plugins (observability, infra, triggers_actions_ui). Previously, the rule expression component tried to get the
kqlservice from the Kibana context, but this failed when the rule form was opened from plugins that don't havekqlin their dependencies.Additionally, rule types are registered during the setup phase, but
KqlPluginStartis only available during the start phase.Solution
The
kqlservice is now directly injected into the custom threshold rule expression component using a factory function. This approach:kqlservice always comes from the observability plugin (which owns the rule type), not from the consumer pluginkqlto their dependencies just to use the custom threshold ruledynamic()withgetStartServices()to defer fetching thekqlservice until the component is actually renderedE2E test:
Before:
Screen.Recording.2026-01-21.at.15.59.54.mov
After:
Screen.Recording.2026-01-21.at.16.01.26.mov