-
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
[RAC] Add higher-level helper to ruleRegistry plugin exports #101541
Comments
Agreed that a helper (for the bootstrap process) is more than useful here. I'm not sure if |
Makes sense, @dgieselaar -- I am mostly trying to avoid leaking the RuleDataClient abstraction to my plugin if I don't really need to use it, i.e. receiving it only to pass it back to something from the ruleRegistry plugin. Maybe a class that retains a reference to its client would allow for this? const ruleRegistration = new RuleRegistration({
appName: "logs",
mapping: {}
});
const createLogsRuleType = ruleRegistration.createRuleTypeFactory();
ruleRegistration.client.getReader().search() // etc. |
Pinging @elastic/security-solution (Team: SecuritySolution) |
Pinging @elastic/logs-metrics-ui (Team:logs-metrics-ui) |
Done by @banderror |
Related:
In Logs and Metrics, we're just using the basic ruleRegistry flow for now. I think it's a smart idea to provide access to the lower-level primitive methods for creating index templates, etc., especially as we start to take advantage of fields, but I think we could find a middle ground for an API that is similar to what we had before but without going all the way back to wrapping the entire alerting framework's API and becoming our own framework, if we don't want to do that.
I'm thinking it would be nice to have an API like this:
This encapsulates the logger, the cluster client, the need for
core.getStartServices
, the index and component template creation, the check forisWriteEnabled
, and everything about the rule data client inside of the ruleRegistry plugin until I need it. (I'd also be okay with starting out with something likeconst { createLifecycleRuleType } = plugins.ruleRegistry.createLifecycleRuleTypeFactory()
so we can add to the return of that factory function over time ...)This pattern currently aligns with what we're doing for our Logs/Metrics rule types and seems like it'd work for the Uptime rule type registration, also.
The text was updated successfully, but these errors were encountered: