You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by Jonathan Hurley <jh...@hortonworks.com> on 2014/11/20 20:03:09 UTC

Review Request 28291: Alerts: Template Engine for Dispatching

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28291/
-----------------------------------------------------------

Review request for Ambari, Nate Cole, Srimanth Gunturi, and Tom Beerbower.


Bugs: AMBARI-8400
    https://issues.apache.org/jira/browse/AMBARI-8400


Repository: ambari


Description
-------

Ambari's various dispatchers (such as Email and SNMP) can benefit from having a mechanism where a template can be defined for the construction of notification data. This decouples the content that Ambari is sending from the logic to compute the aggregate alerts.

Apache Velocity is a good choice for this requirement as it includes a maturing template language, VTL. 

A single XML file that ships with Ambari will contain the default templates for known alert target types. There will be an option to override the use of this file with a user-specified location via ambari.properties. In the event that a user-specific XML file cannot be parsed, appropriate exceptions will be thrown, but the {{AlertNoticeDispatchService}} will attempt to gracefully fallback on other content rendering options (such as the internal XML file).

The following data should be exposed to VTL:

- a list of all alert changes
-- alert name, state, date, label
-- a list for each state change
-- lists for all alerts, broke down by service and state 

- a list of all services with an alert
- a list of all hosts with an alert

- total counts of changes separated
-- one count for each alert state


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/AmbariService.java PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java 0dbeb5c 
  ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java 0a96193 
  ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java 2d91462 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 13f2da2 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java a5dad84 
  ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 72487b3 
  ambari-server/src/main/resources/alert-templates.xml PRE-CREATION 
  ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json 96cb931 
  ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/alerts.json 11836b3 
  ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json e58c4a3 
  ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java PRE-CREATION 

Diff: https://reviews.apache.org/r/28291/diff/


Testing
-------

New tests written to cover dispatch service.

mvn clean test


Thanks,

Jonathan Hurley


Re: Review Request 28291: Alerts: Template Engine for Dispatching

Posted by Jonathan Hurley <jh...@hortonworks.com>.

> On Nov. 20, 2014, 9:52 p.m., Nate Cole wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java, line 125
> > <https://reviews.apache.org/r/28291/diff/1/?file=771332#file771332line125>
> >
> >     Nit: does this still work even if there's no markup in the body?  If someone _wanted_ plain text?

If there's no markup in the body, then this will instruct the mail client to show the text as-is. It will still be flagged as html, but should render as plaintext. A plaintext-only client, however, might have issues displaying it b/c of how the message is constructed. There were no requirements to support plaintext-only clients, so I didn't bother with 2 types of email templates.


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28291/#review62517
-----------------------------------------------------------


On Nov. 20, 2014, 2:16 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28291/
> -----------------------------------------------------------
> 
> (Updated Nov. 20, 2014, 2:16 p.m.)
> 
> 
> Review request for Ambari, Nate Cole, Srimanth Gunturi, and Tom Beerbower.
> 
> 
> Bugs: AMBARI-8400
>     https://issues.apache.org/jira/browse/AMBARI-8400
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ambari's various dispatchers (such as Email and SNMP) can benefit from having a mechanism where a template can be defined for the construction of notification data. This decouples the content that Ambari is sending from the logic to compute the aggregate alerts.
> 
> Apache Velocity is a good choice for this requirement as it includes a maturing template language, VTL. 
> 
> A single XML file that ships with Ambari will contain the default templates for known alert target types. There will be an option to override the use of this file with a user-specified location via ambari.properties. In the event that a user-specific XML file cannot be parsed, appropriate exceptions will be thrown, but the {{AlertNoticeDispatchService}} will attempt to gracefully fallback on other content rendering options (such as the internal XML file).
> 
> The following data should be exposed to VTL:
> 
> - a list of all alert changes
> -- alert name, state, date, label
> -- a list for each state change
> -- lists for all alerts, broke down by service and state 
> 
> - a list of all services with an alert
> - a list of all hosts with an alert
> 
> - total counts of changes separated
> -- one count for each alert state
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/AmbariService.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java 0dbeb5c 
>   ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java 0a96193 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java 2d91462 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 13f2da2 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java a5dad84 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 72487b3 
>   ambari-server/src/main/resources/alert-templates.xml PRE-CREATION 
>   ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json 96cb931 
>   ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/alerts.json 11836b3 
>   ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json e58c4a3 
>   ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/28291/diff/
> 
> 
> Testing
> -------
> 
> New tests written to cover dispatch service.
> 
> mvn clean test
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 12:35 min
> [INFO] Finished at: 2014-11-20T14:16:02-05:00
> [INFO] Final Memory: 33M/617M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 28291: Alerts: Template Engine for Dispatching

