fix: 24h stats, blocked filtering, agent install, context timeouts#99
Merged
fix: 24h stats, blocked filtering, agent install, context timeouts#99
Conversation
The in-memory metrics are seeded at startup and only increment, so events that age out of the 24h window are still counted. Add a SQLite-based Get24hStats() query that always returns the accurate blocked/total counts for the current 24h sliding window.
- Add GetRecentBlockedLogs for SQL-level blocked_only filtering before LIMIT - Add Get24hStats/ClearAllEvents for accurate sliding-window dashboard stats - Add GetEvents blocked_only param, GetStats24h/ClearEvents libcrust exports - Add Installed() to Target interface to filter uninstalled agents from ListAgents - Guard EnableAgent against port 0 when protection is not running
Rule engine initialization (shell workers) consumes startup time that can exceed 12s under CPU contention. Run standalone with 15s budget.
- record.go: 5s timeout for event logging - telemetry.go: 10s timeout for span recording - manager.go: 10s timeout for startup metric seeding, 30s for cleanup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Get24hStats(SQLite) for accurate blocked/total counts independent of in-memory session metricsGetRecentBlockedLogsso GUI can request only blocked events without allowed events pushing them past LIMITListAgentsnow hides agents whose config doesn't exist on the machine, reducing noise in the GUIcontext.Background()database operations to prevent indefinite hangs (5s event logging, 10s span recording/metric seeding, 30s periodic cleanup)FuzzInterceptAnthropicResponsestandalone with 15s (was 12s parallelized) to avoid deadline-exceeded from rule engine init costTest plan
go build ./...passesgo vet ./...passes