Skip to content

Commit d2b4543

Browse files
committed
More cleanup
1 parent f0474e6 commit d2b4543

File tree

3 files changed

+4
-20
lines changed

3 files changed

+4
-20
lines changed

components/ee/agent-smith/pkg/agent/agent.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type Smith struct {
5454
detector detector.ProcessDetector
5555
classifier classifier.ProcessClassifier
5656
fileDetector detector.FileDetector
57-
FileClassifier classifier.FileClassifier
57+
fileClassifier classifier.FileClassifier
5858
}
5959

6060
// NewAgentSmith creates a new agent smith
@@ -181,7 +181,7 @@ func NewAgentSmith(cfg config.Config) (*Smith, error) {
181181
detector: detec,
182182
classifier: class,
183183
fileDetector: filesystemDetec,
184-
FileClassifier: filesystemClass,
184+
fileClassifier: filesystemClass,
185185

186186
notifiedInfringements: lru.New(notificationCacheSize),
187187
metrics: m,
@@ -316,14 +316,14 @@ func (agent *Smith) Start(ctx context.Context, callback func(InfringingWorkspace
316316
}
317317

318318
// Filesystem classification workers (fewer than process workers)
319-
if agent.FileClassifier != nil {
319+
if agent.fileClassifier != nil {
320320
for i := 0; i < 5; i++ {
321321
wg.Add(1)
322322
go func() {
323323
defer wg.Done()
324324
for file := range fli {
325325
log.Infof("Classifying filesystem file: %s", file.Path)
326-
class, err := agent.FileClassifier.MatchesFile(file.Path)
326+
class, err := agent.fileClassifier.MatchesFile(file.Path)
327327
// Early out for no matches
328328
if err == nil && class.Level == classifier.LevelNoMatch {
329329
log.Infof("File classification: no match - %s", file.Path)
@@ -523,22 +523,10 @@ func (agent *Smith) Describe(d chan<- *prometheus.Desc) {
523523
agent.metrics.Describe(d)
524524
agent.classifier.Describe(d)
525525
agent.detector.Describe(d)
526-
if agent.fileDetector != nil {
527-
agent.fileDetector.Describe(d)
528-
}
529-
if agent.FileClassifier != nil {
530-
agent.FileClassifier.Describe(d)
531-
}
532526
}
533527

534528
func (agent *Smith) Collect(m chan<- prometheus.Metric) {
535529
agent.metrics.Collect(m)
536530
agent.classifier.Collect(m)
537531
agent.detector.Collect(m)
538-
if agent.fileDetector != nil {
539-
agent.fileDetector.Collect(m)
540-
}
541-
if agent.FileClassifier != nil {
542-
agent.FileClassifier.Collect(m)
543-
}
544532
}

components/ee/agent-smith/pkg/classifier/classifier.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ type ProcessClassifier interface {
5050

5151
// FileClassifier matches filesystem files against signatures
5252
type FileClassifier interface {
53-
prometheus.Collector
54-
5553
MatchesFile(filePath string) (*Classification, error)
5654
GetFileSignatures() []*Signature
5755
}

components/ee/agent-smith/pkg/detector/filesystem.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ import (
2121

2222
// FileDetector discovers suspicious files on the node
2323
type FileDetector interface {
24-
prometheus.Collector
25-
2624
// DiscoverFiles based on a relative path match given the classifier's signatures
2725
DiscoverFiles(ctx context.Context) (<-chan File, error)
2826
}

0 commit comments

Comments
 (0)