Skip to content
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

[classifier] Catching KeyError when parsing a record #735

Merged
merged 1 commit into from
May 14, 2018

Conversation

chunyong-lin
Copy link
Contributor

to: @airbnb/streamalert-maintainers
size: small
resolves N/A

Background

Catch KeyError during a record parsing in the classifier. It may result a KeyError exception when a record is mis-classified, although this situation is rare.

Changes

  • Catch KeyError and return False. It will result Failed Parses in Rule Processor if a record is mis-classified.

Testing

  • Rule testing
python manage.py lambda test --processor all
...
StreamAlertCLI [INFO]: (63/63) Successful Tests
StreamAlertCLI [INFO]: (34/34) Alert Tests Passed
  • Unit testing
./tests/scripts/unit_tests.sh
...
Ran 736 tests in 10.559s

OK

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.07%) to 97.607% when pulling c7d8205 on catch_key_error_in_classifier into 8c3d246 on master.

@chunyong-lin chunyong-lin merged commit af596ea into master May 14, 2018
@ryandeivert ryandeivert deleted the catch_key_error_in_classifier branch May 15, 2018 17:55
@ryandeivert ryandeivert added this to the 2.0.0 milestone Jul 9, 2018
@ryandeivert ryandeivert changed the title [classifier] Catch KeyError when parsing a record [classifier] catch KeyError when parsing a record Jul 11, 2018
@ryandeivert ryandeivert changed the title [classifier] catch KeyError when parsing a record [classifier] Catching KeyError when parsing a record Jul 11, 2018
@ryandeivert ryandeivert removed the apps label Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants