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

New direction for handling failed flowrecords #60

Merged
merged 8 commits into from
Dec 19, 2022

Conversation

BThacker
Copy link
Contributor

@BThacker BThacker commented Dec 13, 2022

The idea behind this is to simply try catch the init of FlowRecord, and if an exception is caught, increment the "skipped_records" field of the basereader class. This value can then be checked and logged in the consuming class for further investigation if warranted. Also added an override during class init to raise the exception instead.

@bbayles
Copy link
Contributor

bbayles commented Dec 13, 2022

Suggestions:

  • Catch more than just ValueError - why not any Exception?
  • Do self.skipped_records = 0 in the reader class init and increment it when handling an exception

@BThacker
Copy link
Contributor Author

Added skipped records to the base reader, added all exceptions to the catch (good point)

@BThacker
Copy link
Contributor Author

Dropped the multiple return types and just incremented the counter instead. Consuming modules can check the skipped record value and then log based on that.

flowlogs_reader/flowlogs_reader.py Outdated Show resolved Hide resolved
flowlogs_reader/flowlogs_reader.py Outdated Show resolved Hide resolved
flowlogs_reader/flowlogs_reader.py Outdated Show resolved Hide resolved
@BThacker
Copy link
Contributor Author

removed the unnecessary var creation, direct to yield

@mjschultz mjschultz merged commit 8525f26 into master Dec 19, 2022
@mjschultz mjschultz deleted the try_catch_valueerror branch December 19, 2022 23:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants