Skip to content

Commit

Permalink
metrics: make it atomic for nydusd count
Browse files Browse the repository at this point in the history
Signed-off-by: Bin Tang <tangbin.bin@bytedance.com>
  • Loading branch information
sctb512 authored and changweige committed Jan 19, 2023
1 parent 45b476a commit a4b21d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/manager/daemon_adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func (m *Manager) StartDaemon(d *daemon.Daemon) error {
}
d.Lock()
d.Version = daemonInfo.DaemonVersion()
d.Unlock()
collector.NewDaemonInfoCollector(&d.Version, 1).Collect()
d.Unlock()

if d.Supervisor == nil {
return
Expand Down
2 changes: 2 additions & 0 deletions pkg/manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,9 @@ func (m *Manager) DestroyDaemon(d *daemon.Daemon) error {
}

collector.NewDaemonEventCollector(types.DaemonStateDestroyed).Collect()
d.Lock()
collector.NewDaemonInfoCollector(&d.Version, -1).Collect()
d.Unlock()

return nil
}
Expand Down

0 comments on commit a4b21d7

Please sign in to comment.