Switch stats client import to use oslo_utils

Instead of handling the try/except case ourselves in the metrics class,
we should use oslo_utils.importutils to handle the import of one of the
available stats client classes.

Change-Id: I782cfa0f973d6f0f42690c1bc04ec709968cf43c
This commit is contained in:
Alex Schultz 2016-11-03 13:15:47 -06:00
parent 8b14ba68c6
commit d999c21bfe
1 changed files with 4 additions and 5 deletions

View File

@ -37,16 +37,15 @@ Usage examples:
"""
try:
import monascastatsd as stats_client
except Exception:
import designate.metrics_client.noop as stats_client
from oslo_config import cfg
from oslo_log import log as logging
from oslo_utils import importutils
from designate.i18n import _LI
stats_client = importutils.import_any('monascastatsd',
'designate.metrics_client.noop')
LOG = logging.getLogger(__name__)
CFG_GROUP = 'monasca:statsd'