diff --git a/ceilometer/network/notifications.py b/ceilometer/network/notifications.py index 64bdf1de0..5c7c67c6a 100644 --- a/ceilometer/network/notifications.py +++ b/ceilometer/network/notifications.py @@ -60,7 +60,7 @@ class NetworkNotificationBase(plugin.NotificationBase): return [ counter.Counter(source='?', name=self.resource_name, - type='absolute', + type='gauge', volume=1, user_id=message['_context_user_id'], project_id=message['payload']['tenant_id'], @@ -70,6 +70,18 @@ class NetworkNotificationBase(plugin.NotificationBase): resource_metadata=self.notification_to_metadata( message), ), + counter.Counter(source='?', + name=message['event_type'].rpartition('.')[0], + type='gauge', + volume=1, + user_id=message['_context_user_id'], + project_id=message['payload']['tenant_id'], + resource_id='network', + timestamp=message['timestamp'], + duration=None, + resource_metadata=self.notification_to_metadata( + message), + ), ] diff --git a/tests/network/test_notifications.py b/tests/network/test_notifications.py index 7b1b62e18..71d9268e6 100644 --- a/tests/network/test_notifications.py +++ b/tests/network/test_notifications.py @@ -137,19 +137,19 @@ class TestNotifications(unittest.TestCase): def test_network_create(self): v = notifications.Network() counters = v.process_notification(NOTIFICATION_NETWORK_CREATE) - self.assertEqual(len(counters), 1) + self.assertEqual(len(counters), 2) def test_subnet_create(self): v = notifications.Subnet() counters = v.process_notification(NOTIFICATION_SUBNET_CREATE) - self.assertEqual(len(counters), 1) + self.assertEqual(len(counters), 2) def test_port_create(self): v = notifications.Port() counters = v.process_notification(NOTIFICATION_PORT_CREATE) - self.assertEqual(len(counters), 1) + self.assertEqual(len(counters), 2) def test_port_update(self): v = notifications.Port() counters = v.process_notification(NOTIFICATION_PORT_UPDATE) - self.assertEqual(len(counters), 1) + self.assertEqual(len(counters), 2)