Support cassandra connection timeout option

Creating a cassandra connection can be limited by connection_timeout option.

Story: 2005450
Task: 30502

Change-Id: I8803e28fe8c2c11e819be44db4ef93cb19b47a1d
This commit is contained in:
zhangjianweibj 2019-04-12 15:32:26 +08:00 committed by Dobroslaw Zybort
parent 936c50861e
commit dbe1ea8b50
3 changed files with 9 additions and 0 deletions

View File

@ -124,6 +124,7 @@ class MetricsRepository(metrics_repository.AbstractMetricsRepository):
self.cluster = Cluster(self.conf.cassandra.contact_points,
port=self.conf.cassandra.port,
auth_provider=auth_provider,
connect_timeout=self.conf.cassandra.connection_timeout,
load_balancing_policy=TokenAwarePolicy(
DCAwareRoundRobinPolicy(
local_dc=self.conf.cassandra.local_data_center))

View File

@ -40,6 +40,10 @@ Cassandra user for monasca-api service
cfg.StrOpt('password', default='', secret=True,
help='''
Cassandra user password for monasca-api service
'''),
cfg.IntOpt('connection_timeout', default=5,
help='''
Cassandra timeout in seconds when creating a new connection
'''),
cfg.StrOpt('local_data_center', default='',
help='''

View File

@ -0,0 +1,4 @@
---
features:
- |
Support cassandra connection timeout option which set timeout when creating a new connection.