add method timing logs

This commit is contained in:
Pascal Fischer
2024-04-25 14:15:36 +02:00
parent 7b254cb966
commit 8f8cfcbc20
6 changed files with 75 additions and 25 deletions

View File

@@ -121,6 +121,12 @@ func getRealIP(ctx context.Context) net.IP {
// Sync validates the existence of a connecting peer, sends an initial state (all available for the connecting peers) and
// notifies the connected peer of any updates (e.g. new peers under the same account)
func (s *GRPCServer) Sync(req *proto.EncryptedMessage, srv proto.ManagementService_SyncServer) error {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("Sync took %s", duration)
}()
reqStart := time.Now()
if s.appMetrics != nil {
s.appMetrics.GRPCMetrics().CountSyncRequest()
@@ -523,6 +529,12 @@ func (s *GRPCServer) IsHealthy(ctx context.Context, req *proto.Empty) (*proto.Em
// sendInitialSync sends initial proto.SyncResponse to the peer requesting synchronization
func (s *GRPCServer) sendInitialSync(peerKey wgtypes.Key, peer *nbpeer.Peer, networkMap *NetworkMap, srv proto.ManagementService_SyncServer) error {
startTime := time.Now()
defer func() {
duration := time.Since(startTime)
log.Debugf("sendInitialSync took %s", duration)
}()
// make secret time based TURN credentials optional
var turnCredentials *TURNCredentials
if s.config.TURNConfig.TimeBasedCredentials {