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

Add -ignore-initial-run flag and update changelog #7

Merged
merged 6 commits into from
Aug 21, 2020

Conversation

nikkictl
Copy link

Signed-off-by: Nikki Attea nikki@sensu.io

Closes #5
Closes #6

Signed-off-by: Nikki Attea <nikki@sensu.io>
@nikkictl nikkictl requested a review from echlebek August 19, 2020 19:09
@nikkictl nikkictl self-assigned this Aug 19, 2020
Copy link
Contributor

@echlebek echlebek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If -ignore-initial-run is true, there is no reason to read through the file. The program could just initialize the state file and exit. Can you look into doing that? It would likely speed up the first execution quite dramatically. :)

Signed-off-by: Nikki Attea <nikki@sensu.io>
@nikkictl
Copy link
Author

@echlebek I used the presence of the state file, rather than the offset, to determine if the plugin is on it's first run. Let me know if this approach is more in line with your suggestion.

@nikkictl
Copy link
Author

I worry it doesn't address the number of matches described in #6 (comment) though. We'd have to read through the log file to determine the initial matches.

Nikki Attea added 2 commits August 21, 2020 13:26
Signed-off-by: Nikki Attea <nikki@sensu.io>
Signed-off-by: Nikki Attea <nikki@sensu.io>
@nikkictl
Copy link
Author

nikkictl commented Aug 21, 2020

I've set the state file's offset on the first run with -ignore-initial-run to the size of the log file. This optimizes the initial run since we don't have to read and analyze it, and configures the offset to the proper starting point for subsequent runs.

Nikki Attea added 2 commits August 21, 2020 13:53
Signed-off-by: Nikki Attea <nikki@sensu.io>
Signed-off-by: Nikki Attea <nikki@sensu.io>
@nikkictl nikkictl merged commit d12cb70 into master Aug 21, 2020
@nikkictl nikkictl deleted the feature/ignore-initial-run branch August 21, 2020 17:58
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.

Optionally suppress alerts on first run Update readme to meet community plugin style guidelines
2 participants