From 13e5bdf6ffde6aafd1468fd65bb16d4e9ca62135 Mon Sep 17 00:00:00 2001 From: Matthias Runge Date: Wed, 30 Sep 2020 15:32:48 +0200 Subject: [PATCH] Add SendQueueLimit to collectd-amqp1 to limit the queue length and to ignore data added earlier to the queue, when there is no remote to connect to. This will limit the memory usage of this plugin. By default, the memory may grow until it runs out of memory. Depends-On: https://review.opendev.org/756365 Change-Id: Ie2db4b7487f9a8eaa7152b1b7984c52016219ed5 (cherry picked from commit 91cc43e01fb700bdadeac5e6e19d613f58c97eaa) --- ci/environments/scenario001-standalone.yaml | 1 + deployment/metrics/collectd-container-puppet.yaml | 13 +++++++++++++ environments/enable-stf.yaml | 1 + environments/metrics/collectd-write-qdr.yaml | 1 + 4 files changed, 16 insertions(+) diff --git a/ci/environments/scenario001-standalone.yaml b/ci/environments/scenario001-standalone.yaml index ab49ba8c2f..096de863da 100644 --- a/ci/environments/scenario001-standalone.yaml +++ b/ci/environments/scenario001-standalone.yaml @@ -166,6 +166,7 @@ parameter_defaults: telemetry: format: JSON presettle: false + CollectdAmqpQueueLimit: 40 LoggingServers: - host: 127.0.0.1 port: 24224 diff --git a/deployment/metrics/collectd-container-puppet.yaml b/deployment/metrics/collectd-container-puppet.yaml index 34191b0064..d095b78f9c 100644 --- a/deployment/metrics/collectd-container-puppet.yaml +++ b/deployment/metrics/collectd-container-puppet.yaml @@ -299,6 +299,12 @@ parameters: Interval on which metrics should be sent to AMQP intermediary. If not set the default for all collectd plugins is used. default: -666 + CollectdAmqpSendQueueLimit: + type: number + description: > + Number of data sets to be kept in memory, older sets will be discarded, + if set to -1, this feature is disabled. + default: -1 CollectdEnableSensubility: type: boolean description: Set to true if sensubility should be executed by exec plugin. @@ -390,6 +396,8 @@ conditions: equals: [{get_param: CollectdAmqpHost}, nil] amqp_default_interval: equals: [{get_param: CollectdAmqpInterval}, -666] + amqp_default_send_queue_limit: + equals: [{get_param: CollectdAmqpSendQueueLimit}, -1] collectd_connection: equals: [{get_param: CollectdConnectionType}, 'network'] gnocchi_connection: @@ -494,6 +502,11 @@ outputs: - {} - tripleo::profile::base::metrics::collectd::amqp_interval: get_param: CollectdAmqpInterval + - if: + - amqp_default_send_queue_limit + - {} + - tripleo::profile::base::metrics::collectd::amqp_default_send_queue_limit: + get_param: CollectdAmqpSendQueueLimit - if: - amqp_default_connection - tripleo::profile::base::metrics::collectd::amqp_host: diff --git a/environments/enable-stf.yaml b/environments/enable-stf.yaml index 9254e97e86..03d5dad999 100644 --- a/environments/enable-stf.yaml +++ b/environments/enable-stf.yaml @@ -15,6 +15,7 @@ parameter_defaults: CollectdConnectionType: amqp1 CollectdAmqpInterval: 5 CollectdDefaultPollingInterval: 5 + CollectdAmqpQueueLimit: 40 CollectdAmqpInstances: notify: diff --git a/environments/metrics/collectd-write-qdr.yaml b/environments/metrics/collectd-write-qdr.yaml index 97305dd01b..9eff8e60f2 100644 --- a/environments/metrics/collectd-write-qdr.yaml +++ b/environments/metrics/collectd-write-qdr.yaml @@ -6,6 +6,7 @@ resource_registry: parameter_defaults: CollectdConnectionType: amqp1 + CollectdAmqpQueueLimit: 40 CollectdAmqpInstances: notify: notify: true