move metrics initialization to have initial metrics
This commit is contained in:
parent
9e323a08ff
commit
480b728c06
@ -1,5 +1,4 @@
|
|||||||
from owrx.config import Config
|
from owrx.config import Config
|
||||||
from owrx.metrics import Metrics, DirectMetric
|
|
||||||
import threading
|
import threading
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
@ -24,7 +23,6 @@ class ClientRegistry(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.clients = []
|
self.clients = []
|
||||||
Metrics.getSharedInstance().addMetric("openwebrx.users", DirectMetric(self.clientCount))
|
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
def broadcast(self):
|
def broadcast(self):
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import threading
|
import threading
|
||||||
|
from owrx.client import ClientRegistry
|
||||||
|
|
||||||
|
|
||||||
class Metric(object):
|
class Metric(object):
|
||||||
@ -38,6 +39,7 @@ class Metrics(object):
|
|||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.metrics = {}
|
self.metrics = {}
|
||||||
|
self.addMetric("openwebrx.users", DirectMetric(ClientRegistry.getSharedInstance().clientCount))
|
||||||
|
|
||||||
def addMetric(self, name, metric):
|
def addMetric(self, name, metric):
|
||||||
self.metrics[name] = metric
|
self.metrics[name] = metric
|
||||||
|
Loading…
Reference in New Issue
Block a user