stats

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 2 Imported by: 2

Documentation

Overview

Package stats contains interfaces and utilities relating to the collection of statistics from Scalibr.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

type Collector interface {
	AfterInodeVisited(path string)
	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)
	AfterFileSeen(pluginName string, filestats *FileStats)
}

Collector is a component which is notified when certain events occur. It can be implemented with different metric backends to enable monitoring of Scalibr.

type FileStats added in v0.1.1

type FileStats struct {
	Path          string
	Error         error
	FileSizeBytes int64
	// For extractors that unarchive a compressed files, this reports the bytes
	// that were opened during the unarchiving process.
	UncompressedBytes int64
}

FileStats is a struct containing stats about a file that was extracted. If the file was skipped due to an error during extraction, `Error` will be populated.

type NoopCollector

type NoopCollector struct{}

NoopCollector implements Collector by doing nothing.

func (NoopCollector) AfterDetectorRun

func (c NoopCollector) AfterDetectorRun(name string, runtime time.Duration, err error)

AfterDetectorRun implements Collector by doing nothing.

func (NoopCollector) AfterExtractorRun

func (c NoopCollector) AfterExtractorRun(name string, runtime time.Duration, err error)

AfterExtractorRun implements Collector by doing nothing.

func (NoopCollector) AfterFileSeen added in v0.1.1

func (c NoopCollector) AfterFileSeen(name string, filestats *FileStats)

AfterFileSeen implements Collector by doing nothing.

func (NoopCollector) AfterInodeVisited

func (c NoopCollector) AfterInodeVisited(path string)

AfterInodeVisited implements Collector by doing nothing.

func (NoopCollector) AfterResultsExported

func (c NoopCollector) AfterResultsExported(destination string, bytes int, err error)

AfterResultsExported implements Collector by doing nothing.

func (NoopCollector) AfterScan

func (c NoopCollector) AfterScan(runtime time.Duration, status *plugin.ScanStatus)

AfterScan implements Collector by doing nothing.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL