GitHub user merrimanr opened a pull request:
https://github.com/apache/metron/pull/762
METRON-1189: Add alert escalation to the Alerts UI
## Contributor Comments
This PR adds the ability to escalate alerts from the Alerts UI. This is a
follow on to https://github.com/apache/metron/pull/711.
This can be tested locally against full dev. Follow the instructions in
"Development Setup" section in "metron-interface/metron-alerts/README.md" to
start the alerts UI. Then in a separate session, ssh to vagrant and start the
Kafka console consumer for the "escalate" topic.
Alerts can be escalated from 2 different views: alerts list view and
alerts detail view. After logging in, a list of alerts will initially be
displayed in a table. Select multiple alerts with the checkboxes on the right
side, then select the "Escalate" option from the "Actions" dropdown. This will
escalate these alerts by sending them to the "escalate" Kafka topic and update
the "alert_status" field on these records in Elasticsearch. Verify the
alert_status column now shows "ESCALATE" for the selected alerts and that the
alerts were produced to the Kafka console consumer.
Next drill into a single alert by clicking anywhere on a row that's not a
link. This will display a separate window with that alert's details. At the
top there will be several status options that can be selected (OPEN, DISMISS,
RESOLVE, ESCALATE, etc). Selecting any of these should update the alert_status
in Elasticsearch and have that status reflected in the UI. Selecting
"ESCALATE" should produce a message to the Kafka console consumer for that
alert.
This PR includes several improvements that were needed to complete this
task. These include:
- Switching the "alert_status" update call to use the REST layer instead of
going directly against Elasticsearch. The REST endpoint does more than just
update the index so this is absolutely necessary for the system to work
correctly.
- Slightly refactored angular services to match the REST layer.
- Changed the backend used for e2e tests from mock services to a dedicated
e2e index in Elasticsearch. I found the mock services were insufficient for
testing this feature and would require a lot of work to implement the various
services needed (that won't scale well as we add more search features). I
switched to a dedicated e2e ES index instead and am now leveraging the REST
service as it is deployed in full dev. I'm happy to discuss this approach as
needed but I feel it's an improvement and makes writing the e2e tests easier.
Scripts and javascript functions are provided to facilitate easy setup/teardown
of this index.
- The indices included in the alerts UI can now be specified in an
environment setting so that different indices can be configured for different
environments (for example "alerts_ui_e2e" index is used for e2e tests). This
may not end up being the final solution but they are currently hardcoded in a
javascript file and I feel this is incremental progress towards something
better.
This is not ready for primetime yet so please DO NOT MERGE. The e2e tests
are still failing intermittently in unrelated tests. I was seeing this before
these changes and the switch to using REST in full dev (instead of mock
services) likely made it worse. I am still working on making this more robust
and also adding documentation for the e2e testing framework. However, the
functionality is there and I wanted to give people a chance to use it, review
the changes and give some initial feedback.
## Pull Request Checklist
Thank you for submitting a contribution to Apache Metron.
Please refer to our [Development
Guidelines](https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=61332235)
for the complete guide to follow for contributions.
Please refer also to our [Build Verification
Guidelines](https://cwiki.apache.org/confluence/display/METRON/Verifying+Builds?show-miniview)
for complete smoke testing guides.
In order to streamline the review of the contribution we ask you follow
these guidelines and ask you to double check the following:
### For all changes:
- [x] Is there a JIRA ticket associated with this PR? If not one needs to
be created at [Metron
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
- [x] Does your PR title start with METRON-XXXX where XXXX is the JIRA
number you are trying to resolve? Pay particular attention to the hyphen "-"
character.
- [x] Has your PR been rebased against the latest commit within the target
branch (typically master)?
### For code changes:
- [ ] Have you included steps to reproduce the behavior or problem that is
being changed or addressed?
- [ ] Have you included steps or a guide to how the change may be verified
and tested manually?
- [ ] Have you ensured that the full suite of tests and checks have been
executed in the root metron folder via:
```
mvn -q clean integration-test install && build_utils/verify_licenses.sh
```
- [x] Have you written or updated unit tests and or integration tests to
verify your changes?
- [x] If adding new dependencies to the code, are these dependencies
licensed in a way that is compatible for inclusion under [ASF
2.0](http://www.apache.org/legal/resolved.html#category-a)?
- [x] Have you verified the basic functionality of the build by building
and running locally with Vagrant full-dev environment or the equivalent?
### For documentation related changes:
- [x] Have you ensured that format looks appropriate for the output in
which it is rendered by building and verifying the site-book? If not then run
the following commands and the verify changes via
`site-book/target/site/index.html`:
```
cd site-book
mvn site
```
#### Note:
Please ensure that once the PR is submitted, you check travis-ci for build
issues and submit an update to your PR as soon as possible.
It is also recommended that [travis-ci](https://travis-ci.org) is set up
for your personal repository such that your branches are built there before
submitting a pull request.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/merrimanr/incubator-metron escalate
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/metron/pull/762.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #762
----
commit 07a438de18e21b12b36da6ec22e9ebf8a0b93905
Author: merrimanr <[email protected]>
Date: 2017-09-14T22:34:28Z
initial commit
----
---