Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
goshimmer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
iota-imt
goshimmer
Commits
9dbb3139
Unverified
Commit
9dbb3139
authored
4 years ago
by
Levente Pap
Committed by
GitHub
4 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix decoding node IDs in analysis server (#503)
parent
57fb70b7
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
plugins/analysis/dashboard/recorded_events.go
+13
-7
13 additions, 7 deletions
plugins/analysis/dashboard/recorded_events.go
plugins/analysis/packet/heartbeat.go
+1
-1
1 addition, 1 deletion
plugins/analysis/packet/heartbeat.go
with
14 additions
and
8 deletions
plugins/analysis/dashboard/recorded_events.go
+
13
−
7
View file @
9dbb3139
...
@@ -10,7 +10,7 @@ import (
...
@@ -10,7 +10,7 @@ import (
analysisserver
"github.com/iotaledger/goshimmer/plugins/analysis/server"
analysisserver
"github.com/iotaledger/goshimmer/plugins/analysis/server"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/daemon"
"github.com/iotaledger/hive.go/events"
"github.com/iotaledger/hive.go/events"
"github.com/
mr-tron/base58
"
"github.com/
iotaledger/hive.go/identity
"
)
)
// the period in which we scan and delete old data.
// the period in which we scan and delete old data.
...
@@ -29,22 +29,22 @@ func configureEventsRecording() {
...
@@ -29,22 +29,22 @@ func configureEventsRecording() {
analysisserver
.
Events
.
Heartbeat
.
Attach
(
events
.
NewClosure
(
func
(
hb
*
packet
.
Heartbeat
)
{
analysisserver
.
Events
.
Heartbeat
.
Attach
(
events
.
NewClosure
(
func
(
hb
*
packet
.
Heartbeat
)
{
var
out
strings
.
Builder
var
out
strings
.
Builder
for
_
,
value
:=
range
hb
.
OutboundIDs
{
for
_
,
value
:=
range
hb
.
OutboundIDs
{
out
.
WriteString
(
base58
.
Encode
(
value
))
out
.
WriteString
(
shortNodeIDString
(
value
))
}
}
var
in
strings
.
Builder
var
in
strings
.
Builder
for
_
,
value
:=
range
hb
.
InboundIDs
{
for
_
,
value
:=
range
hb
.
InboundIDs
{
in
.
WriteString
(
base58
.
Encode
(
value
))
in
.
WriteString
(
shortNodeIDString
(
value
))
}
}
log
.
Debugw
(
log
.
Debugw
(
"Heartbeat"
,
"Heartbeat"
,
"nodeId"
,
base58
.
Encode
(
hb
.
OwnID
),
"nodeId"
,
shortNodeIDString
(
hb
.
OwnID
),
"outboundIds"
,
out
.
String
(),
"outboundIds"
,
out
.
String
(),
"inboundIds"
,
in
.
String
(),
"inboundIds"
,
in
.
String
(),
)
)
lock
.
Lock
()
lock
.
Lock
()
defer
lock
.
Unlock
()
defer
lock
.
Unlock
()
nodeIDString
:=
base58
.
Encode
(
hb
.
OwnID
)
nodeIDString
:=
shortNodeIDString
(
hb
.
OwnID
)
timestamp
:=
time
.
Now
()
timestamp
:=
time
.
Now
()
// when node is new, add to graph
// when node is new, add to graph
...
@@ -56,7 +56,7 @@ func configureEventsRecording() {
...
@@ -56,7 +56,7 @@ func configureEventsRecording() {
// outgoing neighbor links update
// outgoing neighbor links update
for
_
,
outgoingNeighbor
:=
range
hb
.
OutboundIDs
{
for
_
,
outgoingNeighbor
:=
range
hb
.
OutboundIDs
{
outgoingNeighborString
:=
base58
.
Encode
(
outgoingNeighbor
)
outgoingNeighborString
:=
shortNodeIDString
(
outgoingNeighbor
)
// do we already know about this neighbor?
// do we already know about this neighbor?
// if no, add it and set it online
// if no, add it and set it online
if
_
,
isAlready
:=
nodes
[
outgoingNeighborString
];
!
isAlready
{
if
_
,
isAlready
:=
nodes
[
outgoingNeighborString
];
!
isAlready
{
...
@@ -82,7 +82,7 @@ func configureEventsRecording() {
...
@@ -82,7 +82,7 @@ func configureEventsRecording() {
// incoming neighbor links update
// incoming neighbor links update
for
_
,
incomingNeighbor
:=
range
hb
.
InboundIDs
{
for
_
,
incomingNeighbor
:=
range
hb
.
InboundIDs
{
incomingNeighborString
:=
base58
.
Encode
(
incomingNeighbor
)
incomingNeighborString
:=
shortNodeIDString
(
incomingNeighbor
)
// do we already know about this neighbor?
// do we already know about this neighbor?
// if no, add it and set it online
// if no, add it and set it online
if
_
,
isAlready
:=
nodes
[
incomingNeighborString
];
!
isAlready
{
if
_
,
isAlready
:=
nodes
[
incomingNeighborString
];
!
isAlready
{
...
@@ -206,3 +206,9 @@ type EventHandlers struct {
...
@@ -206,3 +206,9 @@ type EventHandlers struct {
// EventHandlersConsumer defines the consumer function of an *EventHandlers.
// EventHandlersConsumer defines the consumer function of an *EventHandlers.
type
EventHandlersConsumer
=
func
(
handler
*
EventHandlers
)
type
EventHandlersConsumer
=
func
(
handler
*
EventHandlers
)
func
shortNodeIDString
(
b
[]
byte
)
string
{
var
id
identity
.
ID
copy
(
id
[
:
],
b
)
return
id
.
String
()
}
This diff is collapsed.
Click to expand it.
plugins/analysis/packet/heartbeat.go
+
1
−
1
View file @
9dbb3139
...
@@ -162,7 +162,7 @@ func NewHeartbeatMessage(hb *Heartbeat) ([]byte, error) {
...
@@ -162,7 +162,7 @@ func NewHeartbeatMessage(hb *Heartbeat) ([]byte, error) {
return
nil
,
err
return
nil
,
err
}
}
// write serialized packet bytes into the buffer
// write serialized packet bytes into the buffer
if
err
:=
binary
.
Write
(
buf
,
binary
.
Little
Endian
,
packet
);
err
!=
nil
{
if
err
:=
binary
.
Write
(
buf
,
binary
.
Big
Endian
,
packet
);
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
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