Add metering and event ttl config options

ceilometer.conf template >= Kilo does not contain metering-time-to-live
and event-time-to-live parameters. Add these options so we can control
ceilometer database growth.

Change-Id: Id5831280daeb582586bfa615268309c4abec5d63
Closes-Bug: 1561220
This commit is contained in:
Leonardo Borda 2016-04-07 14:45:06 -04:00 committed by James Page
parent 46a89d6ce2
commit f3c74cc4c6
5 changed files with 20 additions and 2 deletions

View File

@ -7,6 +7,16 @@ options:
default: False
type: boolean
description: Enable verbose logging.
metering-time-to-live:
type: int
default: -1
description: |
Number of seconds that samples are kept in the database for (<= 0 means forever)
event-time-to-live:
type: int
default: -1
description: |
Number of seconds that events are kept in the database for (<= 0 means forever)
use-syslog:
type: boolean
default: False

View File

@ -92,9 +92,11 @@ class CeilometerContext(OSContextGenerator):
from ceilometer_utils import get_shared_secret
ctxt = {
'api_workers': config('api-workers'),
'port': CEILOMETER_PORT,
'metering_secret': get_shared_secret()
'metering_secret': get_shared_secret(),
'api_workers': config('api-workers'),
'metering_time_to_live': config('metering-time-to-live'),
'event_time_to_live': config('event-time-to-live'),
}
return ctxt

View File

@ -28,6 +28,8 @@ 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 }}
[publisher_rpc]
metering_secret = {{ metering_secret }}

View File

@ -26,6 +26,8 @@ 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 }}
[publisher]
telemetry_secret = {{ metering_secret }}

View File

@ -129,6 +129,8 @@ class CeilometerContextsTest(CharmTestCase):
'port': 8777,
'metering_secret': 'mysecret',
'api_workers': 1,
'metering_time_to_live': -1,
'event_time_to_live': -1,
})
def test_ceilometer_service_context(self):