Skip to content
Snippets Groups Projects
Commit a85af7f2 authored by Richard T. Carback III's avatar Richard T. Carback III
Browse files

Add historical rounds event report

parent 402d3433
No related branches found
No related tags found
3 merge requests!23Release,!13Hotfix/no host cooldown + return sende2e TS,!11Client Event Reporting API
......@@ -67,15 +67,26 @@ func (m *manager) followNetwork(report interfaces.ClientErrorReport,
case <-TrackTicker.C:
numPolls := atomic.SwapUint64(m.tracker, 0)
if m.numLatencies != 0 {
latencyAvg := time.Nanosecond * time.Duration(m.latencySum/m.numLatencies)
latencyAvg := time.Nanosecond * time.Duration(
m.latencySum/m.numLatencies)
m.latencySum, m.numLatencies = 0, 0
jww.INFO.Printf("Polled the network %d times in the "+
"last %s, with an average newest packet latency of %s", numPolls,
debugTrackPeriod, latencyAvg)
infoMsg := fmt.Sprintf("Polled the network "+
"%d times in the last %s, with an "+
"average newest packet latency of %s",
numPolls, debugTrackPeriod, latencyAvg)
jww.INFO.Printf(infoMsg)
m.Internal.Events.Report(1, "Polling",
"MetricsWithLatency", infoMsg)
} else {
jww.INFO.Printf("Polled the network %d times in the "+
"last %s", numPolls, debugTrackPeriod)
infoMsg := fmt.Sprintf("Polled the network "+
"%d times in the last %s", numPolls,
debugTrackPeriod)
jww.INFO.Printf(infoMsg)
m.Internal.Events.Report(1, "Polling",
"Metrics", infoMsg)
}
}
}
......@@ -133,7 +144,9 @@ func (m *manager) follow(report interfaces.ClientErrorReport, rng csprng.Source,
fmt.Sprintf("%+v", err),
)
}
jww.ERROR.Printf("Unable to poll gateways: %+v", err)
errMsg := fmt.Sprintf("Unable to poll gateway: %+v", err)
m.Internal.Events.Report(10, "Polling", "Error", errMsg)
jww.ERROR.Printf(errMsg)
return
}
......
......@@ -8,6 +8,7 @@
package rounds
import (
"fmt"
jww "github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/stoppable"
"gitlab.com/elixxir/client/storage/reception"
......@@ -73,7 +74,7 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, stop *stop
}
// get new round to lookup and force a lookup if
case r := <-m.historicalRounds:
jww.DEBUG.Printf("Recieved and quing round %d for "+
jww.DEBUG.Printf("Received and queueing round %d for "+
"historical rounds lookup", r.rid)
roundRequests = append(roundRequests, r)
if len(roundRequests) > int(m.params.MaxHistoricalRounds) {
......@@ -97,9 +98,11 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, stop *stop
Rounds: rounds,
}
var gwHost *connect.Host
result, err := m.sender.SendToAny(func(host *connect.Host) (interface{}, error) {
jww.DEBUG.Printf("Requesting Historical rounds %v from "+
"gateway %s", rounds, host.GetId())
gwHost = host
return comm.RequestHistoricalRounds(host, hr)
}, stop)
......@@ -113,29 +116,34 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, stop *stop
}
response := result.(*pb.HistoricalRoundsResponse)
rids := make([]uint64, 0)
// process the returned historical roundRequests.
for i, roundInfo := range response.Rounds {
// The interface has missing returns returned as nil, such roundRequests
// need be be removes as processing so the network follower will
// pick them up in the future.
if roundInfo == nil {
var errMsg string
roundRequests[i].numAttempts++
if roundRequests[i].numAttempts == m.params.MaxHistoricalRoundsRetries {
jww.ERROR.Printf("Failed to retreive historical "+
errMsg = fmt.Sprintf("Failed to retreive historical "+
"round %d on last attempt, will not try again",
roundRequests[i].rid)
} else {
select {
case m.historicalRounds <- roundRequests[i]:
jww.WARN.Printf("Failed to retreive historical "+
errMsg = fmt.Sprintf("Failed to retreive historical "+
"round %d, will try up to %d more times",
roundRequests[i].rid, m.params.MaxHistoricalRoundsRetries-roundRequests[i].numAttempts)
default:
jww.WARN.Printf("Failed to retreive historical "+
errMsg = fmt.Sprintf("Failed to retreive historical "+
"round %d, failed to try again, round will not be "+
"retreived", roundRequests[i].rid)
}
}
jww.WARN.Printf(errMsg)
m.Internal.Events.Report(5, "HistoricalRounds",
"Error", errMsg)
continue
}
// Successfully retrieved roundRequests are sent to the Message
......@@ -145,8 +153,14 @@ func (m *Manager) processHistoricalRounds(comm historicalRoundsComms, stop *stop
identity: roundRequests[i].identity,
}
m.lookupRoundMessages <- rl
rids = append(rids, roundInfo.ID)
}
m.Internal.Events.Report(1, "HistoricalRounds", "Metrics",
fmt.Sprintf("Received %d historical rounds from"+
" gateway %s: %v", len(response.Rounds), gwHost,
rids))
//clear the buffer now that all have been checked
roundRequests = make([]historicalRoundRequest, 0)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment