diff --git a/management/server/account.go b/management/server/account.go index e78211698..ce65da18b 100644 --- a/management/server/account.go +++ b/management/server/account.go @@ -11,6 +11,7 @@ import ( "net/netip" "reflect" "regexp" + "runtime/debug" "strings" "sync" "time" @@ -388,6 +389,8 @@ func (a *Account) GetGroup(groupID string) *nbgroup.Group { // GetPeerNetworkMap returns a group by ID if exists, nil otherwise func (a *Account) GetPeerNetworkMap(peerID, dnsDomain string, validatedPeersMap map[string]struct{}) *NetworkMap { + log.Debugf("GetNetworkMap with trace: %s", string(debug.Stack())) + peer := a.Peers[peerID] if peer == nil { return &NetworkMap{ diff --git a/management/server/peer.go b/management/server/peer.go index 5c9136cb2..afb5e5fbc 100644 --- a/management/server/peer.go +++ b/management/server/peer.go @@ -3,6 +3,7 @@ package server import ( "fmt" "net" + "runtime/debug" "strings" "time" @@ -289,6 +290,7 @@ func (am *DefaultAccountManager) DeletePeer(accountID, peerID, userID string) er // GetNetworkMap returns Network map for a given peer (omits original peer from the Peers result) func (am *DefaultAccountManager) GetNetworkMap(peerID string) (*NetworkMap, error) { + log.Debugf("GetNetworkMap with trace: %s", string(debug.Stack())) account, err := am.Store.GetAccountByPeerID(peerID) if err != nil { return nil, err @@ -541,12 +543,6 @@ func (am *DefaultAccountManager) SyncPeer(sync PeerSync, account *Account) (*nbp // LoginPeer logs in or registers a peer. // If peer doesn't exist the function checks whether a setup key or a user is present and registers a new peer if so. func (am *DefaultAccountManager) LoginPeer(login PeerLogin) (*nbpeer.Peer, *NetworkMap, error) { - startTime := time.Now() - defer func() { - duration := time.Since(startTime) - log.Debugf("LoginPeer took %s", duration) - }() - account, err := am.Store.GetAccountByPeerPubKey(login.WireGuardPubKey) if err != nil { if errStatus, ok := status.FromError(err); ok && errStatus.Type() == status.NotFound { diff --git a/management/server/peer/peer.go b/management/server/peer/peer.go index 42efe40aa..e62843180 100644 --- a/management/server/peer/peer.go +++ b/management/server/peer/peer.go @@ -5,8 +5,6 @@ import ( "net" "net/netip" "time" - - log "github.com/sirupsen/logrus" ) // Peer represents a machine connected to the network. @@ -175,8 +173,6 @@ func (p *Peer) UpdateMetaIfNew(meta PeerSystemMeta) bool { meta.UIVersion = p.Meta.UIVersion } - log.Infof("Check if meta is equal: %v", p.Meta.isEqual(meta)) - if p.Meta.isEqual(meta) { return false } diff --git a/management/server/sqlite_store.go b/management/server/sqlite_store.go index 609d71cd2..044eae61e 100644 --- a/management/server/sqlite_store.go +++ b/management/server/sqlite_store.go @@ -479,12 +479,6 @@ func (s *SqliteStore) GetAccount(accountID string) (*Account, error) { } func (s *SqliteStore) GetAccountByUser(userID string) (*Account, error) { - startTime := time.Now() - defer func() { - duration := time.Since(startTime) - log.Debugf("GetAccountByUser took %s", duration) - }() - var user User result := s.db.Select("account_id").First(&user, "id = ?", userID) if result.Error != nil { @@ -503,11 +497,6 @@ func (s *SqliteStore) GetAccountByUser(userID string) (*Account, error) { } func (s *SqliteStore) GetAccountByPeerID(peerID string) (*Account, error) { - startTime := time.Now() - defer func() { - duration := time.Since(startTime) - log.Debugf("GetAccountByPeerID took %s", duration) - }() var peer nbpeer.Peer result := s.db.Select("account_id").First(&peer, "id = ?", peerID) if result.Error != nil { @@ -526,12 +515,6 @@ func (s *SqliteStore) GetAccountByPeerID(peerID string) (*Account, error) { } func (s *SqliteStore) GetAccountByPeerPubKey(peerKey string) (*Account, error) { - startTime := time.Now() - defer func() { - duration := time.Since(startTime) - log.Debugf("GetAccountByPubKey took %s", duration) - }() - var peer nbpeer.Peer result := s.db.Select("account_id").First(&peer, "key = ?", peerKey) @@ -551,12 +534,6 @@ func (s *SqliteStore) GetAccountByPeerPubKey(peerKey string) (*Account, error) { } func (s *SqliteStore) GetAccountIDByPeerPubKey(peerKey string) (string, error) { - startTime := time.Now() - defer func() { - duration := time.Since(startTime) - log.Debugf("GetAccountByPubKey took %s", duration) - }() - var peer nbpeer.Peer var accountID string result := s.db.Model(&peer).Select("account_id").Where("key = ?", peerKey).First(&accountID) @@ -573,12 +550,6 @@ func (s *SqliteStore) GetAccountIDByPeerPubKey(peerKey string) (string, error) { // SaveUserLastLogin stores the last login time for a user in DB. func (s *SqliteStore) SaveUserLastLogin(accountID, userID string, lastLogin time.Time) error { - startTime := time.Now() - defer func() { - duration := time.Since(startTime) - log.Debugf("SaveUserLastLogin took %s", duration) - }() - var user User result := s.db.First(&user, "account_id = ? and id = ?", accountID, userID)