# HG changeset patch # User Drew Perttula # Date 1559204158 0 # Node ID a47c135b58b8435de9a23a024876f842d89a8b1b # Parent a21b8714075881a4f0faebaa7e1e07c65591c161 more stats reporting Ignore-this: bd7c14b4456f8a0a2591e3cf7c555ab6 diff -r a21b87140758 -r a47c135b58b8 rdfdb/service.py --- a/rdfdb/service.py Thu May 30 08:15:10 2019 +0000 +++ b/rdfdb/service.py Thu May 30 08:15:58 2019 +0000 @@ -27,8 +27,8 @@ task.LoopingCall(updateTimeStat).start(.2) stats = scales.collection('/webServer', - scales.IntStat('plainClients'), - scales.IntStat('websocketClients'), + scales.IntStat('clients'), + scales.IntStat('liveClients'), scales.PmfStat('setAttr'), ) graphStats = scales.collection('/graph', @@ -36,6 +36,7 @@ scales.RecentFpsStat('patchFps'), ) fileStats = scales.collection('/file', + scales.IntStat('mappedGraphFiles'), ) log = logging.getLogger('rdfdb') @@ -201,6 +202,7 @@ globalPrefixes=self.addlPrefixes[None], ctxPrefixes=self.addlPrefixes[ctx]) self.graphFiles[ctx] = gf + fileStats.mappedGraphFiles = len(self.graphFiles) return gf def dirtyFiles(self, ctxs): @@ -226,7 +228,7 @@ self.clients: List[Union[Client, WsClient]] = [] self.graph = ConjunctiveGraph() stats.graphLen = len(self.graph) - stats.plainClients = len(self.clients) + stats.clients = len(self.clients) self.watchedFiles = WatchedFiles(dirUriMap, self.patch, self.getSubgraph, addlPrefixes) @@ -276,7 +278,7 @@ log.info("%r %r - dropping client", c, err.getErrorMessage()) if c in self.clients: self.clients.remove(c) - stats.plainClients = len(self.clients) + stats.clients = len(self.clients) self.sendClientsToAllLivePages() def summarizeToLog(self): @@ -310,7 +312,7 @@ sendGraphToClient(self.graph, newClient) self.clients.append(newClient) self.sendClientsToAllLivePages() - stats.plainClients = len(self.clients) + stats.clients = len(self.clients) def sendClientsToAllLivePages(self) -> None: sendToLiveClients({ @@ -413,15 +415,15 @@ def connectionMade(self, *args, **kwargs): log.info("websocket opened") liveClients.add(self) - stats.websocketClients = len(liveClients) + stats.liveClients = len(liveClients) self.settings.db.sendClientsToAllLivePages() def connectionLost(self, reason): log.info("websocket closed") liveClients.remove(self) - stats.websocketClients = len(liveClients) + stats.liveClients = len(liveClients) - def messageReceived(self, message): + def messageReceived(self, message: bytes): log.info("got message %s" % message) self.sendMessage(message)