Receive polling-batch-size config

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,
receiving the value from ceilometer-charm
to allow its tuning.

Change-Id: I986073fdacd750cf96d662abf1d58844479c25ba
Closes-bug: #1885190
This commit is contained in:
Rodrigo Barbieri 2020-06-26 12:08:52 -03:00
parent 27ad8cb103
commit 2aace2fb69
3 changed files with 52 additions and 1 deletions

View File

@ -49,6 +49,7 @@ class CeilometerServiceContext(OSContextGenerator):
'service_port',
'signing_dir',
'api_version',
'polling_batch_size',
]
optional_keys = [

View File

@ -0,0 +1,49 @@
# rocky
###############################################################################
# [ WARNING ]
# ceilometer configuration file maintained by Juju
# local changes may be overwritten.
###############################################################################
[DEFAULT]
debug = {{ debug }}
verbose = {{ verbose }}
logdir = /var/log/ceilometer
{% if transport_url -%}
transport_url = {{ transport_url }}
{%- endif %}
{% if service_host -%}
[service_credentials]
{% if use_internal_endpoints -%}
auth_url = {{ auth_protocol }}://{{ auth_host }}:{{ auth_port }}
interface = internalURL
{% else -%}
auth_url = {{ service_protocol }}://{{ service_host }}:{{ service_port }}
{% endif -%}
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
{% endif -%}
[polling]
{% if polling_batch_size -%}
batch_size = {{ polling_batch_size }}
{% endif -%}
{% if metering_secret -%}
[publisher]
telemetry_secret = {{ metering_secret }}
{% endif -%}
{% include "section-keystone-authtoken-mitaka" %}
{% include "section-oslo-messaging-rabbit-ocata" %}

View File

@ -56,7 +56,8 @@ class CeilometerContextsTest(CharmTestCase):
'admin_tenant_name': 'admin',
'admin_user': 'admin',
'admin_password': 'password',
'metering_secret': 'secret'
'metering_secret': 'secret',
'polling_batch_size': 50,
}
self.test_relation.set(data)
self.assertEqual(contexts.CeilometerServiceContext()(), data)