Adds django cache as monitor cache

Not the best solution yet, but it solves monitoring problems with brokers that don't have a pattern getter for cluster stats.
This commit is contained in:
Ilan Steemers
2015-08-30 18:28:26 +02:00
parent d3283571a6
commit 4f39062785
4 changed files with 39 additions and 12 deletions
+3 -3
View File
@@ -64,7 +64,7 @@ class Stat(Status):
def save(self):
try:
self.broker.set(self.key, signing.SignedPackage.dumps(self, True), 3)
self.broker.set_stat(self.key, signing.SignedPackage.dumps(self, True), 3)
except Exception as e:
logger.error(e)
@@ -78,7 +78,7 @@ class Stat(Status):
:param cluster_id: id of the cluster
:return: Stat or Status
"""
pack = broker.get(Stat.get_key(cluster_id))
pack = broker.get_stat(Stat.get_key(cluster_id))
if pack:
try:
return signing.SignedPackage.loads(pack)
@@ -94,7 +94,7 @@ class Stat(Status):
:return: list of type Stat
"""
stats = []
packs = broker.get_pattern('{}:*'.format(Conf.Q_STAT)) or []
packs = broker.get_stats('{}:*'.format(Conf.Q_STAT)) or []
for pack in packs:
try:
stats.append(signing.SignedPackage.loads(pack))