Skip to content
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

fix internet connection counts #1843

Merged
merged 2 commits into from
Sep 2, 2016
Merged

fix internet connection counts #1843

merged 2 commits into from
Sep 2, 2016

Conversation

rade
Copy link
Member

@rade rade commented Sep 1, 2016

Fixes #1495.

For counting we were using a table keyed on a struct containing Node
pointers. For connections between ordinary nodes this works just
fine. But for connections to/from the Internet node we want to track
individual address/port combinations, which involves an extra
lookup. Since our data structures generally contain values, not
pointers, this produces aliases. As a result n connections from/to a
node to/from a specific Internet IP+port would result in n rows in the
count table, each with a count of 1, instead of one row with a count of
n.

Things wouldn't be so bad if it was actually rendered like that -
annoying, but at least accurate - but...

Each row has an ID which is computed from the node IDs and ports. Not
Node references. The ID must be unique - the frontend will only
render *one* thing per ID. Since the row IDs of our n rows are all the
same, we see one row with a count of 1 instead of n rows with a count of
1.

Furthermore, since the frontend's table row limiting is counting rows,
not unique row IDs, a) fewer rows would be rendered than expected, and
b) the displayed count of the number of extra rows would be too high.

The fix is to replace the Node pointers in the key with Node IDs. This
does require an extra table lookup when we come to produce the rows, but
that is just a fairly cheap map lookup.

Fixes #1495.
@rade
Copy link
Member Author

rade commented Sep 1, 2016

@paulbellamy this does perhaps deserve a unit test, but I am not familiar with all the data structures involved, so this is a bit daunting. If you do think this should have a test, would you mind helping me write one?

@@ -115,7 +110,7 @@ func incomingConnectionsSummary(topologyID string, r report.Report, n report.Nod
TopologyID: topologyID,
Label: "Inbound",
Columns: columnHeaders,
Connections: connectionRows(r, counts, isInternetNode(n)),
Connections: connectionRows(r, ns, counts, isInternetNode(n)),

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

This comment was marked as abuse.

@paulbellamy
Copy link
Contributor

paulbellamy commented Sep 2, 2016

this does perhaps deserve a unit test

yes, please!

Edit: There is an example of a "unit test" for the detailed node rendering in: TestMakeDetailedContainerNode. Unfortunately, it still relies on our fixture.Report, which we'd like to move away from eventually, and generate random data for these types of tests.

and refactor the connection{} construction so we can add some
explanation of what is going on here.
@davkal
Copy link
Contributor

davkal commented Sep 2, 2016

I'm now getting the following in the details panel for the Internet:

Inbound Remote Port Count
X    IP1       PortA    2
Y    IP2       PortB   2
Y    IP2       PortB   2
Y    IP2       PortB   2
X    IP3       PortA    2

and with +51 (which works as expected).

Having multiple rows with all values identical looks confusing. I'm guessing those 3 Y rows, are 3 different containers with the same name.

UX remedies:

  • aggregate counts to one row if all other fields are the same
  • add a column for a field that varies across the rows
  • add a hover over the name

@rade
Copy link
Member Author

rade commented Sep 2, 2016

UX remedies:

aggregate counts to one row if all other fields are the same

That would break the navigation, i.e. I need to be able to navigate to the 3 individual containers, so need 3 click-able things.

add a column for a field that varies across the rows

That would be best, but we are really short on horizontal space here.

add a hover over the name

That might be the only choice left :(

Please file an issue.

@davkal
Copy link
Contributor

davkal commented Sep 2, 2016

Filed #1844 for UI issues.

@paulbellamy
Copy link
Contributor

LGTM

@rade
Copy link
Member Author

rade commented Sep 2, 2016

I've given up on constructing a test for this. It's just too hard, for me at least, not being familiar with the entire report data structure, and the intricacies of fixture.Report. I have filed #1845.

@rade rade merged commit 813ea78 into master Sep 2, 2016
@paulbellamy paulbellamy deleted the 1495-internet-connection-count branch September 2, 2016 15:30
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