Skip to content

Commit

Permalink
Add a stats callback for exported scan results
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 630959587
  • Loading branch information
SCALIBR Team authored and copybara-github committed May 6, 2024
1 parent e83bfdd commit 05476b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions stats/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ type Collector interface {
AfterExtractorRun(name string, runtime time.Duration, err error)
AfterDetectorRun(name string, runtime time.Duration, err error)
AfterScan(runtime time.Duration, status *plugin.ScanStatus)
// AfterResultsExported is called after results have been exported. destination should merely be
// a category of where the result was written to (e.g. 'file', 'http'), not the precise location.
AfterResultsExported(destination string, bytes int, err error)
}

// NoopCollector implements Collector by doing nothing.
Expand All @@ -45,3 +48,6 @@ func (c NoopCollector) AfterDetectorRun(name string, runtime time.Duration, err

// AfterScan implements Collector by doing nothing.
func (c NoopCollector) AfterScan(runtime time.Duration, status *plugin.ScanStatus) {}

// AfterResultsExported implements Collector by doing nothing.
func (c NoopCollector) AfterResultsExported(destination string, bytes int, err error) {}

0 comments on commit 05476b5

Please sign in to comment.