Posted by Nate Cole <nc...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28291/#review62517
-----------------------------------------------------------

Ship it!



ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java
<https://reviews.apache.org/r/28291/#comment104546>

    Nit: does this still work even if there's no markup in the body?  If someone _wanted_ plain text?


- Nate Cole


On Nov. 20, 2014, 2:16 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28291/
> -----------------------------------------------------------
> 
> (Updated Nov. 20, 2014, 2:16 p.m.)
> 
> 
> Review request for Ambari, Nate Cole, Srimanth Gunturi, and Tom Beerbower.
> 
> 
> Bugs: AMBARI-8400
>     https://issues.apache.org/jira/browse/AMBARI-8400
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ambari's various dispatchers (such as Email and SNMP) can benefit from having a mechanism where a template can be defined for the construction of notification data. This decouples the content that Ambari is sending from the logic to compute the aggregate alerts.
> 
> Apache Velocity is a good choice for this requirement as it includes a maturing template language, VTL. 
> 
> A single XML file that ships with Ambari will contain the default templates for known alert target types. There will be an option to override the use of this file with a user-specified location via ambari.properties. In the event that a user-specific XML file cannot be parsed, appropriate exceptions will be thrown, but the {{AlertNoticeDispatchService}} will attempt to gracefully fallback on other content rendering options (such as the internal XML file).
> 
> The following data should be exposed to VTL:
> 
> - a list of all alert changes
> -- alert name, state, date, label
> -- a list for each state change
> -- lists for all alerts, broke down by service and state 
> 
> - a list of all services with an alert
> - a list of all hosts with an alert
> 
> - total counts of changes separated
> -- one count for each alert state
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/AmbariService.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java 0dbeb5c 
>   ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java 0a96193 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java 2d91462 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 13f2da2 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java a5dad84 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 72487b3 
>   ambari-server/src/main/resources/alert-templates.xml PRE-CREATION 
>   ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json 96cb931 
>   ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/alerts.json 11836b3 
>   ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json e58c4a3 
>   ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/28291/diff/
> 
> 
> Testing
> -------
> 
> New tests written to cover dispatch service.
> 
> mvn clean test
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 12:35 min
> [INFO] Finished at: 2014-11-20T14:16:02-05:00
> [INFO] Final Memory: 33M/617M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 28291: Alerts: Template Engine for Dispatching

Posted by Jonathan Hurley <jh...@hortonworks.com>.

> On Nov. 21, 2014, 5:39 a.m., Tom Beerbower wrote:
> > ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java, line 82
> > <https://reviews.apache.org/r/28291/diff/1/?file=771333#file771333line82>
> >
> >     Should we be using javax.inject instead?  I know it doesn't really matter but it feels like we should use java standards when possible.

No, I think that we've standardized on Guice for dependency injection. Although java.inject would also work, I believe that the specification in the JDK is more restrictive than Guice's.


- Jonathan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28291/#review62536
-----------------------------------------------------------


