atlas redis plugin typo cleanup and better exception handling

This commit is contained in:
Jay Zarfoss 2019-11-06 10:42:59 -08:00
parent f803fab413
commit 113c9dd657
2 changed files with 6 additions and 6 deletions

View File

@ -6,7 +6,7 @@
.. moduleauthor:: Jay Zarfoss
"""
from time import time
from redis import Redis
import json
from datetime import datetime
@ -27,7 +27,7 @@ def millis_since_epoch():
class AtlasMetricRedisPlugin(MetricPlugin):
title = "AtlasRedis"
slug = "atlas-metric-Redius"
slug = "atlas-metric-redis"
description = "Adds support for sending key metrics to Atlas via local Redis"
version = atlas.VERSION
@ -89,9 +89,9 @@ class AtlasMetricRedisPlugin(MetricPlugin):
try:
r = Redis(host=self.redis_host, port=self.redis_port, socket_timeout=0.1)
r.rpush('atlas-agent', json.dumps(self.metric_data))
except Exception:
except Exception as e:
current_app.logger.warning(
"AtlasMetricsRedis: could not post atlas metrics to AtlasRedis {host}:{port}".format(
host=self.redis_host, port=self.redis_port
"AtlasMetricsRedis: exception [{exception}] could not post atlas metrics to AtlasRedis [{host}:{port}], metric [{metricdata}]".format(
exception=e, host=self.redis_host, port=self.redis_port, metricdata=json.dumps(self.metric_data)
)
)

View File

@ -147,7 +147,7 @@ setup(
'java_keystore_export = lemur.plugins.lemur_jks.plugin:JavaKeystoreExportPlugin',
'openssl_export = lemur.plugins.lemur_openssl.plugin:OpenSSLExportPlugin',
'atlas_metric = lemur.plugins.lemur_atlas.plugin:AtlasMetricPlugin',
'atlas_metric_redis = lemur.plugins.lemur_atlas.plugin:AtlasMetricRedisPlugin',
'atlas_metric_redis = lemur.plugins.lemur_atlas_redis.plugin:AtlasMetricRedisPlugin',
'kubernetes_destination = lemur.plugins.lemur_kubernetes.plugin:KubernetesDestinationPlugin',
'cryptography_issuer = lemur.plugins.lemur_cryptography.plugin:CryptographyIssuerPlugin',
'cfssl_issuer = lemur.plugins.lemur_cfssl.plugin:CfsslIssuerPlugin',