Skip to content

Conversation

@erikrozendaal
Copy link
Contributor

Track visibility of VRPs on both sides and only consider them different when the visibility does not match based on the visibility thresholds.

Also update the results even when the sources have not been modified, since the thresholds may have changed in the meantime as time passes.

Time still passes so VRPs may be dropped due to the expiration of the
grace period.
firstSeen := tCurrentUpdate
currentEntry, ok := currentVrps[key]
if ok {
if ok && currentEntry.Visible {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment? I think this updates lastSeen to the current time, when an item was in grace period, but is seen in the real source again?

continue
}

updated := *vrp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is updated identical to VRP or not? Does it get copied onto the heap here?
(I think it is fine to mutate these objects as long as we have the lock, but do also see why you may not want this)

} else if isDefinitelyNotVisisble(vrp, thresholdTimestamp) {
// VRP is definitely not visible, count if other side is definitely visible
if isDefinitelyVisible(other, thresholdTimestamp) {
count++
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed we we not counting the symmetric difference, but the one-directional difference.

You can get the symmetric difference by summing over lhs/rhs?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are counting the one-directional difference, since the input to this function is from a one-directional difference operation. The other side is only used to check for the current visibility based on the VRPs timeline and the threshold.

onlyInA := make(VRPMap)
for key, vrpA := range a {
if vrpA.Visible {
if vrpB, ok := b[key]; !ok || !vrpB.Visible {
Copy link
Collaborator

@ties ties Oct 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We now account for visibility here, think that is the important change of this PR. Things that were no longer visible still popped up in the difference.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the maps contain VRPs that are no longer visible and we need to ignore these when calculating the current difference.

@ties
Copy link
Collaborator

ties commented Oct 18, 2022

It feels like we already capture Visible with FirstSeen and LastSeen and that Visible is implicit, but my initial implementation definitely did not do this correctly - which caused alerts for us, sometimes.

@job job merged commit ad3ed83 into bgp:master Oct 18, 2022
@job
Copy link
Member

job commented Oct 18, 2022

Thank you for your time and contributions @erikrozendaal and @ties

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants