Skip to content

Commit f98fa29

Browse files
authored
Merge pull request #836 from pastelnetwork/removeDebugLogs
remove debug logs from self-healing
2 parents 555e95c + 096305b commit f98fa29

9 files changed

+88
-107
lines changed

supernode/services/selfhealing/broadcast_self_healing_metrics.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ import (
1515

1616
// BroadcastSelfHealingMetrics worker broadcasts the metrics to the entire network
1717
func (task *SHTask) BroadcastSelfHealingMetrics(ctx context.Context) error {
18-
log.WithContext(ctx).Infoln("BroadcastSelfHealingMetrics has been invoked")
18+
log.WithContext(ctx).Debug("BroadcastSelfHealingMetrics has been invoked")
1919

2020
pingInfos, err := task.historyDB.GetAllPingInfoForOnlineNodes()
2121
if err != nil {
2222
log.WithContext(ctx).WithError(err).Error("error retrieving ping info for online nodes")
2323
return errors.Errorf("error retrieving ping info")
2424
}
2525
log.WithContext(ctx).WithField("total_node_infos", len(pingInfos)).
26-
Info("online node info has been retrieved for metrics broadcast")
26+
Debug("online node info has been retrieved for metrics broadcast")
2727

2828
sem := make(chan struct{}, 5) // Limit set to 10
2929
var wg sync.WaitGroup
@@ -105,7 +105,7 @@ func (task *SHTask) BroadcastSelfHealingMetrics(ctx context.Context) error {
105105

106106
wg.Wait()
107107

108-
log.WithContext(ctx).Info("self-healing metrics have been broadcast")
108+
log.WithContext(ctx).Debug("self-healing metrics have been broadcast")
109109

110110
return nil
111111
}

supernode/services/selfhealing/generate_self_healing.go

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,18 @@ type SymbolFileKeyDetails struct {
4444

4545
// GenerateSelfHealingChallenge worker checks the ping info and identify self-healing tickets and their recipients
4646
func (task *SHTask) GenerateSelfHealingChallenge(ctx context.Context) error {
47-
log.WithContext(ctx).Infoln("Self Healing Worker has been invoked")
47+
log.WithContext(ctx).Infoln("Generate Self Healing Worker has been invoked")
4848

4949
watchlistPingInfos, err := task.retrieveWatchlistPingInfo(ctx)
5050
if err != nil {
5151
log.WithContext(ctx).WithError(err).Error("retrieveWatchlistPingInfo")
5252
return errors.Errorf("error retrieving watchlist ping info")
5353
}
54-
log.WithContext(ctx).Info("watchlist ping history has been retrieved")
54+
log.WithContext(ctx).Debug("watchlist ping history has been retrieved")
5555

5656
shouldTrigger, watchlistPingInfos := task.shouldTriggerSelfHealing(watchlistPingInfos)
5757
if !shouldTrigger {
58-
log.WithContext(ctx).WithField("no_of_nodes_on_watchlist", len(watchlistPingInfos)).Info("not enough nodes on the watchlist, skipping further processing")
58+
log.WithContext(ctx).WithField("no_of_nodes_on_watchlist", len(watchlistPingInfos)).Debug("not enough nodes on the watchlist, skipping further processing")
5959
return nil
6060
}
6161
log.WithContext(ctx).Info("self-healing has been triggered, proceeding with the identification of files & recipients")
@@ -67,18 +67,18 @@ func (task *SHTask) GenerateSelfHealingChallenge(ctx context.Context) error {
6767
log.WithContext(ctx).WithError(err).Error("error retrieving symbol file keys from NFT & action tickets")
6868
return errors.Errorf("error retrieving symbol file keys")
6969
}
70-
log.WithContext(ctx).WithField("total_keys", len(keys)).Info("all the keys from NFT and action tickets have been listed")
70+
log.WithContext(ctx).WithField("total_keys", len(keys)).Debug("all the keys from NFT and action tickets have been listed")
7171

7272
mapOfClosestNodesAgainstKeys := task.createClosestNodesMapAgainstKeys(ctx, keys, watchlistPingInfos)
7373
if len(mapOfClosestNodesAgainstKeys) == 0 {
7474
log.WithContext(ctx).Error("unable to create map of closest nodes against keys")
7575
return nil
7676
}
77-
log.WithContext(ctx).Info("map of closest nodes against keys have been created")
77+
log.WithContext(ctx).Debug("map of closest nodes against keys have been created")
7878

7979
selfHealingTicketsMap := task.identifySelfHealingTickets(ctx, watchlistPingInfos, mapOfClosestNodesAgainstKeys, symbolFileKeyMap)
8080
if len(selfHealingTicketsMap) == 0 {
81-
log.WithContext(ctx).Info("no tickets required self-healing")
81+
log.WithContext(ctx).Debug("no tickets required self-healing")
8282

8383
if err := task.updateWatchlist(ctx, watchlistPingInfos); err != nil {
8484
log.WithContext(ctx).WithError(err).Error("error updating watchlist ping info")
@@ -92,7 +92,7 @@ func (task *SHTask) GenerateSelfHealingChallenge(ctx context.Context) error {
9292
if err != nil {
9393
log.WithContext(ctx).WithError(err).Error("error identifying challenge recipients")
9494
}
95-
log.WithContext(ctx).WithField("challenge_recipients", len(challengeRecipientMap)).Info("challenge recipients have been identified")
95+
log.WithContext(ctx).WithField("challenge_recipients", len(challengeRecipientMap)).Debug("challenge recipients have been identified")
9696

9797
blockNum, err := task.PastelClient.GetBlockCount(ctx)
9898
if err != nil {
@@ -123,7 +123,7 @@ func (task *SHTask) GenerateSelfHealingChallenge(ctx context.Context) error {
123123
if err := task.updateWatchlist(ctx, watchlistPingInfos); err != nil {
124124
log.WithContext(ctx).WithError(err).Error("error updating watchlist ping info")
125125
}
126-
log.WithContext(ctx).Info("watchlist has been adjusted")
126+
log.WithContext(ctx).Info("self-healing triggered & watchlist has been adjusted")
127127

128128
return nil
129129
}
@@ -185,7 +185,7 @@ func (service *SHService) ListSymbolFileKeysFromNFTAndActionTickets(ctx context.
185185
if err != nil {
186186
return keys, symbolFileKeyMap, err
187187
}
188-
log.WithContext(ctx).WithField("count", len(regTickets)).Info("Reg tickets retrieved")
188+
log.WithContext(ctx).WithField("count", len(regTickets)).Debug("Reg tickets retrieved")
189189

190190
for i := 0; i < len(regTickets); i++ {
191191
decTicket, err := pastel.DecodeNFTTicket(regTickets[i].RegTicketData.NFTTicket)
@@ -209,10 +209,10 @@ func (service *SHService) ListSymbolFileKeysFromNFTAndActionTickets(ctx context.
209209
return keys, symbolFileKeyMap, err
210210
}
211211
if len(actionTickets) == 0 {
212-
log.WithContext(ctx).WithField("count", len(actionTickets)).Info("no action tickets retrieved")
212+
log.WithContext(ctx).WithField("count", len(actionTickets)).Debug("no action tickets retrieved")
213213
return keys, symbolFileKeyMap, nil
214214
}
215-
log.WithContext(ctx).WithField("count", len(actionTickets)).Info("Action tickets retrieved")
215+
log.WithContext(ctx).WithField("count", len(actionTickets)).Debug("Action tickets retrieved")
216216

217217
for i := 0; i < len(actionTickets); i++ {
218218
decTicket, err := pastel.DecodeActionTicket(actionTickets[i].ActionTicketData.ActionTicket)
@@ -283,7 +283,7 @@ func (task *SHTask) identifyClosestNodes(ctx context.Context, key string, nodesO
283283
}
284284

285285
func (task *SHTask) identifySelfHealingTickets(ctx context.Context, watchlistPingInfos types.PingInfos, keyClosestNodesMap map[string][]string, symbolFileKeyMap map[string]SymbolFileKeyDetails) map[string]SymbolFileKeyDetails {
286-
log.WithContext(ctx).Info("identifying tickets for self healing")
286+
log.WithContext(ctx).Debug("identifying tickets for self healing")
287287
selfHealingTicketsMap := make(map[string]SymbolFileKeyDetails)
288288

289289
for key, closestNodes := range keyClosestNodesMap {
@@ -348,7 +348,7 @@ func (task *SHTask) identifyChallengeRecipients(ctx context.Context, selfHealing
348348

349349
challengeRecipients := task.SHService.GetNClosestSupernodeIDsToComparisonString(ctx, 1, string(dataHash), task.filterWatchlistAndCurrentNode(watchlist, listOfSupernodes))
350350
if len(challengeRecipients) < 1 {
351-
log.WithContext(ctx).WithField("file_hash", dataHash).Info("no closest nodes have found against the file")
351+
log.WithContext(ctx).WithField("file_hash", dataHash).Debug("no closest nodes have found against the file")
352352
continue
353353
}
354354
recipient := challengeRecipients[0]
@@ -482,10 +482,10 @@ func (task *SHTask) getDataHash(nftTicket *pastel.NFTTicket, cascadeTicket *past
482482
}
483483

484484
func (task *SHTask) prepareAndSendSelfHealingMessage(ctx context.Context, challengeRecipientMap map[string][]SymbolFileKeyDetails, triggerID string, nodesOnWatchlist string) error {
485-
log.WithContext(ctx).WithField("method", "prepareAndSendSelfHealingMessage").Info("method has been invoked")
485+
log.WithContext(ctx).WithField("method", "prepareAndSendSelfHealingMessage").Debug("method has been invoked")
486486

487487
var err error
488-
log.WithContext(ctx).Info("retrieving block no and verbose")
488+
log.WithContext(ctx).Debug("retrieving block no and verbose")
489489
currentBlockCount, err := task.SuperNodeService.PastelClient.GetBlockCount(ctx)
490490
if err != nil {
491491
log.WithContext(ctx).WithError(err).Error("could not get current block count")
@@ -502,7 +502,7 @@ func (task *SHTask) prepareAndSendSelfHealingMessage(ctx context.Context, challe
502502
challengeTickets := getTicketsForSelfHealingChallengeMessage(ticketsDetails, challengeRecipient)
503503

504504
log.WithContext(ctx).WithField("recipient_id", challengeRecipient).
505-
WithField("total_tickets", len(challengeTickets)).Info("sending for self-healing")
505+
WithField("total_tickets", len(challengeTickets)).Debug("sending for self-healing")
506506

507507
msgData := types.SelfHealingMessageData{
508508
ChallengerID: task.nodeID,
@@ -534,7 +534,7 @@ func (task *SHTask) prepareAndSendSelfHealingMessage(ctx context.Context, challe
534534
continue
535535
}
536536
}
537-
log.WithContext(ctx).Info("self-healing messages have been sent")
537+
log.WithContext(ctx).Debug("self-healing messages have been sent")
538538

539539
return nil
540540
}
@@ -601,7 +601,7 @@ func (task *SHTask) GetNodeToConnect(ctx context.Context, nodeID string) (*paste
601601
func (task *SHTask) SendMessage(ctx context.Context, challengeMessage types.SelfHealingMessage, processingSupernodeAddr string) error {
602602
logger := log.WithContext(ctx).WithField("trigger_id", challengeMessage.TriggerID)
603603

604-
logger.Info("sending self-healing challenge to processing supernode address: " + processingSupernodeAddr)
604+
logger.Debug("sending self-healing challenge to processing supernode address: " + processingSupernodeAddr)
605605

606606
ctx, cancel := context.WithTimeout(ctx, timeoutDuration)
607607
defer cancel()

supernode/services/selfhealing/ping_nodes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const (
2323

2424
// FetchAndMaintainPingInfo fetch and maintains the ping info in db for every node
2525
func (task *SHTask) FetchAndMaintainPingInfo(ctx context.Context) error {
26-
log.WithContext(ctx).Infoln("Self Healing Ping Nodes Worker invoked")
26+
log.WithContext(ctx).Debug("Self Healing Ping Nodes Worker invoked")
2727

2828
nodesToPing, err := task.getNodesAddressesToConnect(ctx)
2929
if err != nil {

supernode/services/selfhealing/process_broadcasted_self_healing_metrics.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func (task *SHTask) ProcessBroadcastedSelfHealingMetrics(ctx context.Context, re
2929
return err
3030
}
3131
}
32-
logger.Info("generation metrics have been stored")
32+
logger.Debug("generation metrics have been stored")
3333
case types.ExecutionSelfHealingMetricType:
3434
execMetrics, err := task.decompressExecutionMetricsData(req.Data)
3535
if err != nil {
@@ -43,7 +43,7 @@ func (task *SHTask) ProcessBroadcastedSelfHealingMetrics(ctx context.Context, re
4343
return err
4444
}
4545

46-
logger.Info("execution metrics have been stored")
46+
logger.Debug("execution metrics have been stored")
4747
}
4848

4949
return nil

0 commit comments

Comments
 (0)