changeset 54:a47c135b58b8

more stats reporting Ignore-this: bd7c14b4456f8a0a2591e3cf7c555ab6
author Drew Perttula <drewp@bigasterisk.com>
date Thu, 30 May 2019 08:15:58 +0000
parents a21b87140758
children 54664942cc61
files rdfdb/service.py
diffstat 1 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)