-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TASK] add per-link statistics to influxdb #57
Conversation
01d77f4
to
890b15f
Compare
runtime/nodes.go
Outdated
// Update fields | ||
node.Lastseen = now | ||
node.Online = true | ||
node.Neighbours = res.Neighbours |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 delete old values if they are not updated ... respond with get-request should answers with all requested parts (nodeinfo,statistics,neighbours)
database/influxdb/node.go
Outdated
@@ -77,6 +81,9 @@ func buildNodeStats(node *runtime.Node) (tags models.Tags, fields models.Fields) | |||
batadv := 0 | |||
for _, batadvNeighbours := range neighbours.Batadv { | |||
batadv += len(batadvNeighbours.Neighbours) | |||
for neighbourID, link := range batadvNeighbours.Neighbours { | |||
conn.insertLinkStatistics(stats.NodeID, neighbourID, link.Tq, time) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the nodeid of the neighbour - it is the mac-address of the ínterface on this neighbour node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, that means it will be more complicated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(or not so beautiful replace the stats.NodeID
with the mac of the batman interface) <- 👎
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the MeshViewer able to deal with MAC addresses for links?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ATM no - he has no intention to deal with it - for it there are nodeid's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Es gibt also hier nur zwei lösungen:
- in der influxdb cachen von anderen nodes
- nodes global in
runtime
speichern und von anderen packages benutzbar (ggf. dort auch schon einemap
mit den mac adressen einfügen) - ... (ich weiß nicht alles, gibt es eine weitere Möglichkeit)
Wäre für option 2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@corny, würde es ja bauen ... wenn du mir sagst, 'wie'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also Variante 2
closes #23
2f23641
to
b576e46
Compare
Hihi, und es läuft auf dem server -> https://map.ffhb.de/#/en/map/60e327c79924-24a43ce7fe77 |
Würde gern die TQ umrechnen, in Prozent ... okay? |
runtime/nodes.go
Outdated
@@ -93,6 +88,10 @@ func (nodes *Nodes) Select(f func(*Node) bool) []*Node { | |||
return result | |||
} | |||
|
|||
func (nodes *Nodes) GetNodeIDByIface(mac string) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exported method Nodes.GetNodeIDByIface should have comment or be unexported
runtime/nodes.go
Outdated
@@ -93,6 +88,10 @@ func (nodes *Nodes) Select(f func(*Node) bool) []*Node { | |||
return result | |||
} | |||
|
|||
func (nodes *Nodes) GetNodeIDByIface(mac string) string { | |||
return nodes.iFaceToNodeID[mac] | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kein Locking hier für eine exportiere Methode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ist doch "nur" lesend -> wird da locking benötigt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Na klar - oder sorgst du irgendwo dafür, dass nicht gleichzeitig geschrieben wird?
runtime/nodes.go
Outdated
} | ||
nodes.Unlock() | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Der Code dieser Methode ist nicht DRY. Ich räume sie auf.
In Prozent umrechen: Ja, bin ich für! |
Kann von mir aus nun ge squash+merge werden :) |
Ohje, jetzt fällt's mir erst auf: Du hast das Einfügen der Link-Metriken in Die Berechnung der Datenpunkte muss außerhalb der Datenbank-Module geschehen. Das ist ja nichts influxdb-Spezifisches. |
b4647af
to
9675ea0
Compare
-> separation of concerns
Was passiert eigentlich, wenn mehr als einen Link zwischen zwei Knoten gibt? Bespielsweise im Falle von Mesh-On-LAN und gleichzeitigem Mesh über WLAN? |
@@ -93,6 +90,27 @@ func (nodes *Nodes) Select(f func(*Node) bool) []*Node { | |||
return result | |||
} | |||
|
|||
// NodeLinks returns a list of links to known neighbours | |||
func (nodes *Nodes) NodeLinks(node *Node) (result []Link) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gute Frage, da es blöd ist, wenn mehrere unterschiedliche TQs für "ein" Link zwischen zwei Knoten gemeldet werden.
Müsste man dies hier verarbeiten.
Policy best link wins?
Damit der LAN-Link TQ, den Mesh on Wifi schlägt?
Genauso wie ein 2.4 Ghz gegenüber ein 5 Ghz link
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ich habe mit @jplitza gesprochen. Wenn es mehrere Links gibt, sollten die Daten aller Links gespeichert werden. Also keine Abbildung von Interface-Adressen auf Node-IDs. Die Darstellung ist dann Sache des Mesh-Viewers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vorschlag, beides speichern, als Tag die MAC und die Nodeid von SRC und Target
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brauchen wir denn beides? Wie sehen die Abfragen aus, die wir machen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im Meshviewer:
In Grafana als Influx-Query:
From Source:
SELECT mean("tq") FROM "link" WHERE ("source" =~ /^$node$/ AND "target" =~ /^$nodetolink$/) AND $timeFilter GROUP BY time($__interval) fill(null)
From Target:
SELECT mean("tq") FROM "link" WHERE ("target" =~ /^$node$/ AND "source" =~ /^$nodetolink$/) AND $timeFilter GROUP BY time($__interval) fill(null)
Min:
SELECT min("tq") FROM "link" WHERE ("target" =~ /^$node$/ AND "source" =~ /^$nodetolink$/ OR "source" =~ /^$node$/ AND "target" =~ /^$nodetolink$/) AND $timeFilter GROUP BY time($__interval) fill(null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Diese kann man allerdings schlecht in Grafana oder anderen Auswertungstools für influxdb verwenden.
(Wenn der Meshviewer die MAC aus der JSON nutzt, doch eine Community kein Meshviewer nutzt, ist der Link total nutzlos.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stimme @genofire da zu: Wenn das Grafana halbwegs self-contained sein soll, dann muss die NodeID (auch) mit rein. Und das sollte es meiner Meinung nach, um so etwas wie Dashboards zu Knoten oder zu Orten zu ermögilchen.
Und bei einer Retention Time von 7d stören uns die paar Daten doch nicht, oder?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mich stört es nicht, das die MAC drin ist. Da es die vom Node ist - doch dein Satz, welches mit "Und ..."-Anfängt spricht doch eher für die NodeID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Äh, sorry, ich war verwirrt. Ich meinte NodeID statt MAC-Adresse. Habs korrigiert.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Das sehe ich ein. Ich habe einen Commit hinzugefügt, damit jetzt Source-ID, Source-MAC, Target-ID und Target-MAC pro Link gespeichert werden.
<3 teste ich gleich - der Commit sieht so gut aus |
closes #23