-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose data service in the alert execution method #87990
Comments
Pinging @elastic/kibana-alerting-services (Team:Alerting Services) |
In that linked discussion, we had gone back and forth on whether to only provide scoped services in our server APIs, or to provide the entire The main reason the app team is blocked on this is because:
So I think the only way to unblock this would be for search strategies to make a breaking change and only provide a predefined list of scoped services, rather than the full request object. Then low-level search could pass these services in, and high-level search could also be updated to only require those services. At the moment search source would just require ES client & SO client in order to function on the server, so if this work were done no further changes would be required from the alerting service AFAICT... though it still might be nice to still expose |
Moving from |
If we provide the |
@mikecote yes, technically that would be enough. Though I want to raise the question if we wouldn't rather want to inject the data service. We're trying to establish most of those services as fundamentals across Kibana for all apps (index patterns, search source, expressions, etc.) If we consider that app Services wants them to be used across Kibana as much as possible and we're trying to move apps over usnig them, it feels like we should try to give access to the |
@timroes you can't inject the data service (well you can, but not scoped). You would need to inject specific parts of it scoped to the right user, so that's a lot of dependencies (search, searchsource, indexpatterns). I think passing in KibanaRequest is way more flexible and allows plugins to scope more. |
I did a quick POC last week and came to the same conclusion as @ppisljar. There wasn't a way to scope the entire start contract of the data service to the user automatically. An extra step would be necessary (by the alert type author) to scope the search, searchsource, indexpattern service to the user with a request. We've been getting a few requests to pass the |
Given what Peter mentioned it sounds maybe like the better solution to actually just pass the request and leave the scoping of the appropriate services to the individual plugins in this case. |
Closing as no longer needed. Feel free to open a PR if you need access to the request object. |
Currently you only get a scoped elasticsearch client and saved object client passed into the
services
of theexecutor
method of an alert type. Since we try to encourage usage of thedata
plugin and its services across Kibana it would be good if we could get that injected too as a service.Also to scope that at the moment you'll require a
KibanaRequest
(for the same reasons, that most likely the alerting framework is forging one internally - that most core services don't work without one). Since the alerting framework is anyway forging one it could scope that service as it is. Later on ideally for scoping we'd only need scoped clients, but that will require a lot of more core work, and could then internally be refactored inside the alerting framework without any alert type need adjustments. Previous discussion on why theKibanaRequest
is needed right now can be found in #78461This issue is currently blocking Alerting in core Kibana apps like Discover.
cc @lukeelmers @ppisljar
The text was updated successfully, but these errors were encountered: