From ca136ad2c4179da68aa643434e5b1c5e0bb2b635 Mon Sep 17 00:00:00 2001 From: genofire Date: Sat, 20 Jul 2024 00:33:16 +0200 Subject: [PATCH] fix(database/influxdb*): add type to link --- database/influxdb/link.go | 1 + database/influxdb/node_test.go | 1 + database/influxdb2/link.go | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/database/influxdb/link.go b/database/influxdb/link.go index 37c2bd90..3ccbebcb 100644 --- a/database/influxdb/link.go +++ b/database/influxdb/link.go @@ -14,6 +14,7 @@ func (conn *Connection) InsertLink(link *runtime.Link, t time.Time) { tags.SetString("source.addr", link.SourceAddress) tags.SetString("target.id", link.TargetID) tags.SetString("target.addr", link.TargetAddress) + tags.SetString("type", link.Type.String()) if link.SourceHostname != "" { tags.SetString("source.hostname", link.SourceHostname) } diff --git a/database/influxdb/node_test.go b/database/influxdb/node_test.go index 1a3683ad..5580ce45 100644 --- a/database/influxdb/node_test.go +++ b/database/influxdb/node_test.go @@ -187,6 +187,7 @@ func TestToInflux(t *testing.T) { "source.addr": "a-interface-mac", "target.id": "foobar", "target.addr": "BAFF1E5", + "type": "vpn", }, tags) assert.EqualValues(80, fields["tq"]) diff --git a/database/influxdb2/link.go b/database/influxdb2/link.go index 4dd36d0a..a28f570a 100644 --- a/database/influxdb2/link.go +++ b/database/influxdb2/link.go @@ -19,7 +19,8 @@ func (conn *Connection) InsertLink(link *runtime.Link, t time.Time) { AddTag("source.id", link.SourceID). AddTag("source.addr", link.SourceAddress). AddTag("target.id", link.TargetID). - AddTag("target.addr", link.TargetAddress) + AddTag("target.addr", link.TargetAddress). + AddTag("type", link.Type.String()) if link.SourceHostname != "" { p.AddTag("source.hostname", link.SourceHostname) }