remove instance:<flavor> meter
the groupby functionality allows you to group by instance_type which allows for the equivalent functionality of this meter. we should drop it so we avoid duplicating data. see: I568b5ca3d84371c4fd3bbdfed7b3e801164dbc5e DocImpact Change-Id: Ia380a0b87999f32fd339bb3b596ec8e18fdff0fe Closes-Bug: #1208365
This commit is contained in:
parent
beec41081a
commit
88dcdb5d70
@ -141,22 +141,6 @@ class EphemeralDiskSize(ComputeInstanceNotificationBase):
|
||||
message=message)
|
||||
|
||||
|
||||
class InstanceFlavor(ComputeInstanceNotificationBase,
|
||||
plugin_base.NonMetricNotificationBase):
|
||||
def get_sample(self, message):
|
||||
instance_type = message.get('payload', {}).get('instance_type')
|
||||
if instance_type:
|
||||
yield sample.Sample.from_notification(
|
||||
name='instance:%s' % instance_type,
|
||||
type=sample.TYPE_GAUGE,
|
||||
unit='instance',
|
||||
volume=1,
|
||||
user_id=message['payload']['user_id'],
|
||||
project_id=message['payload']['tenant_id'],
|
||||
resource_id=message['payload']['instance_id'],
|
||||
message=message)
|
||||
|
||||
|
||||
class InstanceDelete(ComputeInstanceNotificationBase):
|
||||
"""Handle the messages sent by the nova notifier plugin.
|
||||
|
||||
|
@ -31,19 +31,3 @@ class InstancePollster(pollsters.BaseComputePollster):
|
||||
unit='instance',
|
||||
volume=1,
|
||||
)
|
||||
|
||||
|
||||
class InstanceFlavorPollster(pollsters.BaseComputePollster):
|
||||
|
||||
@staticmethod
|
||||
def get_samples(manager, cache, resources):
|
||||
for instance in resources:
|
||||
yield util.make_sample_from_instance(
|
||||
instance,
|
||||
# Use the "meter name + variable" syntax
|
||||
name='instance:%s' %
|
||||
instance.flavor['name'],
|
||||
type=sample.TYPE_GAUGE,
|
||||
unit='instance',
|
||||
volume=1,
|
||||
)
|
||||
|
@ -248,19 +248,7 @@ class SampleSource(Source):
|
||||
raise PipelineException("Discovery should be a list", cfg)
|
||||
self.check_source_filtering(self.meters, 'meters')
|
||||
|
||||
# (yjiang5) To support meters like instance:m1.tiny,
|
||||
# which include variable part at the end starting with ':'.
|
||||
# Hope we will not add such meters in future.
|
||||
@staticmethod
|
||||
def _variable_meter_name(name):
|
||||
m = name.partition(':')
|
||||
if m[1] == ':':
|
||||
return m[1].join((m[0], '*'))
|
||||
else:
|
||||
return name
|
||||
|
||||
def support_meter(self, meter_name):
|
||||
meter_name = self._variable_meter_name(meter_name)
|
||||
return self.is_supported(self.meters, meter_name)
|
||||
|
||||
|
||||
|
@ -631,13 +631,6 @@ class TestNotifications(base.BaseTestCase):
|
||||
c = counters[0]
|
||||
self.assertEqual(1, c.volume)
|
||||
|
||||
def test_instance_create_flavor(self):
|
||||
ic = instance.InstanceFlavor(None)
|
||||
counters = list(ic.process_notification(INSTANCE_CREATE_END))
|
||||
self.assertEqual(1, len(counters))
|
||||
c = counters[0]
|
||||
self.assertEqual(1, c.volume)
|
||||
|
||||
def test_instance_create_memory(self):
|
||||
ic = instance.Memory(None)
|
||||
counters = list(ic.process_notification(INSTANCE_CREATE_END))
|
||||
@ -677,21 +670,11 @@ class TestNotifications(base.BaseTestCase):
|
||||
counters = list(ic.process_notification(INSTANCE_EXISTS_METADATA_LIST))
|
||||
self.assertEqual(1, len(counters))
|
||||
|
||||
def test_instance_exists_flavor(self):
|
||||
ic = instance.Instance(None)
|
||||
counters = list(ic.process_notification(INSTANCE_EXISTS))
|
||||
self.assertEqual(1, len(counters))
|
||||
|
||||
def test_instance_delete_instance(self):
|
||||
ic = instance.Instance(None)
|
||||
counters = list(ic.process_notification(INSTANCE_DELETE_START))
|
||||
self.assertEqual(1, len(counters))
|
||||
|
||||
def test_instance_delete_flavor(self):
|
||||
ic = instance.Instance(None)
|
||||
counters = list(ic.process_notification(INSTANCE_DELETE_START))
|
||||
self.assertEqual(1, len(counters))
|
||||
|
||||
def test_instance_finish_resize_instance(self):
|
||||
ic = instance.Instance(None)
|
||||
counters = list(ic.process_notification(INSTANCE_FINISH_RESIZE_END))
|
||||
@ -700,15 +683,6 @@ class TestNotifications(base.BaseTestCase):
|
||||
self.assertEqual(1, c.volume)
|
||||
self._verify_user_metadata(c.resource_metadata)
|
||||
|
||||
def test_instance_finish_resize_flavor(self):
|
||||
ic = instance.InstanceFlavor(None)
|
||||
counters = list(ic.process_notification(INSTANCE_FINISH_RESIZE_END))
|
||||
self.assertEqual(1, len(counters))
|
||||
c = counters[0]
|
||||
self.assertEqual(1, c.volume)
|
||||
self.assertEqual('instance:m1.small', c.name)
|
||||
self._verify_user_metadata(c.resource_metadata)
|
||||
|
||||
def test_instance_finish_resize_memory(self):
|
||||
ic = instance.Memory(None)
|
||||
counters = list(ic.process_notification(INSTANCE_FINISH_RESIZE_END))
|
||||
@ -735,15 +709,6 @@ class TestNotifications(base.BaseTestCase):
|
||||
self.assertEqual(1, c.volume)
|
||||
self._verify_user_metadata(c.resource_metadata)
|
||||
|
||||
def test_instance_resize_finish_flavor(self):
|
||||
ic = instance.InstanceFlavor(None)
|
||||
counters = list(ic.process_notification(INSTANCE_RESIZE_REVERT_END))
|
||||
self.assertEqual(1, len(counters))
|
||||
c = counters[0]
|
||||
self.assertEqual(1, c.volume)
|
||||
self.assertEqual('instance:m1.tiny', c.name)
|
||||
self._verify_user_metadata(c.resource_metadata)
|
||||
|
||||
def test_instance_resize_finish_memory(self):
|
||||
ic = instance.Memory(None)
|
||||
counters = list(ic.process_notification(INSTANCE_RESIZE_REVERT_END))
|
||||
|
@ -41,14 +41,6 @@ class TestInstancePollster(base.TestPollsterBase):
|
||||
self.assertEqual(0, samples[0].resource_metadata['ephemeral_gb'])
|
||||
self.assertEqual('active', samples[0].resource_metadata['status'])
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def test_get_samples_instance_flavor(self):
|
||||
mgr = manager.AgentManager()
|
||||
pollster = pollsters_instance.InstanceFlavorPollster()
|
||||
samples = list(pollster.get_samples(mgr, {}, [self.instance]))
|
||||
self.assertEqual(1, len(samples))
|
||||
self.assertEqual('instance:m1.small', samples[0].name)
|
||||
|
||||
@mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock())
|
||||
def test_get_reserved_metadata_with_keys(self):
|
||||
self.CONF = self.useFixture(fixture_config.Config()).conf
|
||||
|
@ -751,43 +751,6 @@ class BasePipelineTestCase(base.BaseTestCase):
|
||||
self.assertEqual('a_update',
|
||||
getattr(publisher.samples[0], 'name'))
|
||||
|
||||
def test_variable_counter(self):
|
||||
self.pipeline_cfg = [{
|
||||
'name': "test_pipeline",
|
||||
'interval': 5,
|
||||
'counters': ['a:*'],
|
||||
'transformers': [
|
||||
{'name': "update",
|
||||
'parameters': {}}
|
||||
],
|
||||
'publishers': ["test://"],
|
||||
}, ]
|
||||
pipeline_manager = pipeline.PipelineManager(self.pipeline_cfg,
|
||||
self.transformer_manager)
|
||||
|
||||
self.test_counter = sample.Sample(
|
||||
name='a:b',
|
||||
type=self.test_counter.type,
|
||||
volume=self.test_counter.volume,
|
||||
unit=self.test_counter.unit,
|
||||
user_id=self.test_counter.user_id,
|
||||
project_id=self.test_counter.project_id,
|
||||
resource_id=self.test_counter.resource_id,
|
||||
timestamp=self.test_counter.timestamp,
|
||||
resource_metadata=self.test_counter.resource_metadata,
|
||||
)
|
||||
|
||||
with pipeline_manager.publisher(None) as p:
|
||||
p([self.test_counter])
|
||||
|
||||
publisher = pipeline_manager.pipelines[0].publishers[0]
|
||||
self.assertEqual(1, len(publisher.samples))
|
||||
self.assertEqual(1, len(self.TransformerClass.samples))
|
||||
self.assertEqual('a:b_update',
|
||||
getattr(publisher.samples[0], "name"))
|
||||
self.assertEqual('a:b',
|
||||
getattr(self.TransformerClass.samples[0], "name"))
|
||||
|
||||
def test_global_unit_conversion(self):
|
||||
scale = 'volume / ((10**6) * 60)'
|
||||
transformer_cfg = [
|
||||
|
@ -31,7 +31,6 @@ ceilometer.notification =
|
||||
magnetodb_table = ceilometer.key_value_storage.notifications:Table
|
||||
magnetodb_index_count = ceilometer.key_value_storage.notifications:Index
|
||||
instance = ceilometer.compute.notifications.instance:Instance
|
||||
instance_flavor = ceilometer.compute.notifications.instance:InstanceFlavor
|
||||
instance_delete = ceilometer.compute.notifications.instance:InstanceDelete
|
||||
instance_scheduled = ceilometer.compute.notifications.instance:InstanceScheduled
|
||||
memory = ceilometer.compute.notifications.instance:Memory
|
||||
@ -140,7 +139,6 @@ ceilometer.poll.compute =
|
||||
network.incoming.bytes.rate = ceilometer.compute.pollsters.net:IncomingBytesRatePollster
|
||||
network.outgoing.bytes.rate = ceilometer.compute.pollsters.net:OutgoingBytesRatePollster
|
||||
instance = ceilometer.compute.pollsters.instance:InstancePollster
|
||||
instance_flavor = ceilometer.compute.pollsters.instance:InstanceFlavorPollster
|
||||
memory.usage = ceilometer.compute.pollsters.memory:MemoryUsagePollster
|
||||
memory.resident = ceilometer.compute.pollsters.memory:MemoryResidentPollster
|
||||
disk.capacity = ceilometer.compute.pollsters.disk:CapacityPollster
|
||||
|
Loading…
x
Reference in New Issue
Block a user