From c11420ff0f5f11c4a991b6f15ed9803c1c06e19a Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Wed, 30 Oct 2024 12:43:46 +0100 Subject: [PATCH 1/4] add metrics and fix return value on error --- .../server/telemetry/updatechannel_metrics.go | 12 ++++++++++++ management/server/updatechannel.go | 13 +++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/management/server/telemetry/updatechannel_metrics.go b/management/server/telemetry/updatechannel_metrics.go index 2582006e517..fb33b663c62 100644 --- a/management/server/telemetry/updatechannel_metrics.go +++ b/management/server/telemetry/updatechannel_metrics.go @@ -18,6 +18,7 @@ type UpdateChannelMetrics struct { getAllConnectedPeersDurationMicro metric.Int64Histogram getAllConnectedPeers metric.Int64Histogram hasChannelDurationMicro metric.Int64Histogram + networkMapDiffDurationMicro metric.Int64Histogram ctx context.Context } @@ -63,6 +64,11 @@ func NewUpdateChannelMetrics(ctx context.Context, meter metric.Meter) (*UpdateCh return nil, err } + networkMapDiffDurationMicro, err := meter.Int64Histogram("management.updatechannel.networkmap.diff.duration.micro") + if err != nil { + return nil, err + } + return &UpdateChannelMetrics{ createChannelDurationMicro: createChannelDurationMicro, closeChannelDurationMicro: closeChannelDurationMicro, @@ -72,6 +78,7 @@ func NewUpdateChannelMetrics(ctx context.Context, meter metric.Meter) (*UpdateCh getAllConnectedPeersDurationMicro: getAllConnectedPeersDurationMicro, getAllConnectedPeers: getAllConnectedPeers, hasChannelDurationMicro: hasChannelDurationMicro, + networkMapDiffDurationMicro: networkMapDiffDurationMicro, ctx: ctx, }, nil } @@ -111,3 +118,8 @@ func (metrics *UpdateChannelMetrics) CountGetAllConnectedPeersDuration(duration func (metrics *UpdateChannelMetrics) CountHasChannelDuration(duration time.Duration) { metrics.hasChannelDurationMicro.Record(metrics.ctx, duration.Microseconds()) } + +// CountNetworkMapDiffDurationMicro counts the duration of the NetworkMapDiff method +func (metrics *UpdateChannelMetrics) CountNetworkMapDiffDurationMicro(duration time.Duration) { + metrics.networkMapDiffDurationMicro.Record(metrics.ctx, duration.Microseconds()) +} diff --git a/management/server/updatechannel.go b/management/server/updatechannel.go index 6fb96c97124..851236035ff 100644 --- a/management/server/updatechannel.go +++ b/management/server/updatechannel.go @@ -7,11 +7,11 @@ import ( "sync" "time" - "github.com/netbirdio/netbird/management/server/differs" "github.com/r3labs/diff/v3" log "github.com/sirupsen/logrus" "github.com/netbirdio/netbird/management/proto" + "github.com/netbirdio/netbird/management/server/differs" "github.com/netbirdio/netbird/management/server/telemetry" ) @@ -208,10 +208,10 @@ func (p *PeersUpdateManager) handlePeerMessageUpdate(ctx context.Context, peerID p.channelsMux.RUnlock() if lastSentUpdate != nil { - updated, err := isNewPeerUpdateMessage(ctx, lastSentUpdate, update) + updated, err := isNewPeerUpdateMessage(ctx, lastSentUpdate, update, p.metrics.UpdateChannelMetrics()) if err != nil { log.WithContext(ctx).Errorf("error checking for SyncResponse updates: %v", err) - return false + return true } if !updated { log.WithContext(ctx).Debugf("peer %s network map is not updated, skip sending update", peerID) @@ -223,7 +223,9 @@ func (p *PeersUpdateManager) handlePeerMessageUpdate(ctx context.Context, peerID } // isNewPeerUpdateMessage checks if the given current update message is a new update that should be sent. -func isNewPeerUpdateMessage(ctx context.Context, lastSentUpdate, currUpdateToSend *UpdateMessage) (isNew bool, err error) { +func isNewPeerUpdateMessage(ctx context.Context, lastSentUpdate, currUpdateToSend *UpdateMessage, metric *telemetry.UpdateChannelMetrics) (isNew bool, err error) { + startTime := time.Now() + defer func() { if r := recover(); r != nil { log.WithContext(ctx).Panicf("comparing peer update messages. Trace: %s", debug.Stack()) @@ -258,6 +260,9 @@ func isNewPeerUpdateMessage(ctx context.Context, lastSentUpdate, currUpdateToSen if err != nil { return false, fmt.Errorf("failed to diff network map: %v", err) } + + metric.CountNetworkMapDiffDurationMicro(time.Since(startTime)) + return len(changelog) > 0, nil } From 7c33535f20d44435b8a3aa44b8b8fa71037599dd Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Wed, 30 Oct 2024 13:06:38 +0100 Subject: [PATCH 2/4] fix tests --- management/server/updatechannel_test.go | 42 +++++++++++++++---------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/management/server/updatechannel_test.go b/management/server/updatechannel_test.go index 52b715e9503..e525256337f 100644 --- a/management/server/updatechannel_test.go +++ b/management/server/updatechannel_test.go @@ -7,14 +7,17 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "go.opentelemetry.io/otel/metric/noop" + nbdns "github.com/netbirdio/netbird/dns" "github.com/netbirdio/netbird/management/domain" "github.com/netbirdio/netbird/management/proto" nbpeer "github.com/netbirdio/netbird/management/server/peer" "github.com/netbirdio/netbird/management/server/posture" + "github.com/netbirdio/netbird/management/server/telemetry" nbroute "github.com/netbirdio/netbird/route" "github.com/netbirdio/netbird/util" - "github.com/stretchr/testify/assert" ) // var peersUpdater *PeersUpdateManager @@ -190,11 +193,16 @@ func TestHandlePeerMessageUpdate(t *testing.T) { } func TestIsNewPeerUpdateMessage(t *testing.T) { + metric, err := telemetry.NewUpdateChannelMetrics(context.Background(), noop.NewMeterProvider().Meter("test")) + if err != nil { + t.Fatal(err) + } + t.Run("Unchanged value", func(t *testing.T) { newUpdateMessage1 := createMockUpdateMessage(t) newUpdateMessage2 := createMockUpdateMessage(t) - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.False(t, message) }) @@ -205,7 +213,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.False(t, message) }) @@ -217,7 +225,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Routes[0].Network = netip.MustParsePrefix("1.1.1.1/32") newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) @@ -230,7 +238,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Routes[0].Groups = []string{"randomGroup1"} newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -249,7 +257,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Peers = append(newUpdateMessage2.NetworkMap.Peers, newPeer) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -259,14 +267,14 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2 := createMockUpdateMessage(t) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.False(t, message) newUpdateMessage3 := createMockUpdateMessage(t) newUpdateMessage3.Update.Checks = []*proto.Checks{} newUpdateMessage3.Update.NetworkMap.Serial++ - message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage3) + message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage3, metric) assert.NoError(t, err) assert.True(t, message) @@ -285,7 +293,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { } newUpdateMessage4.Update.Checks = []*proto.Checks{toProtocolCheck(check)} newUpdateMessage4.Update.NetworkMap.Serial++ - message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage4) + message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage4, metric) assert.NoError(t, err) assert.True(t, message) @@ -305,7 +313,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { } newUpdateMessage5.Update.Checks = []*proto.Checks{toProtocolCheck(check)} newUpdateMessage5.Update.NetworkMap.Serial++ - message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage5) + message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage5, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -321,7 +329,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { ) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -333,7 +341,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Peers[0].IP = net.ParseIP("192.168.1.10") newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -345,7 +353,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.FirewallRules[0].Port = "443" newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -364,7 +372,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.FirewallRules = append(newUpdateMessage2.NetworkMap.FirewallRules, newRule) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -376,7 +384,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.DNSConfig.NameServerGroups[0].NameServers = make([]nbdns.NameServer, 0) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -388,7 +396,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.DNSConfig.NameServerGroups[0].NameServers[0].IP = netip.MustParseAddr("8.8.4.4") newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) @@ -400,7 +408,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.DNSConfig.CustomZones[0].Records[0].RData = "100.64.0.2" newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) assert.NoError(t, err) assert.True(t, message) }) From 0ed12d022a78018bb64badf9089e6a1672dff1da Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Wed, 30 Oct 2024 14:06:43 +0100 Subject: [PATCH 3/4] fix test --- management/server/updatechannel_test.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/management/server/updatechannel_test.go b/management/server/updatechannel_test.go index e525256337f..f10ffa7192b 100644 --- a/management/server/updatechannel_test.go +++ b/management/server/updatechannel_test.go @@ -178,8 +178,12 @@ func TestHandlePeerMessageUpdate(t *testing.T) { } for _, tt := range tests { + metrics, err := telemetry.NewDefaultAppMetrics(context.Background()) + if err != nil { + t.Fatal(err) + } t.Run(tt.name, func(t *testing.T) { - p := NewPeersUpdateManager(nil) + p := NewPeersUpdateManager(metrics) ctx := context.Background() if tt.existingUpdate != nil { From aab6b655b2a37806909144652168eb53c6aa1e1f Mon Sep 17 00:00:00 2001 From: Pascal Fischer Date: Wed, 30 Oct 2024 14:26:11 +0100 Subject: [PATCH 4/4] null check for metrics for tests --- management/server/updatechannel.go | 8 ++++-- management/server/updatechannel_test.go | 38 +++++++++++-------------- 2 files changed, 21 insertions(+), 25 deletions(-) diff --git a/management/server/updatechannel.go b/management/server/updatechannel.go index 851236035ff..7c73002223b 100644 --- a/management/server/updatechannel.go +++ b/management/server/updatechannel.go @@ -208,7 +208,7 @@ func (p *PeersUpdateManager) handlePeerMessageUpdate(ctx context.Context, peerID p.channelsMux.RUnlock() if lastSentUpdate != nil { - updated, err := isNewPeerUpdateMessage(ctx, lastSentUpdate, update, p.metrics.UpdateChannelMetrics()) + updated, err := isNewPeerUpdateMessage(ctx, lastSentUpdate, update, p.metrics) if err != nil { log.WithContext(ctx).Errorf("error checking for SyncResponse updates: %v", err) return true @@ -223,7 +223,7 @@ func (p *PeersUpdateManager) handlePeerMessageUpdate(ctx context.Context, peerID } // isNewPeerUpdateMessage checks if the given current update message is a new update that should be sent. -func isNewPeerUpdateMessage(ctx context.Context, lastSentUpdate, currUpdateToSend *UpdateMessage, metric *telemetry.UpdateChannelMetrics) (isNew bool, err error) { +func isNewPeerUpdateMessage(ctx context.Context, lastSentUpdate, currUpdateToSend *UpdateMessage, metric telemetry.AppMetrics) (isNew bool, err error) { startTime := time.Now() defer func() { @@ -261,7 +261,9 @@ func isNewPeerUpdateMessage(ctx context.Context, lastSentUpdate, currUpdateToSen return false, fmt.Errorf("failed to diff network map: %v", err) } - metric.CountNetworkMapDiffDurationMicro(time.Since(startTime)) + if metric != nil { + metric.UpdateChannelMetrics().CountNetworkMapDiffDurationMicro(time.Since(startTime)) + } return len(changelog) > 0, nil } diff --git a/management/server/updatechannel_test.go b/management/server/updatechannel_test.go index f10ffa7192b..b8a0ce45f73 100644 --- a/management/server/updatechannel_test.go +++ b/management/server/updatechannel_test.go @@ -8,7 +8,6 @@ import ( "time" "github.com/stretchr/testify/assert" - "go.opentelemetry.io/otel/metric/noop" nbdns "github.com/netbirdio/netbird/dns" "github.com/netbirdio/netbird/management/domain" @@ -197,16 +196,11 @@ func TestHandlePeerMessageUpdate(t *testing.T) { } func TestIsNewPeerUpdateMessage(t *testing.T) { - metric, err := telemetry.NewUpdateChannelMetrics(context.Background(), noop.NewMeterProvider().Meter("test")) - if err != nil { - t.Fatal(err) - } - t.Run("Unchanged value", func(t *testing.T) { newUpdateMessage1 := createMockUpdateMessage(t) newUpdateMessage2 := createMockUpdateMessage(t) - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.False(t, message) }) @@ -217,7 +211,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.False(t, message) }) @@ -229,7 +223,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Routes[0].Network = netip.MustParsePrefix("1.1.1.1/32") newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) @@ -242,7 +236,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Routes[0].Groups = []string{"randomGroup1"} newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -261,7 +255,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Peers = append(newUpdateMessage2.NetworkMap.Peers, newPeer) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -271,14 +265,14 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2 := createMockUpdateMessage(t) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.False(t, message) newUpdateMessage3 := createMockUpdateMessage(t) newUpdateMessage3.Update.Checks = []*proto.Checks{} newUpdateMessage3.Update.NetworkMap.Serial++ - message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage3, metric) + message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage3, nil) assert.NoError(t, err) assert.True(t, message) @@ -297,7 +291,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { } newUpdateMessage4.Update.Checks = []*proto.Checks{toProtocolCheck(check)} newUpdateMessage4.Update.NetworkMap.Serial++ - message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage4, metric) + message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage4, nil) assert.NoError(t, err) assert.True(t, message) @@ -317,7 +311,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { } newUpdateMessage5.Update.Checks = []*proto.Checks{toProtocolCheck(check)} newUpdateMessage5.Update.NetworkMap.Serial++ - message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage5, metric) + message, err = isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage5, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -333,7 +327,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { ) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -345,7 +339,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.Peers[0].IP = net.ParseIP("192.168.1.10") newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -357,7 +351,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.FirewallRules[0].Port = "443" newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -376,7 +370,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.FirewallRules = append(newUpdateMessage2.NetworkMap.FirewallRules, newRule) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -388,7 +382,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.DNSConfig.NameServerGroups[0].NameServers = make([]nbdns.NameServer, 0) newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -400,7 +394,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.DNSConfig.NameServerGroups[0].NameServers[0].IP = netip.MustParseAddr("8.8.4.4") newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) }) @@ -412,7 +406,7 @@ func TestIsNewPeerUpdateMessage(t *testing.T) { newUpdateMessage2.NetworkMap.DNSConfig.CustomZones[0].Records[0].RData = "100.64.0.2" newUpdateMessage2.Update.NetworkMap.Serial++ - message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, metric) + message, err := isNewPeerUpdateMessage(context.Background(), newUpdateMessage1, newUpdateMessage2, nil) assert.NoError(t, err) assert.True(t, message) })