feat(command): add replay subcommand#5200
feat(command): add replay subcommand#5200josedonizetti wants to merge 1 commit intoaquasecurity:mainfrom
Conversation
3d22550 to
1567d3a
Compare
f4697e2 to
ffa96f1
Compare
646494a to
115f048
Compare
115f048 to
84e73df
Compare
Codecov Report❌ Patch coverage is
❌ Your patch check has failed because the patch coverage (34.24%) is below the target coverage (60.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #5200 +/- ##
==========================================
+ Coverage 33.51% 35.67% +2.16%
==========================================
Files 250 239 -11
Lines 28908 31549 +2641
==========================================
+ Hits 9688 11255 +1567
- Misses 18609 19569 +960
- Partials 611 725 +114
🚀 New features to boost your workflow:
|
| } | ||
|
|
||
| func (r Runner) Run(ctx context.Context) error { | ||
| // ReplayRunner handles replaying events from a file |
There was a problem hiding this comment.
What about placing ReplayRunner definition/logic in its own file?
| // | ||
| // Returns: | ||
| // - The corresponding internal event ID, or 0 if not found | ||
| func TranslateFromProtoEventID(protoEventID pb.EventId) ID { |
There was a problem hiding this comment.
TranslateFromProtoEventID does a linear search for every event replayed. Could we create the reversed table of EventTranslationTable in memory, in a init() for instance? And to not waste memory it could be instantiated only in replay mode.
| fileReadCtx, stop := context.WithCancel(signalCtx) | ||
|
|
||
| // Producer: read events from file (protobuf JSON format) | ||
| fromFile := make(chan *v1beta1.Event, 100) |
There was a problem hiding this comment.
Consider making the channel size configurable or documenting the choice.
Add
tracee replaycommandThis PR introduces a new
tracee replaysubcommand that allows replaying previously captured events from a JSON Lines file and processing them through the detector engine.Features
tracee --output json:file.json)--output,--detectors,--loggingLimitations
Implementation Notes
This is a first version that maintains the same event processing approach as the old analyze tracee command. The implementation uses a simplified event processing pipeline that reads events from a file and dispatches them to the detector engine.
In the future, we plan to refactor this to use the same unified pipeline as the main tracee command to ensure consistency and reduce code duplication.
Usage