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

Deprecate monitor.sh #53

Merged
merged 4 commits into from
Jan 5, 2020
Merged

Conversation

haydenhw
Copy link
Collaborator

@haydenhw haydenhw commented Dec 8, 2019

For #42

  • refactor getMonitorUpdates() to calculate updates from mongo logs
  • delete monitor.sh
  • remove '/api/v0/monitor' POST endpoint
  • remove tests for '/api/v0/monitor' POST endpoint
  • remove simulateMonitorRequest from tools/simulate-activity
  • remove mention of monitor.sh from README

@bennlich
Copy link
Collaborator

Wow! I am extremely excited to look at this. Thanks @haydenhw !

src/app.js Outdated
// If an exitnode has not checked in in the last two minutes, report an error message
const getExitnodeStats = function (exitnodeIP) {
return db.collection('routeLog')
.aggregate([
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is an aggregation necessary here? I'm wondering if it would be simpler to fetch the most recent entry in the log for an exitnodeIP, and then count the number of nodes/gateways outside of mongo-land.

src/app.js Outdated
@@ -56,11 +56,44 @@ function MonitorApp ({
}

async function getMonitorUpdates() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Might as well make this function name more specific while we're here. Could be something like your inner helper function -- latestExitnodeStats(). Or numNodesLastSeenAtExitnodes().

Copy link
Collaborator Author

@haydenhw haydenhw Jan 1, 2020

Choose a reason for hiding this comment

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

I ended up renaming this to countActiveRoutesByExitnode(). Let me know if you like one of these other names better. Happy to change it to whatever

mjs.set(key, JSON.stringify(processed), {expires: 120}, handleErr);
}
});

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yessssssssssss :-)

})
})
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yessssssssssss.

});
});

});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Yesssssssssssss

…name getMonitorUpdates -> countActiveRoutesByExitnodes

refactor getMonitorUpdates; rename to countActiveRoutesByExitnodes
@bennlich bennlich merged commit 92ac6b3 into sudomesh:master Jan 5, 2020
@bennlich
Copy link
Collaborator

bennlich commented Jan 5, 2020

Rad!

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.

2 participants