Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
a85af7f2
Commit
a85af7f2
authored
3 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add historical rounds event report
parent
402d3433
No related branches found
No related tags found
3 merge requests
!23
Release
,
!13
Hotfix/no host cooldown + return sende2e TS
,
!11
Client Event Reporting API
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
network/follow.go
+20
-7
20 additions, 7 deletions
network/follow.go
network/rounds/historical.go
+18
-4
18 additions, 4 deletions
network/rounds/historical.go
with
38 additions
and
11 deletions
network/follow.go
+
20
−
7
View file @
a85af7f2
...
...
@@ -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
}
...
...
This diff is collapsed.
Click to expand it.
network/rounds/historical.go
+
18
−
4
View file @
a85af7f2
...
...
@@ -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
(
"Rec
i
eved and quing round %d for "
+
jww
.
DEBUG
.
Printf
(
"Rece
i
ved and qu
eue
ing 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
.
P
rintf
(
"Failed to retreive historical "
+
errMsg
=
fmt
.
Sp
rintf
(
"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
.
P
rintf
(
"Failed to retreive historical "
+
errMsg
=
fmt
.
Sp
rintf
(
"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
.
P
rintf
(
"Failed to retreive historical "
+
errMsg
=
fmt
.
Sp
rintf
(
"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
)
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment