Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add discovery duration logging #1055

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions pkg/nfd-worker/nfd-worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,19 @@ 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(2).Infof("feature discovery for %d sources lasted for: %v", len(w.featureSources), discoveryDuration)
if w.config.Core.SleepInterval.Duration > 0 && discoveryDuration > w.config.Core.SleepInterval.Duration/2 {
klog.Warningf("feature discovery sources took over half (%v) of sleep interval (%v)", discoveryDuration, w.config.Core.SleepInterval.Duration)
}

// Get the set of feature labels.
Expand Down Expand Up @@ -359,7 +367,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