Add polling-batch-size config option

Samples collected can be batched together,
consequently increasing or reducing the
amount of API calls and body data
sent to the configured publisher.

This config is available since Rocky,
adding the config option to allow its
tuning.

Change-Id: I0e3f756aa0305d3a96e21c7498d6a56208c51007
Closes-bug: #1885190
This commit is contained in:
Rodrigo Barbieri 2020-06-26 12:05:19 -03:00 committed by Rodrigo Barbieri
parent 7c0ecdbd1a
commit 740cac6571
4 changed files with 90 additions and 0 deletions

View File

@ -278,3 +278,10 @@ options:
From Pike onwards, the default ceilometer pollster collection runs a
limited set of pollsters. Enable this to run all the available pollsters.
This setting only takes effect from Queens onwards.
polling-batch-size:
type: int
default: 50
description: |
The number of measures from same pollster to batch together for sending
to the notification agent and then to the publisher. Set to 0 to disable.
This config is only effective for OpenStack release Rocky or newer.

View File

@ -112,6 +112,7 @@ class CeilometerContext(OSContextGenerator):
'event_time_to_live': int(config('event-time-to-live')),
'polling_interval': int(config('polling-interval')),
'enable_all_pollsters': config('enable-all-pollsters'),
'polling_batch_size': config('polling-batch-size'),
}
return ctxt

View File

@ -0,0 +1,78 @@
# rocky
###############################################################################
# [ WARNING ]
# ceilometer configuration file maintained by Juju
# local changes may be overwritten.
###############################################################################
[DEFAULT]
debug = {{ debug }}
verbose = {{ verbose }}
use_syslog = {{ use_syslog }}
event_pipeline_cfg_file = /etc/ceilometer/event_pipeline.yaml
{% if gnocchi_url -%}
meter_dispatchers = gnocchi
event_dispatchers = gnocchi
{% elif db_host or db_mongo_servers -%}
meter_dispatchers = database
{%- endif %}
{% if transport_url -%}
transport_url = {{ transport_url }}
{%- endif %}
[notification]
workers = {{ workers }}
{% if messaging_urls -%}
{% for item in messaging_urls -%}
messaging_urls = {{ item }}
{% endfor %}
{% endif %}
[polling]
batch_size = {{ polling_batch_size }}
{% if service_host -%}
[service_credentials]
auth_url = {{ service_protocol }}://{{ service_host }}:{{ service_port }}
project_name = {{ admin_tenant_name }}
username = {{ admin_user }}
password = {{ admin_password }}
{% if api_version == "3" -%}
project_domain_name = {{ admin_domain_name }}
user_domain_name = {{ admin_domain_name }}
{% else -%}
project_domain_name = default
user_domain_name = default
{% endif -%}
auth_type = password
{% if use_internal_endpoints -%}
interface = internalURL
{%- endif %}
{% endif -%}
{% if db_host or db_mongo_servers -%}
[database]
{% if db_replset: -%}
connection = mongodb://{{ db_mongo_servers }}/{{ db_name }}?readPreference=primaryPreferred&replicaSet={{ db_replset }}
mongodb_replica_set = {{ db_replset }}
{% else -%}
connection = mongodb://{{ db_host }}:{{ db_port }}/{{ db_name }}
{% endif %}
metering_time_to_live = {{ metering_time_to_live }}
event_time_to_live = {{ event_time_to_live }}
{%- endif %}
[publisher]
telemetry_secret = {{ metering_secret }}
{% if gnocchi_url -%}
[dispatcher_gnocchi]
filter_service_activity = False
archive_policy = {{ archive_policy }}
url = {{ gnocchi_url }}
{%- endif %}
{% include "section-keystone-authtoken-mitaka" %}
{% include "section-oslo-messaging-rabbit-ocata" %}

View File

@ -133,6 +133,7 @@ class CeilometerContextsTest(CharmTestCase):
'event_time_to_live': -1,
'polling_interval': 300,
'enable_all_pollsters': False,
'polling_batch_size': 50,
})
@patch.object(utils, 'get_shared_secret')
@ -148,6 +149,7 @@ class CeilometerContextsTest(CharmTestCase):
'event_time_to_live': 7776000,
'polling_interval': 300,
'enable_all_pollsters': False,
'polling_batch_size': 50,
})
self.assertTrue(type(context['metering_time_to_live']) is int)
self.assertTrue(type(context['event_time_to_live']) is int)
@ -164,6 +166,7 @@ class CeilometerContextsTest(CharmTestCase):
'event_time_to_live': -1,
'polling_interval': 300,
'enable_all_pollsters': True,
'polling_batch_size': 50,
})
@patch.object(utils, 'get_shared_secret')
@ -178,6 +181,7 @@ class CeilometerContextsTest(CharmTestCase):
'event_time_to_live': -1,
'polling_interval': 900,
'enable_all_pollsters': False,
'polling_batch_size': 50,
})
def test_ceilometer_service_context(self):