Skip to content
This repository has been archived by the owner on Nov 15, 2019. It is now read-only.

Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343) #88

Merged
merged 1 commit into from
Nov 6, 2017

Conversation

aljesusg
Copy link
Member

@aljesusg aljesusg commented Oct 25, 2017

When alerts type Datasource and Mesagging are create in hawkular conditions and dataID is nil, the problem is getting the livemetrics of these kinds of alerts.

Fix Alerts of https://bugzilla.redhat.com/show_bug.cgi?id=1505343

@aljesusg
Copy link
Member Author

@miq-bot add_label wip, bug

@aljesusg aljesusg changed the title [WIP] Fix bugzilla 1505343 Fix bugzilla 1505343 Oct 25, 2017
@miq-bot miq-bot removed the wip label Oct 25, 2017
@gbaufake
Copy link

@aljesusg Does #9 impact on this PR?

@aljesusg
Copy link
Member Author

I don't think @gbaufake this changes are in alert manager

@gbaufake
Copy link

gbaufake commented Oct 25, 2017

@aljesusg
Just a sanity check because you've said the #9 might correct the bugzilla 1505343. Considering booth are on open state, I wanted to make sure one PR would not impact on the other.

Since there is no cross-reference between them, I am in favor of merging it after someone reviews it .
After that, I can proceed on bugzilla verification

@aljesusg
Copy link
Member Author

aljesusg commented Oct 25, 2017

No @gbaufake it was a mistake I was wrong about that there are some changes in the provider like #9 but I didn't know what was the problem, I am new with hawkular and the investigation takes me so time. This PR don't impact with #9 and the error was in my side with live metrics.

@gbaufake
Copy link

@aljesusg Thanks for the clarifications!

@abonas
Copy link
Member

abonas commented Oct 26, 2017

@aljesusg please have a more informative commit message and description. BZ number is good and needed but some more explanations are needed as well. thanks
When wanting to review the PR I am missing information what is the source of the problem in the code, how it is fixed, was this a regression or not, etc.

@aljesusg aljesusg changed the title Fix bugzilla 1505343 Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343) Oct 26, 2017
@aljesusg
Copy link
Member Author

Did it @abonas !!! Thanks and sorry for the short definition.

@abonas
Copy link
Member

abonas commented Oct 26, 2017

@lucasponce only if you have time, I know you are well familiar with this area

@abonas abonas self-assigned this Oct 26, 2017
Copy link
Member

@israel-hdez israel-hdez left a comment

Choose a reason for hiding this comment

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

Code looks good.

As @abonas said, commit message still needs a better description. Stating that data ids were being looked up in the server config rather than in the corresponding subordinated/child entity config should be enough to make easier to understand your changes.

mw_aggregated_rejected_web_sessions
).freeze
MW_WEB_SESSIONS = [
'mw_aggregated_active_web_sessions', 'WildFly Aggregated Web Metrics~Aggregated Active Web Sessions',
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure of this.
Native metric names should be in the configuration file loaded, and in theory it shouldn't be manipulated here.
In the next iteration hMetrics will change to a Prometheus and this names will be completely different.
So, it should not hit the MiQ code.
I guess that in there was a utility class to fetch the native metric from the miq name that could be used.
Or perhaps I am missing something.

Copy link
Member Author

Choose a reason for hiding this comment

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

I need it for test that method is getting the right definition because this was the problem that I have. How could I solve it?

Copy link
Contributor

Choose a reason for hiding this comment

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

the mixing should load this info from the config files
https://github.com/ManageIQ/manageiq/blob/master/app/models/mixins/live_metrics_mixin.rb
so, it should be available at resource level AFAIR

@aljesusg aljesusg changed the title Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343) [WIP] Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343) Oct 27, 2017
@miq-bot miq-bot added the wip label Oct 27, 2017
@aljesusg aljesusg force-pushed the issue_alerts branch 2 times, most recently from dfa6439 to dbba2a1 Compare October 30, 2017 10:13
@aljesusg aljesusg changed the title [WIP] Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343) Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343) Oct 30, 2017
@aljesusg
Copy link
Member Author

@miq-bot remove_label wip

@miq-bot miq-bot removed the wip label Oct 30, 2017
@aljesusg
Copy link
Member Author

@lucasponce I remove the native metrics name with another tests, now I think is fine.
@abonas I am still working in the alerts, I have a call today with Edgar to analyze the format of the json, anyway we'll need this PR because live metrics for DataSource and Mesagging are different, so I removed the wip label. Thanks

@aljesusg
Copy link
Member Author

Can you review this or merge if it's ok?

@lucasponce
Copy link
Contributor

It looks good.
Just to confirm, now the end user will be able to select a MiddlewareServer or a MiddlewareDatasource when defining an alert from MiQ, isn't it ?
Also, one thing to check is to validate that the evaluation process also is aligned, today logic is defined at entity, now if alerts are also defined to datasources as they are different entities I guess that logic will need to be extended as well.

@aljesusg
Copy link
Member Author

It isn't Lucas, the alert profile is defined to assign to a MiddlewareServer no to a MiddlewareDataSource. Do MiddlewareDatasource and MiddlewareMesagging depends of MiddlewareServer?

