Skip to content

Commit

Permalink
Add discovery duration logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
VillePihlava committed Feb 13, 2023
1 parent ac271b3 commit 0019029
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pkg/nfd-worker/nfd-worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,20 @@ func (i *infiniteTicker) Reset(d time.Duration) {

// Run feature discovery.
func (w *nfdWorker) runFeatureDiscovery() error {
discoveryStart := time.Now()
for _, s := range w.featureSources {
klog.V(2).Infof("running discovery for %q source", s.Name())
currentSourceStart := time.Now()
if err := s.Discover(); err != nil {
klog.Errorf("feature discovery of %q source failed: %v", s.Name(), err)
}
klog.V(3).Infof("discovery duration for %q source: %v", s.Name(), time.Since(currentSourceStart))
}

discoveryDuration := time.Since(discoveryStart)
klog.V(3).Infof("feature discovery for sources lasted for: %v", discoveryDuration)
if discoveryDuration > 5*time.Second {
klog.Warningf("feature discovery for sources lasted for more than 5s (%v)", discoveryDuration)
}

// Get the set of feature labels.
Expand Down Expand Up @@ -359,7 +368,7 @@ func (w *nfdWorker) grpcDisconnect() {
}
func (c *coreConfig) sanitize() {
if c.SleepInterval.Duration > 0 && c.SleepInterval.Duration < time.Second {
klog.Warningf("too short sleep-intervall specified (%s), forcing to 1s",
klog.Warningf("too short sleep interval specified (%s), forcing to 1s",
c.SleepInterval.Duration.String())
c.SleepInterval = duration{time.Second}
}
Expand Down

0 comments on commit 0019029

Please sign in to comment.