-
Notifications
You must be signed in to change notification settings - Fork 898
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
[PROPOSAL] Per-provider Event Timelines With Regex Support #17295
Comments
ProposalTimeline Shows Events of All Providers, Not Just NuageEmsEvent object has Event Timeline Categories are Mixed Across ProvidersWhat if we don't filter out events based only on Each Event Type Must Be Manually Mapped to Category, No Regex SupportedWe could simply allow SQL LIKE kind of event types in the mapping yaml and we could then append each of them to the WHERE clause like this:
(Not fan of manually building SQL statement, but whatever) WDYT? |
I agree that if you click Monitoring -> Timelines for a particular EMS, you'd only want to see that EMS. However, we would have to verify that there are no timeline presentation screen that do cross-provider views. If you go to the "all emses" page, can you check multiple providers and go to timeline, for example? Might need someone from UI to help verify.
source is probably not good enough because we also create synthetic events for some providers, where the source is EVM, for example. Also, there's no strict mapping between provider and source, so all providers would have to have have some individual way to detect that. I've always disliked this column, btw, and have wanted to get rid of it, instead opting for a What we may be able to do is change the event_groups such that we get rid of the merging altogether, and then instead of hash lookups, have a method that does dynamic lookups based on the provider. Part of the reason for the caching was that in the past, this stuff was loaded from disk. Now that it's in settings it's always available in memory, so doing lookups dynamically is not an issue.
you can use chaining where clauses with SQL fragments: [9] pry(main)> EmsEvent.where("event_type LIKE ?", "%foo%").or(EmsEvent.where("event_type LIKE ?", "%bar%"))
EmsEvent Load (1.5ms) SELECT "event_streams".* FROM "event_streams" WHERE ("event_streams"."type" IN ('EmsEvent') AND (event_type LIKE '%foo%') OR "event_streams"."type" IN ('EmsEvent') AND (event_type LIKE '%bar%')) using where clauses in this way will also prevent SQL injection, which is important if we are going to let the user define parts of a query.
This all sounds good to me! |
cc @agrare @blomquisg on your thoughts here. |
Re SQL chaining, I wonder if there are any reasons not to user PG regexps? It looks to me that POSIX regular expressions have been around at least since PG 9.0. Thus, Instead of chaining
Of course, this depends on whether we'd like to support POSIX regular expressions in settings, i.e. for the above example, admin would have specify this as
|
Updating code not to build SQL statement manually is then the 4th problem with timelines that we could address. This one, however, could be a bit tricky to solve because it seems to be deeply integrated in MIQ like this: r = MiqReport.new
r.where_clause = [') and (timestamp >= ? and timestamp <= ?) and (event_type in (?))', *params]
r.to_timeline Not sure, but I think MiqReport uses those hard-coded SQL In other words: I don't think we should go that deep. EDIT: there seems to exist another approach to event filtering by leveraging |
I did some digging in timeline-related parts of code and found this out. First, events are filtered by As for the regular expression support, I extended the core and ui that now allow classifying the events by matching them against a set of regular expressions. Details are described in the commit messages and pull request descriptions. For example, configuration snippet in comment from @gberginc above can be written as:
Regular expressions are listed under separate level in order to avoid auto-detection of event type templates. @Fryguy Does anything from the pull requests make sense? |
Awesome, we must have overlooked the line that filters by ems_id back then when doing quick research 👍 Knowing this, as long as we can bring regex support upstream I think we're good for Nuage. |
Also implemented in ManageIQ/manageiq-providers-redfish#34. |
Has any of this been backported to Gaprindashvili? AFAICT this is only in Hammer. |
It's Hammer only so far. Right @tadeboro ? |
@cben @miha-plesko that's correct it is only in |
So I'm playing with Timelines feature for one of the providers (Nuage). Talking about this view here:
And there are three problems I see:
Timeline Shows Events of All Providers, Not Just Nuage
Looking at source code I can see such
where_clause
:This means it would show all events in the Timeline, no matter the source ems.
Event Timeline Categories are Mixed Across Providers
Each provider is allowed to provide event-category mapping. Amazon for example specifies following (source code):
What I'd expect is that Amazon would then categorize events based on this settings. BUT looking at source code I can see that in fact Amazon settings get merged with core settings and also with settings from all other providers. This means that what I see in each event category of Timeline is in fact a joint filter composed from all settings.yaml from all providers, which I think is wrong.
Suppose Amazon wanted to categorize
Instance_CREATE
event in:addition
category but OpenStack in:other
category. It would result in this event type appearing in both categories.Each Event Type Must Be Manually Mapped to Category, No Regex Supported
Each provider can provide a mapping of event types to categories in its own
config/settings.yaml
. But it has to map each event explicitly, there is no support for regular expressions. For Nuage provider we have about 1k event types and listing them all sounds odd.However, looking at source code I can see that backend then actually performs
statement which can not be easily converted to accept regex.
/cc @Fryguy , @gberginc , @pdellaert
The text was updated successfully, but these errors were encountered: