summaryrefslogtreecommitdiff
path: root/ceilometer/middleware.py
diff options
context:
space:
mode:
authorHanxi Liu <hanxi.liu@easystack.cn>2017-01-19 14:07:04 +0800
committerHanxi Liu <hanxi.liu@easystack.cn>2017-02-22 17:34:58 +0000
commitfed5795d357de8558158f023fb1806cf7f11be31 (patch)
tree48e1c91d8e3881bd1f7f74ad22a75ab0e6b0d251 /ceilometer/middleware.py
parentb01c33f78b1e441d70e19c0b793c670c0f945b3e (diff)
downloadceilometer-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.py30
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'],