diff --git a/changelog b/changelog index ad14c66c..9a8fe207 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +Thu Sep 26 23:08 2013 CDT + * lib/acp.js, lib/api.js, lib/server.js, lib/stats.js, www/acp.html, + www/assets/js/acp.js: Remove the [realtime] 'connection stats' + tracking that was pretty worthless anyways. + Thu Sep 26 21:42 2013 CDT * www/assets/js/player.js: Keep track of the duration of the current video and use this information to prevent the player restarting when diff --git a/lib/acp.js b/lib/acp.js index b0cf59af..fe702ab2 100644 --- a/lib/acp.js +++ b/lib/acp.js @@ -174,18 +174,6 @@ module.exports = function (Server) { user.socket.emit("acp-view-stats", res); }); }); - - user.socket.on("acp-view-connstats", function () { - var http = Server.stats.readAverages("http"); - var sio = Server.stats.readAverages("socketio"); - var api = Server.stats.readAverages("api"); - - user.socket.emit("acp-view-connstats", { - http: http, - sio: sio, - api: api - }); - }); } } } diff --git a/lib/api.js b/lib/api.js index eed01604..13c4252a 100644 --- a/lib/api.js +++ b/lib/api.js @@ -56,7 +56,6 @@ module.exports = function (Server) { /* */ app.get("/api/coffee", function (req, res) { - Server.stats.record("api", "/api/coffee"); res.send(418); // 418 I'm a teapot }); @@ -64,7 +63,6 @@ module.exports = function (Server) { /* data about a specific channel */ app.get("/api/channels/:channel", function (req, res) { - Server.stats.record("api", "/api/channels/:channel"); var name = req.params.channel; if(!$util.isValidChannelName(name)) { res.send(404); @@ -85,7 +83,6 @@ module.exports = function (Server) { /* data about all channels (filter= public or all) */ app.get("/api/allchannels/:filter", function (req, res) { - Server.stats.record("api", "/api/allchannels/:filter"); var filter = req.params.filter; if(filter !== "public" && filter !== "all") { res.send(400); @@ -144,7 +141,6 @@ module.exports = function (Server) { /* login */ app.post("/api/login", function (req, res) { - Server.stats.record("api", "/api/login"); res.type("application/jsonp"); res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.body.name; @@ -186,7 +182,6 @@ module.exports = function (Server) { /* register an account */ app.post("/api/register", function (req, res) { - Server.stats.record("api", "/api/register"); res.type("application/jsonp"); res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.body.name; @@ -258,7 +253,6 @@ module.exports = function (Server) { /* password change */ app.post("/api/account/passwordchange", function (req, res) { - Server.stats.record("api", "/api/account/passwordchange"); res.type("application/jsonp"); res.setHeader("Access-Control-Allow-Origin", "*"); @@ -302,7 +296,6 @@ module.exports = function (Server) { /* password reset */ app.post("/api/account/passwordreset", function (req, res) { - Server.stats.record("api", "/api/account/passwordreset"); res.type("application/jsonp"); res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.body.name; @@ -372,7 +365,6 @@ module.exports = function (Server) { /* password recovery */ app.get("/api/account/passwordrecover", function (req, res) { - Server.stats.record("api", "/api/account/passwordrecover"); res.type("application/jsonp"); var hash = req.query.hash; var ip = getIP(req); @@ -397,7 +389,6 @@ module.exports = function (Server) { /* profile retrieval */ app.get("/api/users/:user/profile", function (req, res) { - Server.stats.record("api", "/api/users/:user/profile"); res.type("application/jsonp"); var name = req.params.user; @@ -420,7 +411,6 @@ module.exports = function (Server) { /* profile change */ app.post("/api/account/profile", function (req, res) { - Server.stats.record("api", "/api/account/profile"); res.type("application/jsonp"); res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.body.name; @@ -468,7 +458,6 @@ module.exports = function (Server) { /* set email */ app.post("/api/account/email", function (req, res) { - Server.stats.record("api", "/api/account/email"); res.type("application/jsonp"); res.setHeader("Access-Control-Allow-Origin", "*"); var name = req.body.name; @@ -519,7 +508,6 @@ module.exports = function (Server) { /* my channels */ app.get("/api/account/mychannels", function (req, res) { - Server.stats.record("/api/account/mychannels"); res.type("application/jsonp"); var name = req.query.name; var session = req.query.session; @@ -557,7 +545,6 @@ module.exports = function (Server) { /* action log */ app.get("/api/logging/actionlog", function (req, res) { - Server.stats.record("api", "/api/logging/actionlog"); res.type("application/jsonp"); var name = req.query.name; var session = req.query.session; @@ -608,7 +595,6 @@ module.exports = function (Server) { } app.get("/api/logging/syslog", function (req, res) { - Server.stats.record("api", "/api/logging/syslog"); res.type("text/plain"); res.setHeader("Access-Control-Allow-Origin", "*"); @@ -636,7 +622,6 @@ module.exports = function (Server) { }); app.get("/api/logging/errorlog", function (req, res) { - Server.stats.record("api", "/api/logging/errorlog"); res.type("text/plain"); res.setHeader("Access-Control-Allow-Origin", "*"); @@ -664,7 +649,6 @@ module.exports = function (Server) { }); app.get("/api/logging/channels/:channel", function (req, res) { - Server.stats.record("api", "/api/logging/channels/:channel"); res.type("text/plain"); res.setHeader("Access-Control-Allow-Origin", "*"); diff --git a/lib/server.js b/lib/server.js index f1680ee3..57bfd4d4 100644 --- a/lib/server.js +++ b/lib/server.js @@ -70,7 +70,6 @@ var Server = { } chan.dead = true; }, - stats: null, app: null, io: null, httpserv: null, @@ -98,7 +97,6 @@ var Server = { }, handleIOConnection: function (socket) { var self = this; - self.stats.record("socketio", "socket"); var ip = getSocketIP(socket); socket._ip = ip; self.db.isGlobalIPBanned(ip, function (err, bant) { @@ -149,7 +147,6 @@ var Server = { res.redirect("/" + c); } else { - self.stats.record("http", "/r/" + c); self.logHTTP(req); res.sendfile("channel.html", { root: path.join(__dirname, "../www") @@ -162,7 +159,6 @@ var Server = { self.app.get("/", function (req, res, next) { self.logHTTP(req); - self.stats.record("http", "/"); res.sendfile("index.html", { root: path.join(__dirname, "../www") }); @@ -193,7 +189,6 @@ var Server = { } } else { - self.stats.record("http", req.params.thing); self.logHTTP(req); } }); @@ -247,7 +242,7 @@ var Server = { self.acp = require("./acp")(self); // init stats - self.stats = require("./stats")(self); + require("./stats")(self); // init media retriever self.infogetter = require("./get-info")(self); diff --git a/lib/stats.js b/lib/stats.js index be2230f5..dc72fb89 100644 --- a/lib/stats.js +++ b/lib/stats.js @@ -30,40 +30,4 @@ module.exports = function (Server) { db.pruneStats(Date.now() - STAT_EXPIRE); }); }, STAT_INTERVAL); - - return { - stores: { - "http": {}, - "socketio": {}, - "api": {} - }, - record: function (type, key) { - var store; - if(!(type in this.stores)) - return; - - store = this.stores[type]; - - if(key in store) { - store[key].push(Date.now()); - if(store[key].length > 100) - store[key].shift(); - } else { - store[key] = [Date.now()]; - } - }, - readAverages: function (type) { - if(!(type in this.stores)) - return; - var avg = {}; - var store = this.stores[type]; - for(var k in store) { - var time = Date.now() - store[k][0]; - avg[k] = store[k].length / time; - avg[k] = parseInt(avg[k] * 1000); - } - return avg; - } - }; - } diff --git a/www/acp.html b/www/acp.html index 0b14aa51..c82dfd6b 100644 --- a/www/acp.html +++ b/www/acp.html @@ -46,7 +46,6 @@
  • Loaded Channels
  • Action Log
  • Server Stats
  • -
  • Connection Stats
  • @@ -250,21 +249,6 @@

    Memory Usage (MB)

    -
    -

    Connection Stats

    - Note: Data points for which the frequency average is 0 are not displayed. -
    - - - - - - - - - -
    TypeParamFrequency
    -
    diff --git a/www/assets/js/acp.js b/www/assets/js/acp.js index 3e4de8b4..11a0182b 100644 --- a/www/assets/js/acp.js +++ b/www/assets/js/acp.js @@ -147,13 +147,6 @@ menuHandler("#show_stats", "#stats"); $("#show_stats").click(function () { socket.emit("acp-view-stats"); }); -menuHandler("#show_connstats", "#connstats"); -$("#show_connstats").click(function () { - socket.emit("acp-view-connstats"); -}); -$("#connstats_refresh").click(function () { - socket.emit("acp-view-connstats"); -}); function reverseLog() { $("#log").text($("#log").text().split("\n").reverse().join("\n")); @@ -555,48 +548,4 @@ function setupCallbacks() { $("