@lucasponce
Copy link
Contributor

In theory, the MiddlewareServer can be seen as the parent resource of MiddlewareDatasource or MiddlewareMessaging objects.
It is ok, it can be defined on MiddlewareServer, but then the process when an event comes and MiQ evaluates that event triggers a MiQ Alert should be revisit, I don't remember if some logic needs to be adapted to support alerts defined in other entities (I may be wrong, and perhaps there is no need to add anything but good to review in the context of this task).

@aljesusg
Copy link
Member Author

aljesusg commented Oct 31, 2017

Ok, maybe we should analyze this because could be another requirement for UI. @abonas What do you think?

@abonas
Copy link
Member

abonas commented Oct 31, 2017

Ok, maybe we should analyze this because could be another requirement for UI. @abonas What do you think?

sure, but this is @jdoyleoss decision

@lucasponce
Copy link
Contributor

I think there is some gap here.
The purpose of this feature is to alert on datasources, so, once of the alert is defined, in the alert profile it should be defined the server and the datasource where the alert is applied (unless alerts are created on all available datasources, but I'm not sure if the original request is that).
So, for that, some way to define how/where select the datasource is necessary.

@abonas
Copy link
Member

abonas commented Nov 1, 2017

@lucasponce I agree. we need clarifications here. just to recap, the definition of the enhancement was (this is only the first part of the definition, the rest is in JIRA)
Enable the definition of Alerts in CloudForms based upon the metrics collected from EAP servers. Currently alerts can only be defined on the JVM metrics (heap, non-heap and garbage collection).
Control->Explorer->Alerts->Configuration->Add New Alert
Based on = Middleware Server
What to evaluate -> on JVM stuff appears currently
Metrics to add, grouped by priority (Datasource, Web Sessions, Transactions, Messaging)
DataSource - Connections Available
DataSource - Connections In Use
DataSource - Connections Timed Out
DataSource - Connection Get Time
DataSource - Connection Creation Time
DataSource - Connection Wait Time

@jdoyleoss

@aljesusg
Copy link
Member Author

aljesusg commented Nov 1, 2017

I think that we can merge this If looks good for you. Now Datasource alerts apply to all datasources that they are in the Middleware Server where you assigned the alert profile, maybe we can do a feature to select which Datasources you wanna have this alert.

@abonas
Copy link
Member

abonas commented Nov 1, 2017

if from @lucasponce perspective this is good to be merge, I'll merge it. I'm not familiar well with this area myself.

@israel-hdez
Copy link
Member

I'm reading some differences in the Jira tasks. JMAN4-201 just lists the metrics. HAWKULAR-1255 clearly state the base entities.

Apart from that, @lucasponce concenrs are true. Remember that "alerts" are templates for Hawkular. So, even if something is correctly created in Hawkular, that's an unbounded trigger. The bounding is done in the profile and, if I'm not wrong, the code (as it is right now) will bound the datasource and messaging alerts to the wrong metric ids. So, those alerts won't work.

I think it's OK to merge, but there is still some work to have datasources and messagings alerts working correctly.

@lucasponce
Copy link
Contributor

As @israel-hdez comments, an MiQ Alert creates a Hawkular Group Trigger, which works like a template.
When an MiQ Alert Profile is created, the members of the Group Trigger should be created.
So, if the Alert Profile is created against a Middleware Server, then some logic should iterate and fetch all datasources, and its metrics, and it should create a Member Trigger per datasource under the hood.
Hence why I asked that perhaps is better to let select datasource to the user.
If UI won't change, then from MW Server should fetch and get the metric per all datasources available in the system.
Also, when the alert profile changes or is deleted, these members should change or be removed too.
Also, in the MiQ side, the logic when this event is evaluated and shown in the timeline should be revisit, as those events will be shown at MW Server (not at MW Datasource).
(I think current logic could be ok, but worth to take a look, as here there is a scenario with some differences and might bring some side effect).

@miq-bot
Copy link
Member

miq-bot commented Nov 2, 2017

Checked commit aljesusg@f58fb2c with ruby 2.3.3, rubocop 0.47.1, and haml-lint 0.20.0
2 files checked, 0 offenses detected
Everything looks fine. 🍪

@abonas abonas added this to the Sprint 73 Ending Nov 13, 2017 milestone Nov 6, 2017
@abonas abonas merged commit 9d45bf3 into ManageIQ:master Nov 6, 2017
@abonas
Copy link
Member

abonas commented Nov 6, 2017

@miq-bot add_label gaprindashvili/yes

simaishi pushed a commit that referenced this pull request Nov 7, 2017
Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343)
(cherry picked from commit 9d45bf3)
@simaishi
Copy link

simaishi commented Nov 7, 2017

Gaprindashvili backport details:

$ git log -1
commit 9f47e8a8fff9dfe51b6f799a1f630ab21edf63f7
Author: abonas <mikeyteva@gmail.com>
Date:   Mon Nov 6 12:45:26 2017 +0200

    Merge pull request #88 from aljesusg/issue_alerts
    
    Fix problem getting live metrics when trigger is created with Datasource and Mesagging types (bugzilla 1505343)
    (cherry picked from commit 9d45bf3aadb09cb324df63aba05aaaf15e75846e)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants