move metrics initialization to have initial metrics

This commit is contained in:
Jakob Ketterl 2020-06-23 00:08:59 +02:00
parent 9e323a08ff
commit 480b728c06
2 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,4 @@
from owrx.config import Config
from owrx.metrics import Metrics, DirectMetric
import threading
import logging
@ -24,7 +23,6 @@ class ClientRegistry(object):
def __init__(self):
self.clients = []
Metrics.getSharedInstance().addMetric("openwebrx.users", DirectMetric(self.clientCount))
super().__init__()
def broadcast(self):

View File

@ -1,4 +1,5 @@
import threading
from owrx.client import ClientRegistry
class Metric(object):
@ -38,6 +39,7 @@ class Metrics(object):
def __init__(self):
self.metrics = {}
self.addMetric("openwebrx.users", DirectMetric(ClientRegistry.getSharedInstance().clientCount))
def addMetric(self, name, metric):
self.metrics[name] = metric