diff --git a/ceilometer/compute/notifications.py b/ceilometer/compute/notifications.py index 6faf0ca3b..5b59da27d 100644 --- a/ceilometer/compute/notifications.py +++ b/ceilometer/compute/notifications.py @@ -17,7 +17,7 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -"""Converters for producing compute counter messages from notification events. +"""Converters for producing compute sample messages from notification events. """ from oslo.config import cfg @@ -68,7 +68,7 @@ class InstanceScheduled(ComputeNotificationBase): class ComputeInstanceNotificationBase(ComputeNotificationBase): - """Convert compute.instance.* notifications into Counters + """Convert compute.instance.* notifications into Samples """ event_types = ['compute.instance.*'] diff --git a/ceilometer/compute/nova_notifier.py b/ceilometer/compute/nova_notifier.py index ea798f15c..47e800b90 100644 --- a/ceilometer/compute/nova_notifier.py +++ b/ceilometer/compute/nova_notifier.py @@ -65,7 +65,7 @@ class DeletedInstanceStatsGatherer(object): samples = self.mgr.map(self._get_samples_from_plugin, cache=cache, instance=instance) - # counters is a list of lists, so flatten it before returning + # samples is a list of lists, so flatten it before returning # the results results = [] for slist in samples: @@ -158,15 +158,15 @@ def notify(context, message): context, instance_ref, None, None) # Extend the payload with samples from our plugins. We only need - # to send some of the data from the counter objects, since a lot + # to send some of the data from the sample objects, since a lot # of the fields are the same. instance = Instance(context, instance_ref) - counters = gatherer(instance) - payload['samples'] = [{'name': c.name, - 'type': c.type, - 'unit': c.unit, - 'volume': c.volume} - for c in counters] + samples = gatherer(instance) + payload['samples'] = [{'name': s.name, + 'type': s.type, + 'unit': s.unit, + 'volume': s.volume} + for s in samples] publisher_id = notifier_api.publisher_id('compute', None) diff --git a/ceilometer/compute/pollsters/cpu.py b/ceilometer/compute/pollsters/cpu.py index 4f4305eed..e064b599c 100644 --- a/ceilometer/compute/pollsters/cpu.py +++ b/ceilometer/compute/pollsters/cpu.py @@ -36,7 +36,7 @@ class CPUPollster(plugin.ComputePollster): LOG.info("CPUTIME USAGE: %s %d", instance.__dict__, cpu_info.time) cpu_num = {'cpu_number': cpu_info.number} - yield util.make_counter_from_instance( + yield util.make_sample_from_instance( instance, name='cpu', type=sample.TYPE_CUMULATIVE, diff --git a/ceilometer/compute/pollsters/disk.py b/ceilometer/compute/pollsters/disk.py index 44ef42a82..af2af5153 100644 --- a/ceilometer/compute/pollsters/disk.py +++ b/ceilometer/compute/pollsters/disk.py @@ -73,8 +73,8 @@ class _Base(plugin.ComputePollster): return i_cache[instance_name] @abc.abstractmethod - def _get_counter(instance, c_data): - """Return one Counter.""" + def _get_sample(instance, c_data): + """Return one Sample.""" def get_samples(self, manager, cache, instance): instance_name = util.instance_name(instance) @@ -85,7 +85,7 @@ class _Base(plugin.ComputePollster): instance_name, ) try: - yield self._get_counter(instance, c_data) + yield self._get_sample(instance, c_data) except Exception as err: LOG.warning('Ignoring instance %s: %s', instance_name, err) @@ -95,8 +95,8 @@ class _Base(plugin.ComputePollster): class ReadRequestsPollster(_Base): @staticmethod - def _get_counter(instance, c_data): - return util.make_counter_from_instance( + def _get_sample(instance, c_data): + return util.make_sample_from_instance( instance, name='disk.read.requests', type=sample.TYPE_CUMULATIVE, @@ -108,8 +108,8 @@ class ReadRequestsPollster(_Base): class ReadBytesPollster(_Base): @staticmethod - def _get_counter(instance, c_data): - return util.make_counter_from_instance( + def _get_sample(instance, c_data): + return util.make_sample_from_instance( instance, name='disk.read.bytes', type=sample.TYPE_CUMULATIVE, @@ -121,8 +121,8 @@ class ReadBytesPollster(_Base): class WriteRequestsPollster(_Base): @staticmethod - def _get_counter(instance, c_data): - return util.make_counter_from_instance( + def _get_sample(instance, c_data): + return util.make_sample_from_instance( instance, name='disk.write.requests', type=sample.TYPE_CUMULATIVE, @@ -134,8 +134,8 @@ class WriteRequestsPollster(_Base): class WriteBytesPollster(_Base): @staticmethod - def _get_counter(instance, c_data): - return util.make_counter_from_instance( + def _get_sample(instance, c_data): + return util.make_sample_from_instance( instance, name='disk.write.bytes', type=sample.TYPE_CUMULATIVE, diff --git a/ceilometer/compute/pollsters/instance.py b/ceilometer/compute/pollsters/instance.py index 9b11af319..55b020665 100644 --- a/ceilometer/compute/pollsters/instance.py +++ b/ceilometer/compute/pollsters/instance.py @@ -27,7 +27,7 @@ class InstancePollster(plugin.ComputePollster): @staticmethod def get_samples(manager, cache, instance): - yield util.make_counter_from_instance( + yield util.make_sample_from_instance( instance, name='instance', type=sample.TYPE_GAUGE, @@ -40,7 +40,7 @@ class InstanceFlavorPollster(plugin.ComputePollster): @staticmethod def get_samples(manager, cache, instance): - yield util.make_counter_from_instance( + yield util.make_sample_from_instance( instance, # Use the "meter name + variable" syntax name='instance:%s' % diff --git a/ceilometer/compute/pollsters/net.py b/ceilometer/compute/pollsters/net.py index 4c9c45709..df8a820ed 100644 --- a/ceilometer/compute/pollsters/net.py +++ b/ceilometer/compute/pollsters/net.py @@ -35,7 +35,7 @@ class _Base(plugin.ComputePollster): "write-bytes=%d"]) @staticmethod - def make_vnic_counter(instance, name, type, unit, volume, vnic_data): + def make_vnic_sample(instance, name, type, unit, volume, vnic_data): metadata = copy.copy(vnic_data) resource_metadata = dict(zip(metadata._fields, metadata)) resource_metadata['instance_id'] = instance.id @@ -82,7 +82,7 @@ class _Base(plugin.ComputePollster): for vnic, info in vnics: LOG.info(self.NET_USAGE_MESSAGE, instance_name, vnic.name, info.rx_bytes, info.tx_bytes) - yield self._get_counter(instance, vnic, info) + yield self._get_sample(instance, vnic, info) except Exception as err: LOG.warning('Ignoring instance %s: %s', instance_name, err) @@ -91,8 +91,8 @@ class _Base(plugin.ComputePollster): class IncomingBytesPollster(_Base): - def _get_counter(self, instance, vnic, info): - return self.make_vnic_counter( + def _get_sample(self, instance, vnic, info): + return self.make_vnic_sample( instance, name='network.incoming.bytes', type=sample.TYPE_CUMULATIVE, @@ -104,8 +104,8 @@ class IncomingBytesPollster(_Base): class IncomingPacketsPollster(_Base): - def _get_counter(self, instance, vnic, info): - return self.make_vnic_counter( + def _get_sample(self, instance, vnic, info): + return self.make_vnic_sample( instance, name='network.incoming.packets', type=sample.TYPE_CUMULATIVE, @@ -117,8 +117,8 @@ class IncomingPacketsPollster(_Base): class OutgoingBytesPollster(_Base): - def _get_counter(self, instance, vnic, info): - return self.make_vnic_counter( + def _get_sample(self, instance, vnic, info): + return self.make_vnic_sample( instance, name='network.outgoing.bytes', type=sample.TYPE_CUMULATIVE, @@ -130,8 +130,8 @@ class OutgoingBytesPollster(_Base): class OutgoingPacketsPollster(_Base): - def _get_counter(self, instance, vnic, info): - return self.make_vnic_counter( + def _get_sample(self, instance, vnic, info): + return self.make_vnic_sample( instance, name='network.outgoing.packets', type=sample.TYPE_CUMULATIVE, diff --git a/ceilometer/compute/pollsters/util.py b/ceilometer/compute/pollsters/util.py index 1a94cbcbe..a0994e1c6 100644 --- a/ceilometer/compute/pollsters/util.py +++ b/ceilometer/compute/pollsters/util.py @@ -96,8 +96,8 @@ def _get_metadata_from_object(instance): return _add_reserved_user_metadata(instance, metadata) -def make_counter_from_instance(instance, name, type, unit, volume, - additional_metadata={}): +def make_sample_from_instance(instance, name, type, unit, volume, + additional_metadata={}): resource_metadata = _get_metadata_from_object(instance) resource_metadata.update(additional_metadata) return sample.Sample( diff --git a/nova_tests/test_notifier.py b/nova_tests/test_notifier.py index d2269d6a8..5b814e838 100644 --- a/nova_tests/test_notifier.py +++ b/nova_tests/test_notifier.py @@ -85,7 +85,7 @@ class TestNovaNotifier(base.TestCase): def get_samples(self, manager, cache, instance): self.instances.append((manager, instance)) - test_data_2 = util.make_counter_from_instance( + test_data_2 = util.make_sample_from_instance( instance, name='test2', type=sample.TYPE_CUMULATIVE,