-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/27790/
-----------------------------------------------------------
Review request for Ambari, John Speidel, Nate Cole, and Tom Beerbower.
Bugs: AMBARI-8237
https://issues.apache.org/jira/browse/AMBARI-8237
Repository: ambari
Description
-------
The web client would like to be able to request a customizable alert summary
structure given a combination of parameters, such as alert definition name,
host, date, etc. Currently the alerts_summary structure off of the
cluster/service/host endpoints are static and just return total counts.
The new structure would also need to contain some extra information, such as
original timestamp when the most recent state change occurred:
"alerts_summary" : {
"CRITICAL" : {
“count”: 2,
“original_timestamp”: 1415134996589
},
"OK” : {
“count”: 45,
“original_timestamp”: 1415134133489
}
...
}
The Ambari API already has a model to model in cases like this. We use a
"renderer" which is a value that instructs the API engine to format the results
of a query in a particular fashion. With this, we can query the alerts endpoint
and format it for a summary output. This includes formatting for alerts by
name, host, and other supported combinations.
Some URI examples:
http://localhost:8080/api/v1/clusters/c1/alerts?format=summary
http://localhost:8080/api/v1/clusters/c1/alerts?Alert/name=datanode_process&Alert/host_name=c6401.ambari.apache.org&format=summary
Diffs
-----
ambari-server/src/main/java/org/apache/ambari/server/api/query/render/AlertSummaryRenderer.java
PRE-CREATION
ambari-server/src/main/java/org/apache/ambari/server/api/resources/AlertResourceDefinition.java
d7aca22
ambari-server/src/main/java/org/apache/ambari/server/controller/internal/AlertResourceProvider.java
715d017
ambari-server/src/test/java/org/apache/ambari/server/controller/internal/AlertResourceProviderTest.java
ef014a9
Diff: https://reviews.apache.org/r/27790/diff/
Testing
-------
New tests added to ensure the renderer converts the flattened alert data
correctly.
Thanks,
Jonathan Hurley