support gnocchi timeout
set gnocchi timeout to 6.05 because requests recommends multiple of 3[1]. also, it seems safe to assume gnocchi is not functioning well and will not scale if we can't post in 6s. in my benchmark, it took under 0.25s to post 5000 points. the only thing that took >3s was getting >80K datapoints and this workflow is only pushing, and only getting small chunks occasionally. making it 6s because it seems keystone adds decent overhead. do not set timeout for upgrade because it might take longer than normal workflow [1] http://docs.python-requests.org/en/master/user/advanced/#timeouts Change-Id: I41b5e4f0c0f54b7f4b627d9116e63096ca2decf9 Closes-Bug: #1666072
This commit is contained in:
parent
6d6b577bb4
commit
7c6160e3a1
|
@ -29,4 +29,6 @@ dispatcher_opts = [
|
|||
default='gnocchi_resources.yaml',
|
||||
help=('The Yaml file that defines mapping between samples '
|
||||
'and gnocchi resources/metrics')),
|
||||
cfg.FloatOpt('request_timeout', default=6.05, min=0.0,
|
||||
help='Number of seconds before request to gnocchi times out'),
|
||||
]
|
||||
|
|
|
@ -20,9 +20,12 @@ from ceilometer import keystone_client
|
|||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
def get_gnocchiclient(conf):
|
||||
def get_gnocchiclient(conf, timeout_override=False):
|
||||
group = conf.dispatcher_gnocchi.auth_section
|
||||
session = keystone_client.get_session(conf, group=group)
|
||||
timeout = (None if (not conf.dispatcher_gnocchi.request_timeout or
|
||||
timeout_override)
|
||||
else conf.dispatcher_gnocchi.request_timeout)
|
||||
session = keystone_client.get_session(conf, group=group, timeout=timeout)
|
||||
return client.Client('1', session,
|
||||
interface=conf[group].interface,
|
||||
region_name=conf[group].region_name)
|
||||
|
@ -115,7 +118,7 @@ resources_update_operations = [
|
|||
|
||||
|
||||
def upgrade_resource_types(conf):
|
||||
gnocchi = get_gnocchiclient(conf)
|
||||
gnocchi = get_gnocchiclient(conf, True)
|
||||
for name, attributes in resources_initial.items():
|
||||
try:
|
||||
gnocchi.resource_type.get(name=name)
|
||||
|
|
|
@ -26,14 +26,15 @@ DEFAULT_GROUP = "service_credentials"
|
|||
OVERRIDABLE_GROUPS = ['dispatcher_gnocchi']
|
||||
|
||||
|
||||
def get_session(conf, requests_session=None, group=None):
|
||||
def get_session(conf, requests_session=None, group=None, timeout=None):
|
||||
|
||||
"""Get a ceilometer service credentials auth session."""
|
||||
group = group or DEFAULT_GROUP
|
||||
auth_plugin = ka_loading.load_auth_from_conf_options(conf, group)
|
||||
session = ka_loading.load_session_from_conf_options(
|
||||
conf, group, auth=auth_plugin, session=requests_session
|
||||
)
|
||||
kwargs = {'auth': auth_plugin, 'session': requests_session}
|
||||
if timeout is not None:
|
||||
kwargs['timeout'] = timeout
|
||||
session = ka_loading.load_session_from_conf_options(conf, group, **kwargs)
|
||||
return session
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue