diff options
author | Hanxi Liu <hanxi.liu@easystack.cn> | 2017-01-19 14:07:04 +0800 |
---|---|---|
committer | Hanxi Liu <hanxi.liu@easystack.cn> | 2017-02-22 17:34:58 +0000 |
commit | fed5795d357de8558158f023fb1806cf7f11be31 (patch) | |
tree | 48e1c91d8e3881bd1f7f74ad22a75ab0e6b0d251 /ceilometer/middleware.py | |
parent | b01c33f78b1e441d70e19c0b793c670c0f945b3e (diff) | |
download | ceilometer-fed5795d357de8558158f023fb1806cf7f11be31.tar.gz |
Support extended declaring exchanges
Allow users add metrics into meters.yaml themselves. Reusing
http_control_exchanges makes it available to extend addtional
exchanges.
Closes-Bug: #1656873
Change-Id: I196f8fb0e2aee8498309bb0cb1b3ec2b2e21e211
Diffstat (limited to 'ceilometer/middleware.py')
-rw-r--r-- | ceilometer/middleware.py | 30 |
1 files changed, 2 insertions, 28 deletions
diff --git a/ceilometer/middleware.py b/ceilometer/middleware.py index 28758313..0f238019 100644 --- a/ceilometer/middleware.py +++ b/ceilometer/middleware.py @@ -13,39 +13,13 @@ # License for the specific language governing permissions and limitations # under the License. -from oslo_config import cfg -import oslo_messaging - -from ceilometer.agent import plugin_base +from ceilometer import notification from ceilometer import sample -# NOTE(sileht): reading config values at loadtime won't works -# we should use set_defaults at runtime to set http_control_exchanges to -# [cfg.CONF.nova_control_exchange, -# cfg.CONF.glance_control_exchange, -# cfg.CONF.neutron_control_exchange, -# cfg.CONF.cinder_control_exchange], -OPTS = [ - cfg.MultiStrOpt('http_control_exchanges', - default=['nova', 'glance', 'neutron', 'cinder'], - help="Exchanges name to listen for notifications."), -] - - -class HTTPRequest(plugin_base.NotificationBase): +class HTTPRequest(notification.NotificationProcessBase): event_types = ['http.request'] - def get_targets(self, conf): - """Return a sequence of oslo_messaging.Target - - This sequence is defining the exchange and topics to be connected for - this plugin. - """ - return [oslo_messaging.Target(topic=topic, exchange=exchange) - for topic in self.get_notification_topics(conf) - for exchange in conf.http_control_exchanges] - def process_notification(self, message): yield sample.Sample.from_notification( name=message['event_type'], |