MCPcopy
hub / github.com/netdata/netdata / collect

Method collect

src/go/plugin/framework/jobruntime/job_v1.go:465–487  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

463}
464
465func (j *Job) collect() collectedMetrics {
466 j.panicked.Store(false)
467 defer func() {
468 if r := recover(); r != nil {
469 j.panicked.Store(true)
470 j.Errorf("PANIC: %v", r)
471 if logger.Level.Enabled(slog.LevelDebug) {
472 j.Errorf("STACK: %s", debug.Stack())
473 }
474 }
475 }()
476
477 var mx collectedMetrics
478 mx.intMetrics = j.module.Collect(context.TODO())
479
480 // Record collected metrics for metrics-audit mode.
481 // TODO: The analyzer only records intMetrics but ignores floatMetrics.
482 if j.auditMode && j.auditAnalyzer != nil && mx.intMetrics != nil {
483 j.auditAnalyzer.RecordCollection(j.name, j.moduleName, mx.intMetrics)
484 }
485
486 return mx
487}
488
489func (j *Job) processMetrics(mx collectedMetrics, startTime time.Time, sinceLastRun int) bool {
490 var createChart bool

Callers 1

runOnceMethod · 0.95

Calls 5

StoreMethod · 0.80
ErrorfMethod · 0.65
EnabledMethod · 0.65
CollectMethod · 0.65
RecordCollectionMethod · 0.65

Tested by

no test coverage detected