Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses #1201
Bug Description
Previously, operations on the SQLite DB used for watch mode (intended for local dev) were always run because they were fired from the legacy telemetry flow. This had the potential to cause DB lock errors if the user was using high rates of concurrency like noted in #1201.
Now, we avoid making calls to this SQLite DB unless watch mode is explicitly enabled via the
--watch
flag on theguardrails start
command.This isn't a perfect solution, because it forces the user to specify the "watch" functionality in two places:
guardrails start --watch
to enable collecting logsguardrails watch
to tail the logs in a separate console tabHowever there is not an easy way to communicate between these two commands since they currently exist as separate and unrelated processes.
This is technically a breaking change since it requires additional user interaction to obtain the same behaviour that previously was obtained without the addtional flag, but no one has used the
guardrails watch
command within the retention window of our metrics so it shouldn't matter.Additionally, this entire "watch" functionality can, and probably should, just be handled by a logger in the same process as the guardrails-api. The current setup is a significant amount of overhead for something that essentially just prints out ValidatorLogs.