diff options
author | Ilya Shakhat <shakhat@gmail.com> | 2019-04-08 16:43:45 +0200 |
---|---|---|
committer | Ilya Shakhat <shakhat@gmail.com> | 2019-07-24 17:02:28 +0200 |
commit | 34ca7ab4b5f5c04986bc97e13cf411a1e8d7334e (patch) | |
tree | b4d9fc5c46cb179f825d4cafcf96db0cbef3f1e3 /osprofiler/drivers | |
parent | dcc4f472df59aa62f1cd6a0442b8e5507b294bf1 (diff) | |
download | osprofiler-34ca7ab4b5f5c04986bc97e13cf411a1e8d7334e.tar.gz |
Handle driver initialization errors to avoid service crash
This patch fixes the issue when failed osprofiler driver brings
the whole service down. With this patch the default no-op behaviour
is used in case of initialization failure.
Change-Id: I6ebc393576f4fc3f8b4134164bafc2e09f102ebd
Diffstat (limited to 'osprofiler/drivers')
-rw-r--r-- | osprofiler/drivers/elasticsearch_driver.py | 6 | ||||
-rw-r--r-- | osprofiler/drivers/jaeger.py | 4 | ||||
-rw-r--r-- | osprofiler/drivers/mongodb.py | 6 | ||||
-rw-r--r-- | osprofiler/drivers/redis_driver.py | 6 |
4 files changed, 11 insertions, 11 deletions
diff --git a/osprofiler/drivers/elasticsearch_driver.py b/osprofiler/drivers/elasticsearch_driver.py index 85bab74..c24eb60 100644 --- a/osprofiler/drivers/elasticsearch_driver.py +++ b/osprofiler/drivers/elasticsearch_driver.py @@ -36,9 +36,9 @@ class ElasticsearchDriver(base.Driver): from elasticsearch import Elasticsearch except ImportError: raise exc.CommandError( - "To use this command, you should install " - "'elasticsearch' manually. Use command:\n " - "'pip install elasticsearch'.") + "To use OSProfiler with ElasticSearch driver, " + "please install `elasticsearch` library. " + "To install with pip:\n `pip install elasticsearch`.") client_url = parser.urlunparse(parser.urlparse(self.connection_str) ._replace(scheme="http")) diff --git a/osprofiler/drivers/jaeger.py b/osprofiler/drivers/jaeger.py index 669aa13..82b7a23 100644 --- a/osprofiler/drivers/jaeger.py +++ b/osprofiler/drivers/jaeger.py @@ -40,8 +40,8 @@ class Jaeger(base.Driver): except ImportError: raise exc.CommandError( "To use OSProfiler with Uber Jaeger tracer, " - "you have to install `jaeger-client` manually. " - "Install with pip:\n `pip install jaeger-client`." + "please install `jaeger-client` library. " + "To install with pip:\n `pip install jaeger-client`." ) parsed_url = parser.urlparse(connection_str) diff --git a/osprofiler/drivers/mongodb.py b/osprofiler/drivers/mongodb.py index 0ca1928..a0372f6 100644 --- a/osprofiler/drivers/mongodb.py +++ b/osprofiler/drivers/mongodb.py @@ -28,9 +28,9 @@ class MongoDB(base.Driver): from pymongo import MongoClient except ImportError: raise exc.CommandError( - "To use this command, you should install " - "'pymongo' manually. Use command:\n " - "'pip install pymongo'.") + "To use OSProfiler with MongoDB driver, " + "please install `pymongo` library. " + "To install with pip:\n `pip install pymongo`.") client = MongoClient(self.connection_str, connect=False) self.db = client[db_name] diff --git a/osprofiler/drivers/redis_driver.py b/osprofiler/drivers/redis_driver.py index 250a81c..0952702 100644 --- a/osprofiler/drivers/redis_driver.py +++ b/osprofiler/drivers/redis_driver.py @@ -40,9 +40,9 @@ class Redis(base.Driver): from redis import StrictRedis except ImportError: raise exc.CommandError( - "To use this command, you should install " - "'redis' manually. Use command:\n " - "'pip install redis'.") + "To use OSProfiler with Redis driver, " + "please install `redis` library. " + "To install with pip:\n `pip install redis`.") # only connection over network is supported with schema # redis://[:password]@host[:port][/db] |