On Nov. 20, 2014, 2:16 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28291/
> -----------------------------------------------------------
> 
> (Updated Nov. 20, 2014, 2:16 p.m.)
> 
> 
> Review request for Ambari, Nate Cole, Srimanth Gunturi, and Tom Beerbower.
> 
> 
> Bugs: AMBARI-8400
>     https://issues.apache.org/jira/browse/AMBARI-8400
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ambari's various dispatchers (such as Email and SNMP) can benefit from having a mechanism where a template can be defined for the construction of notification data. This decouples the content that Ambari is sending from the logic to compute the aggregate alerts.
> 
> Apache Velocity is a good choice for this requirement as it includes a maturing template language, VTL. 
> 
> A single XML file that ships with Ambari will contain the default templates for known alert target types. There will be an option to override the use of this file with a user-specified location via ambari.properties. In the event that a user-specific XML file cannot be parsed, appropriate exceptions will be thrown, but the {{AlertNoticeDispatchService}} will attempt to gracefully fallback on other content rendering options (such as the internal XML file).
> 
> The following data should be exposed to VTL:
> 
> - a list of all alert changes
> -- alert name, state, date, label
> -- a list for each state change
> -- lists for all alerts, broke down by service and state 
> 
> - a list of all services with an alert
> - a list of all hosts with an alert
> 
> - total counts of changes separated
> -- one count for each alert state
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/AmbariService.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java 0dbeb5c 
>   ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java 0a96193 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java 2d91462 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 13f2da2 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java a5dad84 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 72487b3 
>   ambari-server/src/main/resources/alert-templates.xml PRE-CREATION 
>   ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json 96cb931 
>   ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/alerts.json 11836b3 
>   ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json e58c4a3 
>   ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/28291/diff/
> 
> 
> Testing
> -------
> 
> New tests written to cover dispatch service.
> 
> mvn clean test
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 12:35 min
> [INFO] Finished at: 2014-11-20T14:16:02-05:00
> [INFO] Final Memory: 33M/617M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 28291: Alerts: Template Engine for Dispatching

Posted by Tom Beerbower <tb...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28291/#review62536
-----------------------------------------------------------

Ship it!


Looks good.


ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java
<https://reviews.apache.org/r/28291/#comment104596>

    Should we be using javax.inject instead?  I know it doesn't really matter but it feels like we should use java standards when possible.


- Tom Beerbower


On Nov. 20, 2014, 7:16 p.m., Jonathan Hurley wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28291/
> -----------------------------------------------------------
> 
> (Updated Nov. 20, 2014, 7:16 p.m.)
> 
> 
> Review request for Ambari, Nate Cole, Srimanth Gunturi, and Tom Beerbower.
> 
> 
> Bugs: AMBARI-8400
>     https://issues.apache.org/jira/browse/AMBARI-8400
> 
> 
> Repository: ambari
> 
> 
> Description
> -------
> 
> Ambari's various dispatchers (such as Email and SNMP) can benefit from having a mechanism where a template can be defined for the construction of notification data. This decouples the content that Ambari is sending from the logic to compute the aggregate alerts.
> 
> Apache Velocity is a good choice for this requirement as it includes a maturing template language, VTL. 
> 
> A single XML file that ships with Ambari will contain the default templates for known alert target types. There will be an option to override the use of this file with a user-specified location via ambari.properties. In the event that a user-specific XML file cannot be parsed, appropriate exceptions will be thrown, but the {{AlertNoticeDispatchService}} will attempt to gracefully fallback on other content rendering options (such as the internal XML file).
> 
> The following data should be exposed to VTL:
> 
> - a list of all alert changes
> -- alert name, state, date, label
> -- a list for each state change
> -- lists for all alerts, broke down by service and state 
> 
> - a list of all services with an alert
> - a list of all hosts with an alert
> 
> - total counts of changes separated
> -- one count for each alert state
> 
> 
> Diffs
> -----
> 
>   ambari-server/src/main/java/org/apache/ambari/server/AmbariService.java PRE-CREATION 
>   ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java 0dbeb5c 
>   ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java 0a96193 
>   ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java 2d91462 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 13f2da2 
>   ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java a5dad84 
>   ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 72487b3 
>   ambari-server/src/main/resources/alert-templates.xml PRE-CREATION 
>   ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json 96cb931 
>   ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/alerts.json 11836b3 
>   ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json e58c4a3 
>   ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/28291/diff/
> 
> 
> Testing
> -------
> 
> New tests written to cover dispatch service.
> 
> mvn clean test
> 
> [INFO] ------------------------------------------------------------------------
> [INFO] BUILD SUCCESS
> [INFO] ------------------------------------------------------------------------
> [INFO] Total time: 12:35 min
> [INFO] Finished at: 2014-11-20T14:16:02-05:00
> [INFO] Final Memory: 33M/617M
> [INFO] ------------------------------------------------------------------------
> 
> 
> Thanks,
> 
> Jonathan Hurley
> 
>


Re: Review Request 28291: Alerts: Template Engine for Dispatching

Posted by Jonathan Hurley <jh...@hortonworks.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28291/
-----------------------------------------------------------

(Updated Nov. 20, 2014, 2:16 p.m.)


Review request for Ambari, Nate Cole, Srimanth Gunturi, and Tom Beerbower.


Bugs: AMBARI-8400
    https://issues.apache.org/jira/browse/AMBARI-8400


Repository: ambari


Description
-------

Ambari's various dispatchers (such as Email and SNMP) can benefit from having a mechanism where a template can be defined for the construction of notification data. This decouples the content that Ambari is sending from the logic to compute the aggregate alerts.

Apache Velocity is a good choice for this requirement as it includes a maturing template language, VTL. 

A single XML file that ships with Ambari will contain the default templates for known alert target types. There will be an option to override the use of this file with a user-specified location via ambari.properties. In the event that a user-specific XML file cannot be parsed, appropriate exceptions will be thrown, but the {{AlertNoticeDispatchService}} will attempt to gracefully fallback on other content rendering options (such as the internal XML file).

The following data should be exposed to VTL:

- a list of all alert changes
-- alert name, state, date, label
-- a list for each state change
-- lists for all alerts, broke down by service and state 

- a list of all services with an alert
- a list of all hosts with an alert

- total counts of changes separated
-- one count for each alert state


Diffs
-----

  ambari-server/src/main/java/org/apache/ambari/server/AmbariService.java PRE-CREATION 
  ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryGroupedRenderer.java 0dbeb5c 
  ambari-server/src/main/java/org/apache/ambari/server/configuration/Configuration.java 0a96193 
  ambari-server/src/main/java/org/apache/ambari/server/controller/ControllerModule.java 2d91462 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/DispatchFactory.java 13f2da2 
  ambari-server/src/main/java/org/apache/ambari/server/notifications/dispatchers/EmailDispatcher.java a5dad84 
  ambari-server/src/main/java/org/apache/ambari/server/state/services/AlertNoticeDispatchService.java 72487b3 
  ambari-server/src/main/resources/alert-templates.xml PRE-CREATION 
  ambari-server/src/main/resources/stacks/BIGTOP/0.8/services/HDFS/alerts.json 96cb931 
  ambari-server/src/main/resources/stacks/HDP/1.3.2/services/HDFS/alerts.json 11836b3 
  ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HDFS/alerts.json e58c4a3 
  ambari-server/src/test/java/org/apache/ambari/server/state/services/AlertNoticeDispatchServiceTest.java PRE-CREATION 

Diff: https://reviews.apache.org/r/28291/diff/


Testing (updated)
-------

New tests written to cover dispatch service.

mvn clean test

[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12:35 min
[INFO] Finished at: 2014-11-20T14:16:02-05:00
[INFO] Final Memory: 33M/617M
[INFO] ------------------------------------------------------------------------


Thanks,

Jonathan Hurley