Rename ceilometer.counter to ceilometer.sample
Change-Id: Id5e943cffd59bd439c235630ca040035128a919f Blueprint: remove-counter
This commit is contained in:
parent
207f52bd8a
commit
c2cfd732b5
@ -25,7 +25,7 @@ import sys
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer import service
|
from ceilometer import service
|
||||||
from ceilometer import transformer
|
from ceilometer import transformer
|
||||||
@ -88,8 +88,8 @@ pipeline_manager = pipeline.setup_pipeline(
|
|||||||
)
|
)
|
||||||
|
|
||||||
with pipeline_manager.publisher(context.get_admin_context(),
|
with pipeline_manager.publisher(context.get_admin_context(),
|
||||||
cfg.CONF.counter_source) as p:
|
cfg.CONF.sample_source) as p:
|
||||||
p([counter.Counter(
|
p([sample.Sample(
|
||||||
name=cfg.CONF.counter_name,
|
name=cfg.CONF.counter_name,
|
||||||
type=cfg.CONF.counter_type,
|
type=cfg.CONF.counter_type,
|
||||||
unit=cfg.CONF.counter_unit,
|
unit=cfg.CONF.counter_unit,
|
||||||
|
@ -40,7 +40,7 @@ class PollingTask(object):
|
|||||||
self.pollsters = set()
|
self.pollsters = set()
|
||||||
self.publish_context = pipeline.PublishContext(
|
self.publish_context = pipeline.PublishContext(
|
||||||
agent_manager.context,
|
agent_manager.context,
|
||||||
cfg.CONF.counter_source)
|
cfg.CONF.sample_source)
|
||||||
|
|
||||||
def add(self, pollster, pipelines):
|
def add(self, pollster, pipelines):
|
||||||
self.publish_context.add_pipelines(pipelines)
|
self.publish_context.add_pipelines(pipelines)
|
||||||
|
@ -41,7 +41,7 @@ from wsme import types as wtypes
|
|||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.api import acl
|
from ceilometer.api import acl
|
||||||
@ -491,7 +491,7 @@ class MeterController(rest.RestController):
|
|||||||
def get_consistent_source():
|
def get_consistent_source():
|
||||||
'''Find a source that can be applied across the sample group
|
'''Find a source that can be applied across the sample group
|
||||||
or raise InvalidInput if the sources are inconsistent.
|
or raise InvalidInput if the sources are inconsistent.
|
||||||
If all are None - use the configured counter_source
|
If all are None - use the configured sample_source
|
||||||
If any sample has source set then the others must be the same
|
If any sample has source set then the others must be the same
|
||||||
or None.
|
or None.
|
||||||
'''
|
'''
|
||||||
@ -504,7 +504,7 @@ class MeterController(rest.RestController):
|
|||||||
'with different sources')
|
'with different sources')
|
||||||
if s.source and not source:
|
if s.source and not source:
|
||||||
source = s.source
|
source = s.source
|
||||||
return source or pecan.request.cfg.counter_source
|
return source or pecan.request.cfg.sample_source
|
||||||
|
|
||||||
samples = [Sample(**b) for b in body]
|
samples = [Sample(**b) for b in body]
|
||||||
now = timeutils.utcnow()
|
now = timeutils.utcnow()
|
||||||
@ -534,7 +534,7 @@ class MeterController(rest.RestController):
|
|||||||
source,
|
source,
|
||||||
pecan.request.pipeline_manager.pipelines,
|
pecan.request.pipeline_manager.pipelines,
|
||||||
) as publisher:
|
) as publisher:
|
||||||
publisher([counter.Counter(
|
publisher([sample.Sample(
|
||||||
name=s.counter_name,
|
name=s.counter_name,
|
||||||
type=s.counter_type,
|
type=s.counter_type,
|
||||||
unit=s.counter_unit,
|
unit=s.counter_unit,
|
||||||
@ -585,9 +585,9 @@ class Meter(_Base):
|
|||||||
name = wtypes.text
|
name = wtypes.text
|
||||||
"The unique name for the meter"
|
"The unique name for the meter"
|
||||||
|
|
||||||
type = wtypes.Enum(str, counter.TYPE_GAUGE,
|
type = wtypes.Enum(str, sample.TYPE_GAUGE,
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
counter.TYPE_DELTA)
|
sample.TYPE_DELTA)
|
||||||
"The meter type (see :ref:`measurements`)"
|
"The meter type (see :ref:`measurements`)"
|
||||||
|
|
||||||
unit = wtypes.text
|
unit = wtypes.text
|
||||||
|
@ -251,7 +251,7 @@ class CollectorService(rpc_service.Service):
|
|||||||
if notification['event_type'] in handler.get_event_types():
|
if notification['event_type'] in handler.get_event_types():
|
||||||
ctxt = context.get_admin_context()
|
ctxt = context.get_admin_context()
|
||||||
with self.pipeline_manager.publisher(ctxt,
|
with self.pipeline_manager.publisher(ctxt,
|
||||||
cfg.CONF.counter_source) as p:
|
cfg.CONF.sample_source) as p:
|
||||||
# FIXME(dhellmann): Spawn green thread?
|
# FIXME(dhellmann): Spawn green thread?
|
||||||
p(list(handler.process_notification(notification)))
|
p(list(handler.process_notification(notification)))
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import plugin
|
from ceilometer import plugin
|
||||||
|
|
||||||
|
|
||||||
@ -56,9 +56,9 @@ class InstanceScheduled(ComputeNotificationBase):
|
|||||||
return ['scheduler.run_instance.scheduled']
|
return ['scheduler.run_instance.scheduled']
|
||||||
|
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='instance.scheduled',
|
name='instance.scheduled',
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
volume=1,
|
volume=1,
|
||||||
unit='instance',
|
unit='instance',
|
||||||
user_id=None,
|
user_id=None,
|
||||||
@ -86,9 +86,9 @@ class ComputeInstanceNotificationBase(ComputeNotificationBase):
|
|||||||
|
|
||||||
class Instance(ComputeInstanceNotificationBase):
|
class Instance(ComputeInstanceNotificationBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='instance',
|
name='instance',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='instance',
|
unit='instance',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -99,9 +99,9 @@ class Instance(ComputeInstanceNotificationBase):
|
|||||||
|
|
||||||
class Memory(ComputeInstanceNotificationBase):
|
class Memory(ComputeInstanceNotificationBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='memory',
|
name='memory',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='MB',
|
unit='MB',
|
||||||
volume=message['payload']['memory_mb'],
|
volume=message['payload']['memory_mb'],
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -112,9 +112,9 @@ class Memory(ComputeInstanceNotificationBase):
|
|||||||
|
|
||||||
class VCpus(ComputeInstanceNotificationBase):
|
class VCpus(ComputeInstanceNotificationBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='vcpus',
|
name='vcpus',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='vcpu',
|
unit='vcpu',
|
||||||
volume=message['payload']['vcpus'],
|
volume=message['payload']['vcpus'],
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -125,9 +125,9 @@ class VCpus(ComputeInstanceNotificationBase):
|
|||||||
|
|
||||||
class RootDiskSize(ComputeInstanceNotificationBase):
|
class RootDiskSize(ComputeInstanceNotificationBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='disk.root.size',
|
name='disk.root.size',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='GB',
|
unit='GB',
|
||||||
volume=message['payload']['root_gb'],
|
volume=message['payload']['root_gb'],
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -138,9 +138,9 @@ class RootDiskSize(ComputeInstanceNotificationBase):
|
|||||||
|
|
||||||
class EphemeralDiskSize(ComputeInstanceNotificationBase):
|
class EphemeralDiskSize(ComputeInstanceNotificationBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='disk.ephemeral.size',
|
name='disk.ephemeral.size',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='GB',
|
unit='GB',
|
||||||
volume=message['payload']['ephemeral_gb'],
|
volume=message['payload']['ephemeral_gb'],
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -153,9 +153,9 @@ class InstanceFlavor(ComputeInstanceNotificationBase):
|
|||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
instance_type = message.get('payload', {}).get('instance_type')
|
instance_type = message.get('payload', {}).get('instance_type')
|
||||||
if instance_type:
|
if instance_type:
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='instance:%s' % instance_type,
|
name='instance:%s' % instance_type,
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='instance',
|
unit='instance',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -174,12 +174,12 @@ class InstanceDelete(ComputeInstanceNotificationBase):
|
|||||||
return ['compute.instance.delete.samples']
|
return ['compute.instance.delete.samples']
|
||||||
|
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
for sample in message['payload'].get('samples', []):
|
for s in message['payload'].get('samples', []):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name=sample['name'],
|
name=s['name'],
|
||||||
type=sample['type'],
|
type=s['type'],
|
||||||
unit=sample['unit'],
|
unit=s['unit'],
|
||||||
volume=sample['volume'],
|
volume=s['volume'],
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
project_id=message['payload']['tenant_id'],
|
project_id=message['payload']['tenant_id'],
|
||||||
resource_id=message['payload']['instance_id'],
|
resource_id=message['payload']['instance_id'],
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
from ceilometer.compute.pollsters import util
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
@ -39,7 +39,7 @@ class CPUPollster(plugin.ComputePollster):
|
|||||||
yield util.make_counter_from_instance(
|
yield util.make_counter_from_instance(
|
||||||
instance,
|
instance,
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='ns',
|
unit='ns',
|
||||||
volume=cpu_info.time,
|
volume=cpu_info.time,
|
||||||
additional_metadata=cpu_num,
|
additional_metadata=cpu_num,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
import abc
|
import abc
|
||||||
import collections
|
import collections
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
from ceilometer.compute.pollsters import util
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
@ -99,7 +99,7 @@ class ReadRequestsPollster(_Base):
|
|||||||
return util.make_counter_from_instance(
|
return util.make_counter_from_instance(
|
||||||
instance,
|
instance,
|
||||||
name='disk.read.requests',
|
name='disk.read.requests',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='request',
|
unit='request',
|
||||||
volume=c_data.r_requests,
|
volume=c_data.r_requests,
|
||||||
)
|
)
|
||||||
@ -112,7 +112,7 @@ class ReadBytesPollster(_Base):
|
|||||||
return util.make_counter_from_instance(
|
return util.make_counter_from_instance(
|
||||||
instance,
|
instance,
|
||||||
name='disk.read.bytes',
|
name='disk.read.bytes',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=c_data.r_bytes,
|
volume=c_data.r_bytes,
|
||||||
)
|
)
|
||||||
@ -125,7 +125,7 @@ class WriteRequestsPollster(_Base):
|
|||||||
return util.make_counter_from_instance(
|
return util.make_counter_from_instance(
|
||||||
instance,
|
instance,
|
||||||
name='disk.write.requests',
|
name='disk.write.requests',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='request',
|
unit='request',
|
||||||
volume=c_data.w_requests,
|
volume=c_data.w_requests,
|
||||||
)
|
)
|
||||||
@ -138,7 +138,7 @@ class WriteBytesPollster(_Base):
|
|||||||
return util.make_counter_from_instance(
|
return util.make_counter_from_instance(
|
||||||
instance,
|
instance,
|
||||||
name='disk.write.bytes',
|
name='disk.write.bytes',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=c_data.w_bytes,
|
volume=c_data.w_bytes,
|
||||||
)
|
)
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
from ceilometer.compute.pollsters import util
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ class InstancePollster(plugin.ComputePollster):
|
|||||||
yield util.make_counter_from_instance(
|
yield util.make_counter_from_instance(
|
||||||
instance,
|
instance,
|
||||||
name='instance',
|
name='instance',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='instance',
|
unit='instance',
|
||||||
volume=1,
|
volume=1,
|
||||||
)
|
)
|
||||||
@ -45,7 +45,7 @@ class InstanceFlavorPollster(plugin.ComputePollster):
|
|||||||
# Use the "meter name + variable" syntax
|
# Use the "meter name + variable" syntax
|
||||||
name='instance:%s' %
|
name='instance:%s' %
|
||||||
instance.flavor['name'],
|
instance.flavor['name'],
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='instance',
|
unit='instance',
|
||||||
volume=1,
|
volume=1,
|
||||||
)
|
)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
import copy
|
import copy
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.compute import plugin
|
from ceilometer.compute import plugin
|
||||||
from ceilometer.compute.pollsters import util
|
from ceilometer.compute.pollsters import util
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
@ -48,7 +48,7 @@ class _Base(plugin.ComputePollster):
|
|||||||
instance_name = util.instance_name(instance)
|
instance_name = util.instance_name(instance)
|
||||||
rid = "%s-%s-%s" % (instance_name, instance.id, vnic_data.name)
|
rid = "%s-%s-%s" % (instance_name, instance.id, vnic_data.name)
|
||||||
|
|
||||||
return counter.Counter(
|
return sample.Sample(
|
||||||
name=name,
|
name=name,
|
||||||
type=type,
|
type=type,
|
||||||
unit=unit,
|
unit=unit,
|
||||||
@ -95,7 +95,7 @@ class IncomingBytesPollster(_Base):
|
|||||||
return self.make_vnic_counter(
|
return self.make_vnic_counter(
|
||||||
instance,
|
instance,
|
||||||
name='network.incoming.bytes',
|
name='network.incoming.bytes',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=info.rx_bytes,
|
volume=info.rx_bytes,
|
||||||
vnic_data=vnic,
|
vnic_data=vnic,
|
||||||
@ -108,7 +108,7 @@ class IncomingPacketsPollster(_Base):
|
|||||||
return self.make_vnic_counter(
|
return self.make_vnic_counter(
|
||||||
instance,
|
instance,
|
||||||
name='network.incoming.packets',
|
name='network.incoming.packets',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='packet',
|
unit='packet',
|
||||||
volume=info.rx_packets,
|
volume=info.rx_packets,
|
||||||
vnic_data=vnic,
|
vnic_data=vnic,
|
||||||
@ -121,7 +121,7 @@ class OutgoingBytesPollster(_Base):
|
|||||||
return self.make_vnic_counter(
|
return self.make_vnic_counter(
|
||||||
instance,
|
instance,
|
||||||
name='network.outgoing.bytes',
|
name='network.outgoing.bytes',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=info.tx_bytes,
|
volume=info.tx_bytes,
|
||||||
vnic_data=vnic,
|
vnic_data=vnic,
|
||||||
@ -134,7 +134,7 @@ class OutgoingPacketsPollster(_Base):
|
|||||||
return self.make_vnic_counter(
|
return self.make_vnic_counter(
|
||||||
instance,
|
instance,
|
||||||
name='network.outgoing.packets',
|
name='network.outgoing.packets',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='packet',
|
unit='packet',
|
||||||
volume=info.tx_packets,
|
volume=info.tx_packets,
|
||||||
vnic_data=vnic,
|
vnic_data=vnic,
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
|
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ def make_counter_from_instance(instance, name, type, unit, volume,
|
|||||||
additional_metadata={}):
|
additional_metadata={}):
|
||||||
resource_metadata = _get_metadata_from_object(instance)
|
resource_metadata = _get_metadata_from_object(instance)
|
||||||
resource_metadata.update(additional_metadata)
|
resource_metadata.update(additional_metadata)
|
||||||
return counter.Counter(
|
return sample.Sample(
|
||||||
name=name,
|
name=name,
|
||||||
type=type,
|
type=type,
|
||||||
unit=unit,
|
unit=unit,
|
||||||
|
@ -20,7 +20,7 @@ from keystoneclient import exceptions
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
|
|
||||||
@ -84,9 +84,9 @@ class EnergyPollster(_Base):
|
|||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
"""Returns all counters."""
|
"""Returns all counters."""
|
||||||
for probe in self._iter_probes(manager.keystone, cache):
|
for probe in self._iter_probes(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='energy',
|
name='energy',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='kWh',
|
unit='kWh',
|
||||||
volume=probe['kwh'],
|
volume=probe['kwh'],
|
||||||
user_id=None,
|
user_id=None,
|
||||||
@ -104,9 +104,9 @@ class PowerPollster(_Base):
|
|||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
"""Returns all counters."""
|
"""Returns all counters."""
|
||||||
for probe in self._iter_probes(manager.keystone, cache):
|
for probe in self._iter_probes(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='power',
|
name='power',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='W',
|
unit='W',
|
||||||
volume=probe['w'],
|
volume=probe['w'],
|
||||||
user_id=None,
|
user_id=None,
|
||||||
|
@ -23,7 +23,7 @@ from __future__ import absolute_import
|
|||||||
import itertools
|
import itertools
|
||||||
import glanceclient
|
import glanceclient
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer import plugin
|
from ceilometer import plugin
|
||||||
|
|
||||||
@ -102,9 +102,9 @@ class ImagePollster(_Base):
|
|||||||
|
|
||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
for image in self._iter_images(manager.keystone, cache):
|
for image in self._iter_images(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='image',
|
name='image',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='image',
|
unit='image',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=None,
|
user_id=None,
|
||||||
@ -119,9 +119,9 @@ class ImageSizePollster(_Base):
|
|||||||
|
|
||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
for image in self._iter_images(manager.keystone, cache):
|
for image in self._iter_images(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='image.size',
|
name='image.size',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=image.size,
|
volume=image.size,
|
||||||
user_id=None,
|
user_id=None,
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import plugin
|
from ceilometer import plugin
|
||||||
|
|
||||||
OPTS = [
|
OPTS = [
|
||||||
@ -62,9 +62,9 @@ class ImageCRUDBase(ImageBase):
|
|||||||
|
|
||||||
class ImageCRUD(ImageCRUDBase):
|
class ImageCRUD(ImageCRUDBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name=message['event_type'],
|
name=message['event_type'],
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit='image',
|
unit='image',
|
||||||
volume=1,
|
volume=1,
|
||||||
resource_id=message['payload']['id'],
|
resource_id=message['payload']['id'],
|
||||||
@ -75,9 +75,9 @@ class ImageCRUD(ImageCRUDBase):
|
|||||||
|
|
||||||
class Image(ImageCRUDBase):
|
class Image(ImageCRUDBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='image',
|
name='image',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='image',
|
unit='image',
|
||||||
volume=1,
|
volume=1,
|
||||||
resource_id=message['payload']['id'],
|
resource_id=message['payload']['id'],
|
||||||
@ -88,9 +88,9 @@ class Image(ImageCRUDBase):
|
|||||||
|
|
||||||
class ImageSize(ImageCRUDBase):
|
class ImageSize(ImageCRUDBase):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='image.size',
|
name='image.size',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=message['payload']['size'],
|
volume=message['payload']['size'],
|
||||||
resource_id=message['payload']['id'],
|
resource_id=message['payload']['id'],
|
||||||
@ -108,9 +108,9 @@ class ImageDownload(ImageBase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='image.download',
|
name='image.download',
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=message['payload']['bytes_sent'],
|
volume=message['payload']['bytes_sent'],
|
||||||
resource_id=message['payload']['image_id'],
|
resource_id=message['payload']['image_id'],
|
||||||
@ -128,9 +128,9 @@ class ImageServe(ImageBase):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='image.serve',
|
name='image.serve',
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=message['payload']['bytes_sent'],
|
volume=message['payload']['bytes_sent'],
|
||||||
resource_id=message['payload']['image_id'],
|
resource_id=message['payload']['image_id'],
|
||||||
|
@ -23,7 +23,7 @@ from ceilometer.openstack.common import log
|
|||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
|
|
||||||
from ceilometer.central import plugin
|
from ceilometer.central import plugin
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import nova_client
|
from ceilometer import nova_client
|
||||||
|
|
||||||
|
|
||||||
@ -47,9 +47,9 @@ class FloatingIPPollster(plugin.CentralPollster):
|
|||||||
# attributes were used by Ceilometer, such as project id, host.
|
# attributes were used by Ceilometer, such as project id, host.
|
||||||
# In this fix, those attributes usage will be removed temporarily.
|
# In this fix, those attributes usage will be removed temporarily.
|
||||||
# And they will be back after fix the Nova bug 1174802.
|
# And they will be back after fix the Nova bug 1174802.
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='ip.floating',
|
name='ip.floating',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='ip',
|
unit='ip',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=None,
|
user_id=None,
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer import plugin
|
from ceilometer import plugin
|
||||||
|
|
||||||
@ -75,9 +75,9 @@ class NetworkNotificationBase(plugin.NotificationBase):
|
|||||||
counter_name = getattr(self, 'counter_name', self.resource_name)
|
counter_name = getattr(self, 'counter_name', self.resource_name)
|
||||||
unit_value = getattr(self, 'unit', self.resource_name)
|
unit_value = getattr(self, 'unit', self.resource_name)
|
||||||
|
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name=counter_name,
|
name=counter_name,
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit=unit_value,
|
unit=unit_value,
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=message['_context_user_id'],
|
user_id=message['_context_user_id'],
|
||||||
@ -87,10 +87,10 @@ class NetworkNotificationBase(plugin.NotificationBase):
|
|||||||
|
|
||||||
event_type_split = message['event_type'].split('.')
|
event_type_split = message['event_type'].split('.')
|
||||||
if len(event_type_split) > 2:
|
if len(event_type_split) > 2:
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name=counter_name
|
name=counter_name
|
||||||
+ "." + event_type_split[1],
|
+ "." + event_type_split[1],
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit=unit_value,
|
unit=unit_value,
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=message['_context_user_id'],
|
user_id=message['_context_user_id'],
|
||||||
|
@ -26,7 +26,7 @@ from stevedore import extension
|
|||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
|
|
||||||
cfg.CONF.import_opt('counter_source', 'ceilometer.counter')
|
cfg.CONF.import_opt('sample_source', 'ceilometer.sample')
|
||||||
|
|
||||||
|
|
||||||
_notification_manager = None
|
_notification_manager = None
|
||||||
@ -64,7 +64,7 @@ def _process_notification_for_ext(ext, context, notification):
|
|||||||
if notification['event_type'] in handler.get_event_types():
|
if notification['event_type'] in handler.get_event_types():
|
||||||
|
|
||||||
with _pipeline_manager.publisher(context,
|
with _pipeline_manager.publisher(context,
|
||||||
cfg.CONF.counter_source) as p:
|
cfg.CONF.sample_source) as p:
|
||||||
# FIXME(dhellmann): Spawn green thread?
|
# FIXME(dhellmann): Spawn green thread?
|
||||||
p(list(handler.process_notification(notification)))
|
p(list(handler.process_notification(notification)))
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ from oslo.config import cfg
|
|||||||
from swiftclient import client as swift
|
from swiftclient import client as swift
|
||||||
from keystoneclient import exceptions
|
from keystoneclient import exceptions
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common.gettextutils import _
|
from ceilometer.openstack.common.gettextutils import _
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
@ -91,9 +91,9 @@ class ObjectsPollster(_Base):
|
|||||||
|
|
||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
for tenant, account in self._iter_accounts(manager.keystone, cache):
|
for tenant, account in self._iter_accounts(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='storage.objects',
|
name='storage.objects',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
volume=int(account['x-account-object-count']),
|
volume=int(account['x-account-object-count']),
|
||||||
unit='object',
|
unit='object',
|
||||||
user_id=None,
|
user_id=None,
|
||||||
@ -110,9 +110,9 @@ class ObjectsSizePollster(_Base):
|
|||||||
|
|
||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
for tenant, account in self._iter_accounts(manager.keystone, cache):
|
for tenant, account in self._iter_accounts(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='storage.objects.size',
|
name='storage.objects.size',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
volume=int(account['x-account-bytes-used']),
|
volume=int(account['x-account-bytes-used']),
|
||||||
unit='B',
|
unit='B',
|
||||||
user_id=None,
|
user_id=None,
|
||||||
@ -129,9 +129,9 @@ class ObjectsContainersPollster(_Base):
|
|||||||
|
|
||||||
def get_counters(self, manager, cache):
|
def get_counters(self, manager, cache):
|
||||||
for tenant, account in self._iter_accounts(manager.keystone, cache):
|
for tenant, account in self._iter_accounts(manager.keystone, cache):
|
||||||
yield counter.Counter(
|
yield sample.Sample(
|
||||||
name='storage.objects.containers',
|
name='storage.objects.containers',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
volume=int(account['x-account-container-count']),
|
volume=int(account['x-account-container-count']),
|
||||||
unit='container',
|
unit='container',
|
||||||
user_id=None,
|
user_id=None,
|
||||||
|
@ -56,7 +56,7 @@ except ImportError:
|
|||||||
# Swift <= 1.7.5 ... module exists and has class.
|
# Swift <= 1.7.5 ... module exists and has class.
|
||||||
from swift.common.middleware.proxy_logging import InputProxy
|
from swift.common.middleware.proxy_logging import InputProxy
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import context
|
from ceilometer.openstack.common import context
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
@ -132,13 +132,13 @@ class CeilometerMiddleware(object):
|
|||||||
|
|
||||||
with pipeline.PublishContext(
|
with pipeline.PublishContext(
|
||||||
context.get_admin_context(),
|
context.get_admin_context(),
|
||||||
cfg.CONF.counter_source,
|
cfg.CONF.sample_source,
|
||||||
self.pipeline_manager.pipelines,
|
self.pipeline_manager.pipelines,
|
||||||
) as publisher:
|
) as publisher:
|
||||||
if bytes_received:
|
if bytes_received:
|
||||||
publisher([counter.Counter(
|
publisher([sample.Sample(
|
||||||
name='storage.objects.incoming.bytes',
|
name='storage.objects.incoming.bytes',
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=bytes_received,
|
volume=bytes_received,
|
||||||
user_id=env.get('HTTP_X_USER_ID'),
|
user_id=env.get('HTTP_X_USER_ID'),
|
||||||
@ -148,9 +148,9 @@ class CeilometerMiddleware(object):
|
|||||||
resource_metadata=resource_metadata)])
|
resource_metadata=resource_metadata)])
|
||||||
|
|
||||||
if bytes_sent:
|
if bytes_sent:
|
||||||
publisher([counter.Counter(
|
publisher([sample.Sample(
|
||||||
name='storage.objects.outgoing.bytes',
|
name='storage.objects.outgoing.bytes',
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit='B',
|
unit='B',
|
||||||
volume=bytes_sent,
|
volume=bytes_sent,
|
||||||
user_id=env.get('HTTP_X_USER_ID'),
|
user_id=env.get('HTTP_X_USER_ID'),
|
||||||
@ -162,9 +162,9 @@ class CeilometerMiddleware(object):
|
|||||||
# publish the event for each request
|
# publish the event for each request
|
||||||
# request method will be recorded in the metadata
|
# request method will be recorded in the metadata
|
||||||
resource_metadata['method'] = req.method.lower()
|
resource_metadata['method'] = req.method.lower()
|
||||||
publisher([counter.Counter(
|
publisher([sample.Sample(
|
||||||
name='storage.api.request',
|
name='storage.api.request',
|
||||||
type=counter.TYPE_DELTA,
|
type=sample.TYPE_DELTA,
|
||||||
unit='request',
|
unit='request',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=env.get('HTTP_X_USER_ID'),
|
user_id=env.get('HTTP_X_USER_ID'),
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""Counter class for holding data about a metering event.
|
"""Sample class for holding data about a metering event.
|
||||||
|
|
||||||
A Counter doesn't really do anything, but we need a way to
|
A Sample doesn't really do anything, but we need a way to
|
||||||
ensure that all of the appropriate fields have been filled
|
ensure that all of the appropriate fields have been filled
|
||||||
in by the plugins that create them.
|
in by the plugins that create them.
|
||||||
"""
|
"""
|
||||||
@ -29,9 +29,10 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
|
|
||||||
OPTS = [
|
OPTS = [
|
||||||
cfg.StrOpt('counter_source',
|
cfg.StrOpt('sample_source',
|
||||||
default='openstack',
|
default='openstack',
|
||||||
help='Source for counters emited on this instance'),
|
deprecated_name='counter_source',
|
||||||
|
help='Source for samples emited on this instance'),
|
||||||
]
|
]
|
||||||
|
|
||||||
cfg.CONF.register_opts(OPTS)
|
cfg.CONF.register_opts(OPTS)
|
||||||
@ -39,30 +40,30 @@ cfg.CONF.register_opts(OPTS)
|
|||||||
|
|
||||||
# Fields explanation:
|
# Fields explanation:
|
||||||
#
|
#
|
||||||
# Name: the name of the counter, must be unique
|
# Name: the name of the meter, must be unique
|
||||||
# Type: the type of the counter, must be either:
|
# Type: the type of the meter, must be either:
|
||||||
# - cumulative: the value is incremented and never reset to 0
|
# - cumulative: the value is incremented and never reset to 0
|
||||||
# - delta: the value is reset to 0 each time it is sent
|
# - delta: the value is reset to 0 each time it is sent
|
||||||
# - gauge: the value is an absolute value and is not a counter
|
# - gauge: the value is an absolute value and is not a counter
|
||||||
# Unit: the unit of the counter
|
# Unit: the unit of the meter
|
||||||
# Volume: the counter value
|
# Volume: the sample value
|
||||||
# User ID: the user ID
|
# User ID: the user ID
|
||||||
# Project ID: the project ID
|
# Project ID: the project ID
|
||||||
# Resource ID: the resource ID
|
# Resource ID: the resource ID
|
||||||
# Timestamp: when the counter has been read
|
# Timestamp: when the sample has been read
|
||||||
# Resource metadata: various metadata
|
# Resource metadata: various metadata
|
||||||
Counter = collections.namedtuple('Counter',
|
Sample = collections.namedtuple('Sample',
|
||||||
' '.join([
|
' '.join([
|
||||||
'name',
|
'name',
|
||||||
'type',
|
'type',
|
||||||
'unit',
|
'unit',
|
||||||
'volume',
|
'volume',
|
||||||
'user_id',
|
'user_id',
|
||||||
'project_id',
|
'project_id',
|
||||||
'resource_id',
|
'resource_id',
|
||||||
'timestamp',
|
'timestamp',
|
||||||
'resource_metadata',
|
'resource_metadata',
|
||||||
]))
|
]))
|
||||||
|
|
||||||
|
|
||||||
TYPE_GAUGE = 'gauge'
|
TYPE_GAUGE = 'gauge'
|
||||||
@ -87,4 +88,4 @@ def from_notification(cls, name, type, volume, unit,
|
|||||||
resource_metadata=metadata)
|
resource_metadata=metadata)
|
||||||
|
|
||||||
|
|
||||||
Counter.from_notification = classmethod(from_notification)
|
Sample.from_notification = classmethod(from_notification)
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from ceilometer import counter as ceilocounter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import log
|
from ceilometer.openstack.common import log
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer import transformer
|
from ceilometer import transformer
|
||||||
@ -81,7 +81,7 @@ class ScalingTransformer(transformer.TransformerBase):
|
|||||||
"""Transform the appropriate counter fields.
|
"""Transform the appropriate counter fields.
|
||||||
"""
|
"""
|
||||||
scale = self.target.get('scale')
|
scale = self.target.get('scale')
|
||||||
return ceilocounter.Counter(
|
return sample.Sample(
|
||||||
name=self.target.get('name', counter.name),
|
name=self.target.get('name', counter.name),
|
||||||
unit=self.target.get('unit', counter.unit),
|
unit=self.target.get('unit', counter.unit),
|
||||||
type=self.target.get('type', counter.type),
|
type=self.target.get('type', counter.type),
|
||||||
@ -132,7 +132,7 @@ class RateOfChangeTransformer(ScalingTransformer):
|
|||||||
# so that the current volume gives a lower bound on growth
|
# so that the current volume gives a lower bound on growth
|
||||||
volume_delta = (counter.volume - prev_volume
|
volume_delta = (counter.volume - prev_volume
|
||||||
if (prev_volume <= counter.volume or
|
if (prev_volume <= counter.volume or
|
||||||
counter.type != ceilocounter.TYPE_CUMULATIVE)
|
counter.type != sample.TYPE_CUMULATIVE)
|
||||||
else counter.volume)
|
else counter.volume)
|
||||||
rate_of_change = ((1.0 * volume_delta / time_delta)
|
rate_of_change = ((1.0 * volume_delta / time_delta)
|
||||||
if time_delta else 0.0)
|
if time_delta else 0.0)
|
||||||
|
@ -21,7 +21,7 @@ events.
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import plugin
|
from ceilometer import plugin
|
||||||
|
|
||||||
|
|
||||||
@ -59,9 +59,9 @@ class _Base(plugin.NotificationBase):
|
|||||||
|
|
||||||
class Volume(_Base):
|
class Volume(_Base):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='volume',
|
name='volume',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='volume',
|
unit='volume',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
@ -72,9 +72,9 @@ class Volume(_Base):
|
|||||||
|
|
||||||
class VolumeSize(_Base):
|
class VolumeSize(_Base):
|
||||||
def process_notification(self, message):
|
def process_notification(self, message):
|
||||||
yield counter.Counter.from_notification(
|
yield sample.Sample.from_notification(
|
||||||
name='volume.size',
|
name='volume.size',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
unit='GB',
|
unit='GB',
|
||||||
volume=message['payload']['size'],
|
volume=message['payload']['size'],
|
||||||
user_id=message['payload']['user_id'],
|
user_id=message['payload']['user_id'],
|
||||||
|
@ -1,13 +1,5 @@
|
|||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
|
|
||||||
#
|
|
||||||
# Options defined in ceilometer.counter
|
|
||||||
#
|
|
||||||
|
|
||||||
# Source for counters emited on this instance (string value)
|
|
||||||
#counter_source=openstack
|
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Options defined in ceilometer.pipeline
|
# Options defined in ceilometer.pipeline
|
||||||
#
|
#
|
||||||
@ -16,6 +8,14 @@
|
|||||||
#pipeline_cfg_file=pipeline.yaml
|
#pipeline_cfg_file=pipeline.yaml
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Options defined in ceilometer.sample
|
||||||
|
#
|
||||||
|
|
||||||
|
# Source for samples emited on this instance (string value)
|
||||||
|
#sample_source=openstack
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Options defined in ceilometer.api.app
|
# Options defined in ceilometer.api.app
|
||||||
#
|
#
|
||||||
|
@ -53,7 +53,7 @@ config.cfg.CONF.import_opt('compute_manager', 'nova.service')
|
|||||||
# nova's version of oslo to be used instead of ceilometer's.
|
# nova's version of oslo to be used instead of ceilometer's.
|
||||||
from ceilometer.compute import nova_notifier
|
from ceilometer.compute import nova_notifier
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
|
|
||||||
LOG = logging.getLogger(__name__)
|
LOG = logging.getLogger(__name__)
|
||||||
@ -64,9 +64,9 @@ class TestNovaNotifier(base.TestCase):
|
|||||||
|
|
||||||
class Pollster(object):
|
class Pollster(object):
|
||||||
instances = []
|
instances = []
|
||||||
test_data = counter.Counter(
|
test_data = sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='units-go-here',
|
unit='units-go-here',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -220,7 +220,7 @@ class TestNovaNotifier(base.TestCase):
|
|||||||
self.assertEqual(len(samples), 1)
|
self.assertEqual(len(samples), 1)
|
||||||
s = payload['samples'][0]
|
s = payload['samples'][0]
|
||||||
self.assertEqual(s, {'name': 'test',
|
self.assertEqual(s, {'name': 'test',
|
||||||
'type': counter.TYPE_CUMULATIVE,
|
'type': sample.TYPE_CUMULATIVE,
|
||||||
'unit': 'units-go-here',
|
'unit': 'units-go-here',
|
||||||
'volume': 1,
|
'volume': 1,
|
||||||
})
|
})
|
||||||
|
@ -26,15 +26,15 @@ import mock
|
|||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
from stevedore.tests import manager as extension_tests
|
from stevedore.tests import manager as extension_tests
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import pipeline
|
from ceilometer import pipeline
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
from ceilometer import transformer
|
from ceilometer import transformer
|
||||||
|
|
||||||
|
|
||||||
default_test_data = counter.Counter(
|
default_test_data = sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
|
@ -25,7 +25,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -39,7 +39,7 @@ class TestListEvents(tests_api.TestBase,
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestListEvents, self).setUp()
|
super(TestListEvents, self).setUp()
|
||||||
for cnt in [
|
for cnt in [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -51,7 +51,7 @@ class TestListEvents(tests_api.TestBase,
|
|||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}
|
'tag': 'self.counter'}
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -63,7 +63,7 @@ class TestListEvents(tests_api.TestBase,
|
|||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}
|
'tag': 'self.counter'}
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
|
@ -26,7 +26,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -51,7 +51,7 @@ class TestListMeters(tests_api.TestBase,
|
|||||||
super(TestListMeters, self).setUp()
|
super(TestListMeters, self).setUp()
|
||||||
|
|
||||||
for cnt in [
|
for cnt in [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -62,7 +62,7 @@ class TestListMeters(tests_api.TestBase,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}),
|
'tag': 'self.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -73,7 +73,7 @@ class TestListMeters(tests_api.TestBase,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 11, 40),
|
timestamp=datetime.datetime(2012, 7, 2, 11, 40),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}),
|
'tag': 'self.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.mine',
|
'meter.mine',
|
||||||
'gauge',
|
'gauge',
|
||||||
'',
|
'',
|
||||||
@ -84,7 +84,7 @@ class TestListMeters(tests_api.TestBase,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 41),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 41),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'two.counter'}),
|
'tag': 'two.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -95,7 +95,7 @@ class TestListMeters(tests_api.TestBase,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 42),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 42),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'three.counter'}),
|
'tag': 'three.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.mine',
|
'meter.mine',
|
||||||
'gauge',
|
'gauge',
|
||||||
'',
|
'',
|
||||||
|
@ -26,7 +26,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -49,7 +49,7 @@ class TestListProjects(tests_api.TestBase,
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestListProjects, self).setUp()
|
super(TestListProjects, self).setUp()
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'instance',
|
'instance',
|
||||||
@ -68,7 +68,7 @@ class TestListProjects(tests_api.TestBase,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'instance',
|
'instance',
|
||||||
|
@ -26,7 +26,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -51,7 +51,7 @@ class TestListResourcesBase(tests_api.TestBase,
|
|||||||
super(TestListResourcesBase, self).setUp()
|
super(TestListResourcesBase, self).setUp()
|
||||||
|
|
||||||
for cnt in [
|
for cnt in [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -63,7 +63,7 @@ class TestListResourcesBase(tests_api.TestBase,
|
|||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'},
|
'tag': 'self.counter'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -75,7 +75,7 @@ class TestListResourcesBase(tests_api.TestBase,
|
|||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter2'},
|
'tag': 'self.counter2'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -87,7 +87,7 @@ class TestListResourcesBase(tests_api.TestBase,
|
|||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter3'},
|
'tag': 'self.counter3'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
|
@ -26,7 +26,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -50,7 +50,7 @@ class TestListUsers(tests_api.TestBase,
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestListUsers, self).setUp()
|
super(TestListUsers, self).setUp()
|
||||||
|
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'instance',
|
'instance',
|
||||||
@ -70,7 +70,7 @@ class TestListUsers(tests_api.TestBase,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
|
@ -25,7 +25,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -41,7 +41,7 @@ class TestMaxProjectVolume(tests_api.TestBase,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
|
@ -24,7 +24,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -40,7 +40,7 @@ class TestMaxResourceVolume(tests_api.TestBase,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
|
@ -25,7 +25,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -41,7 +41,7 @@ class TestSumProjectVolume(tests_api.TestBase,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
|
@ -25,7 +25,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
from ceilometer.tests import api as tests_api
|
from ceilometer.tests import api as tests_api
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -41,7 +41,7 @@ class TestSumResourceVolume(tests_api.TestBase,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
|
@ -23,7 +23,7 @@ import testscenarios
|
|||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.api import acl
|
from ceilometer.api import acl
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
@ -83,7 +83,7 @@ class TestAPIACL(FunctionalTest,
|
|||||||
self.environ = {'fake.cache': FakeMemcache()}
|
self.environ = {'fake.cache': FakeMemcache()}
|
||||||
|
|
||||||
for cnt in [
|
for cnt in [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -94,7 +94,7 @@ class TestAPIACL(FunctionalTest,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}),
|
'tag': 'self.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.mine',
|
'meter.mine',
|
||||||
'gauge',
|
'gauge',
|
||||||
'',
|
'',
|
||||||
|
@ -26,7 +26,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
@ -41,7 +41,7 @@ class TestListEvents(FunctionalTest,
|
|||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestListEvents, self).setUp()
|
super(TestListEvents, self).setUp()
|
||||||
self.counter1 = counter.Counter(
|
self.counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -63,7 +63,7 @@ class TestListEvents(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
self.counter2 = counter.Counter(
|
self.counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
|
@ -25,7 +25,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
@ -50,7 +50,7 @@ class TestListMeters(FunctionalTest,
|
|||||||
super(TestListMeters, self).setUp()
|
super(TestListMeters, self).setUp()
|
||||||
|
|
||||||
for cnt in [
|
for cnt in [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -61,7 +61,7 @@ class TestListMeters(FunctionalTest,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 40),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}),
|
'tag': 'self.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -72,7 +72,7 @@ class TestListMeters(FunctionalTest,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 11, 40),
|
timestamp=datetime.datetime(2012, 7, 2, 11, 40),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter'}),
|
'tag': 'self.counter'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.mine',
|
'meter.mine',
|
||||||
'gauge',
|
'gauge',
|
||||||
'',
|
'',
|
||||||
@ -83,7 +83,7 @@ class TestListMeters(FunctionalTest,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 41),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 41),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter2'}),
|
'tag': 'self.counter2'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.test',
|
'meter.test',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -94,7 +94,7 @@ class TestListMeters(FunctionalTest,
|
|||||||
timestamp=datetime.datetime(2012, 7, 2, 10, 42),
|
timestamp=datetime.datetime(2012, 7, 2, 10, 42),
|
||||||
resource_metadata={'display_name': 'test-server',
|
resource_metadata={'display_name': 'test-server',
|
||||||
'tag': 'self.counter3'}),
|
'tag': 'self.counter3'}),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
'meter.mine',
|
'meter.mine',
|
||||||
'gauge',
|
'gauge',
|
||||||
'',
|
'',
|
||||||
|
@ -25,7 +25,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
@ -45,7 +45,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals([], data)
|
self.assertEquals([], data)
|
||||||
|
|
||||||
def test_instance_no_metadata(self):
|
def test_instance_no_metadata(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -67,7 +67,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(1, len(data))
|
self.assertEquals(1, len(data))
|
||||||
|
|
||||||
def test_instances(self):
|
def test_instances(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -87,7 +87,7 @@ class TestListResources(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -111,7 +111,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(2, len(data))
|
self.assertEquals(2, len(data))
|
||||||
|
|
||||||
def test_instances_one(self):
|
def test_instances_one(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -131,7 +131,7 @@ class TestListResources(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -155,7 +155,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals('resource-id', data['resource_id'])
|
self.assertEquals('resource-id', data['resource_id'])
|
||||||
|
|
||||||
def test_with_source(self):
|
def test_with_source(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -175,7 +175,7 @@ class TestListResources(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -202,7 +202,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(['resource-id'], ids)
|
self.assertEquals(['resource-id'], ids)
|
||||||
|
|
||||||
def test_with_invalid_resource_id(self):
|
def test_with_invalid_resource_id(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -222,7 +222,7 @@ class TestListResources(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -252,7 +252,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(resp3.status_code, 400)
|
self.assertEquals(resp3.status_code, 400)
|
||||||
|
|
||||||
def test_with_user(self):
|
def test_with_user(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -272,7 +272,7 @@ class TestListResources(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -299,7 +299,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(['resource-id'], ids)
|
self.assertEquals(['resource-id'], ids)
|
||||||
|
|
||||||
def test_with_project(self):
|
def test_with_project(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -319,7 +319,7 @@ class TestListResources(FunctionalTest,
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
counter2 = counter.Counter(
|
counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -346,7 +346,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(['resource-id'], ids)
|
self.assertEquals(['resource-id'], ids)
|
||||||
|
|
||||||
def test_with_user_non_admin(self):
|
def test_with_user_non_admin(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -373,7 +373,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(set(['resource-id-alternate']), ids)
|
self.assertEquals(set(['resource-id-alternate']), ids)
|
||||||
|
|
||||||
def test_with_user_wrong_tenant(self):
|
def test_with_user_wrong_tenant(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -400,7 +400,7 @@ class TestListResources(FunctionalTest,
|
|||||||
self.assertEquals(set(), ids)
|
self.assertEquals(set(), ids)
|
||||||
|
|
||||||
def test_metadata(self):
|
def test_metadata(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
@ -431,7 +431,7 @@ class TestListResources(FunctionalTest,
|
|||||||
])
|
])
|
||||||
|
|
||||||
def test_resource_meter_links(self):
|
def test_resource_meter_links(self):
|
||||||
counter1 = counter.Counter(
|
counter1 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
'cumulative',
|
'cumulative',
|
||||||
'',
|
'',
|
||||||
|
@ -23,7 +23,7 @@ import testscenarios
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer.tests import db as tests_db
|
from ceilometer.tests import db as tests_db
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ class TestMaxProjectVolume(base.FunctionalTest,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
@ -141,7 +141,7 @@ class TestMaxResourceVolume(base.FunctionalTest,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
@ -258,7 +258,7 @@ class TestSumProjectVolume(base.FunctionalTest,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
@ -361,7 +361,7 @@ class TestSumResourceVolume(base.FunctionalTest,
|
|||||||
|
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
|
@ -28,7 +28,7 @@ from oslo.config import cfg
|
|||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
from stevedore.tests import manager as test_manager
|
from stevedore.tests import manager as test_manager
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer.collector import service
|
from ceilometer.collector import service
|
||||||
from ceilometer.storage import base
|
from ceilometer.storage import base
|
||||||
@ -115,7 +115,7 @@ class TestUDPCollectorService(TestCollector):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestUDPCollectorService, self).setUp()
|
super(TestUDPCollectorService, self).setUp()
|
||||||
self.srv = service.UDPCollectorService()
|
self.srv = service.UDPCollectorService()
|
||||||
self.counter = dict(counter.Counter(
|
self.counter = dict(sample.Sample(
|
||||||
name='foobar',
|
name='foobar',
|
||||||
type='bad',
|
type='bad',
|
||||||
unit='F',
|
unit='F',
|
||||||
|
@ -23,7 +23,7 @@ notification events.
|
|||||||
|
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
from ceilometer.compute import notifications
|
from ceilometer.compute import notifications
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
|
|
||||||
|
|
||||||
INSTANCE_CREATE_END = {
|
INSTANCE_CREATE_END = {
|
||||||
@ -406,7 +406,7 @@ class TestNotifications(base.TestCase):
|
|||||||
))[0]
|
))[0]
|
||||||
for name, actual, expected in [
|
for name, actual, expected in [
|
||||||
('counter_name', info.name, 'instance'),
|
('counter_name', info.name, 'instance'),
|
||||||
('counter_type', info.type, counter.TYPE_GAUGE),
|
('counter_type', info.type, sample.TYPE_GAUGE),
|
||||||
('counter_volume', info.volume, 1),
|
('counter_volume', info.volume, 1),
|
||||||
('timestamp', info.timestamp,
|
('timestamp', info.timestamp,
|
||||||
INSTANCE_CREATE_END['timestamp']),
|
INSTANCE_CREATE_END['timestamp']),
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from ceilometer.image import notifications
|
from ceilometer.image import notifications
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
|
|
||||||
|
|
||||||
@ -108,7 +108,7 @@ class TestNotification(base.TestCase):
|
|||||||
self._verify_common_counter(download, 'image.download', 42)
|
self._verify_common_counter(download, 'image.download', 42)
|
||||||
self.assertEqual(download.user_id, fake_uuid('d'))
|
self.assertEqual(download.user_id, fake_uuid('d'))
|
||||||
self.assertEqual(download.project_id, fake_uuid('b'))
|
self.assertEqual(download.project_id, fake_uuid('b'))
|
||||||
self.assertEqual(download.type, counter.TYPE_DELTA)
|
self.assertEqual(download.type, sample.TYPE_DELTA)
|
||||||
|
|
||||||
def test_image_serve(self):
|
def test_image_serve(self):
|
||||||
handler = notifications.ImageServe()
|
handler = notifications.ImageServe()
|
||||||
@ -121,7 +121,7 @@ class TestNotification(base.TestCase):
|
|||||||
fake_uuid('d'))
|
fake_uuid('d'))
|
||||||
self.assertEquals(serve.resource_metadata.get('receiver_tenant_id'),
|
self.assertEquals(serve.resource_metadata.get('receiver_tenant_id'),
|
||||||
fake_uuid('b'))
|
fake_uuid('b'))
|
||||||
self.assertEqual(serve.type, counter.TYPE_DELTA)
|
self.assertEqual(serve.type, sample.TYPE_DELTA)
|
||||||
|
|
||||||
def test_image_crud_on_update(self):
|
def test_image_crud_on_update(self):
|
||||||
handler = notifications.ImageCRUD()
|
handler = notifications.ImageCRUD()
|
||||||
@ -129,7 +129,7 @@ class TestNotification(base.TestCase):
|
|||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
update = counters[0]
|
update = counters[0]
|
||||||
self._verify_common_counter(update, 'image.update', 1)
|
self._verify_common_counter(update, 'image.update', 1)
|
||||||
self.assertEqual(update.type, counter.TYPE_DELTA)
|
self.assertEqual(update.type, sample.TYPE_DELTA)
|
||||||
|
|
||||||
def test_image_on_update(self):
|
def test_image_on_update(self):
|
||||||
handler = notifications.Image()
|
handler = notifications.Image()
|
||||||
@ -137,7 +137,7 @@ class TestNotification(base.TestCase):
|
|||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
update = counters[0]
|
update = counters[0]
|
||||||
self._verify_common_counter(update, 'image', 1)
|
self._verify_common_counter(update, 'image', 1)
|
||||||
self.assertEqual(update.type, counter.TYPE_GAUGE)
|
self.assertEqual(update.type, sample.TYPE_GAUGE)
|
||||||
|
|
||||||
def test_image_size_on_update(self):
|
def test_image_size_on_update(self):
|
||||||
handler = notifications.ImageSize()
|
handler = notifications.ImageSize()
|
||||||
@ -146,7 +146,7 @@ class TestNotification(base.TestCase):
|
|||||||
update = counters[0]
|
update = counters[0]
|
||||||
self._verify_common_counter(update, 'image.size',
|
self._verify_common_counter(update, 'image.size',
|
||||||
IMAGE_META['size'])
|
IMAGE_META['size'])
|
||||||
self.assertEqual(update.type, counter.TYPE_GAUGE)
|
self.assertEqual(update.type, sample.TYPE_GAUGE)
|
||||||
|
|
||||||
def test_image_crud_on_upload(self):
|
def test_image_crud_on_upload(self):
|
||||||
handler = notifications.ImageCRUD()
|
handler = notifications.ImageCRUD()
|
||||||
@ -154,7 +154,7 @@ class TestNotification(base.TestCase):
|
|||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
upload = counters[0]
|
upload = counters[0]
|
||||||
self._verify_common_counter(upload, 'image.upload', 1)
|
self._verify_common_counter(upload, 'image.upload', 1)
|
||||||
self.assertEqual(upload.type, counter.TYPE_DELTA)
|
self.assertEqual(upload.type, sample.TYPE_DELTA)
|
||||||
|
|
||||||
def test_image_on_upload(self):
|
def test_image_on_upload(self):
|
||||||
handler = notifications.Image()
|
handler = notifications.Image()
|
||||||
@ -162,7 +162,7 @@ class TestNotification(base.TestCase):
|
|||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
upload = counters[0]
|
upload = counters[0]
|
||||||
self._verify_common_counter(upload, 'image', 1)
|
self._verify_common_counter(upload, 'image', 1)
|
||||||
self.assertEqual(upload.type, counter.TYPE_GAUGE)
|
self.assertEqual(upload.type, sample.TYPE_GAUGE)
|
||||||
|
|
||||||
def test_image_size_on_upload(self):
|
def test_image_size_on_upload(self):
|
||||||
handler = notifications.ImageSize()
|
handler = notifications.ImageSize()
|
||||||
@ -171,7 +171,7 @@ class TestNotification(base.TestCase):
|
|||||||
upload = counters[0]
|
upload = counters[0]
|
||||||
self._verify_common_counter(upload, 'image.size',
|
self._verify_common_counter(upload, 'image.size',
|
||||||
IMAGE_META['size'])
|
IMAGE_META['size'])
|
||||||
self.assertEqual(upload.type, counter.TYPE_GAUGE)
|
self.assertEqual(upload.type, sample.TYPE_GAUGE)
|
||||||
|
|
||||||
def test_image_crud_on_delete(self):
|
def test_image_crud_on_delete(self):
|
||||||
handler = notifications.ImageCRUD()
|
handler = notifications.ImageCRUD()
|
||||||
@ -179,7 +179,7 @@ class TestNotification(base.TestCase):
|
|||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
delete = counters[0]
|
delete = counters[0]
|
||||||
self._verify_common_counter(delete, 'image.delete', 1)
|
self._verify_common_counter(delete, 'image.delete', 1)
|
||||||
self.assertEqual(delete.type, counter.TYPE_DELTA)
|
self.assertEqual(delete.type, sample.TYPE_DELTA)
|
||||||
|
|
||||||
def test_image_on_delete(self):
|
def test_image_on_delete(self):
|
||||||
handler = notifications.Image()
|
handler = notifications.Image()
|
||||||
@ -187,7 +187,7 @@ class TestNotification(base.TestCase):
|
|||||||
self.assertEqual(len(counters), 1)
|
self.assertEqual(len(counters), 1)
|
||||||
delete = counters[0]
|
delete = counters[0]
|
||||||
self._verify_common_counter(delete, 'image', 1)
|
self._verify_common_counter(delete, 'image', 1)
|
||||||
self.assertEqual(delete.type, counter.TYPE_GAUGE)
|
self.assertEqual(delete.type, sample.TYPE_GAUGE)
|
||||||
|
|
||||||
def test_image_size_on_delete(self):
|
def test_image_size_on_delete(self):
|
||||||
handler = notifications.ImageSize()
|
handler = notifications.ImageSize()
|
||||||
@ -196,4 +196,4 @@ class TestNotification(base.TestCase):
|
|||||||
delete = counters[0]
|
delete = counters[0]
|
||||||
self._verify_common_counter(delete, 'image.size',
|
self._verify_common_counter(delete, 'image.size',
|
||||||
IMAGE_META['size'])
|
IMAGE_META['size'])
|
||||||
self.assertEqual(delete.type, counter.TYPE_GAUGE)
|
self.assertEqual(delete.type, sample.TYPE_GAUGE)
|
||||||
|
@ -22,7 +22,7 @@ import datetime
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import logging.handlers
|
import logging.handlers
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.publisher import file
|
from ceilometer.publisher import file
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
from ceilometer.openstack.common.network_utils import urlsplit
|
from ceilometer.openstack.common.network_utils import urlsplit
|
||||||
@ -31,9 +31,9 @@ from ceilometer.openstack.common.network_utils import urlsplit
|
|||||||
class TestFilePublisher(base.TestCase):
|
class TestFilePublisher(base.TestCase):
|
||||||
|
|
||||||
test_data = [
|
test_data = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -42,9 +42,9 @@ class TestFilePublisher(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test2',
|
name='test2',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -53,9 +53,9 @@ class TestFilePublisher(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test2',
|
name='test2',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.openstack.common import jsonutils
|
from ceilometer.openstack.common import jsonutils
|
||||||
from ceilometer.openstack.common import network_utils
|
from ceilometer.openstack.common import network_utils
|
||||||
from ceilometer.openstack.common import rpc as oslo_rpc
|
from ceilometer.openstack.common import rpc as oslo_rpc
|
||||||
@ -111,16 +111,15 @@ class TestSignature(base.TestCase):
|
|||||||
|
|
||||||
class TestCounter(base.TestCase):
|
class TestCounter(base.TestCase):
|
||||||
|
|
||||||
TEST_COUNTER = counter.Counter(name='name',
|
TEST_COUNTER = sample.Sample(name='name',
|
||||||
type='typ',
|
type='typ',
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='user',
|
user_id='user',
|
||||||
project_id='project',
|
project_id='project',
|
||||||
resource_id=2,
|
resource_id=2,
|
||||||
timestamp='today',
|
timestamp='today',
|
||||||
resource_metadata={'key': 'value'},
|
resource_metadata={'key': 'value'})
|
||||||
)
|
|
||||||
|
|
||||||
def test_meter_message_from_counter_signed(self):
|
def test_meter_message_from_counter_signed(self):
|
||||||
msg = rpc.meter_message_from_counter(self.TEST_COUNTER,
|
msg = rpc.meter_message_from_counter(self.TEST_COUNTER,
|
||||||
@ -146,9 +145,9 @@ class TestCounter(base.TestCase):
|
|||||||
class TestPublish(base.TestCase):
|
class TestPublish(base.TestCase):
|
||||||
|
|
||||||
test_data = [
|
test_data = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -157,9 +156,9 @@ class TestPublish(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -168,9 +167,9 @@ class TestPublish(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test2',
|
name='test2',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -179,9 +178,9 @@ class TestPublish(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test2',
|
name='test2',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -190,9 +189,9 @@ class TestPublish(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test3',
|
name='test3',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
|
@ -23,7 +23,7 @@ import mock
|
|||||||
import msgpack
|
import msgpack
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.publisher import udp
|
from ceilometer.publisher import udp
|
||||||
from ceilometer.tests import base
|
from ceilometer.tests import base
|
||||||
from ceilometer.openstack.common import network_utils
|
from ceilometer.openstack.common import network_utils
|
||||||
@ -32,9 +32,9 @@ from ceilometer.openstack.common import network_utils
|
|||||||
class TestUDPPublisher(base.TestCase):
|
class TestUDPPublisher(base.TestCase):
|
||||||
|
|
||||||
test_data = [
|
test_data = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -43,9 +43,9 @@ class TestUDPPublisher(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test',
|
name='test',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -54,9 +54,9 @@ class TestUDPPublisher(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test2',
|
name='test2',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -65,9 +65,9 @@ class TestUDPPublisher(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test2',
|
name='test2',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
@ -76,9 +76,9 @@ class TestUDPPublisher(base.TestCase):
|
|||||||
timestamp=datetime.datetime.utcnow().isoformat(),
|
timestamp=datetime.datetime.utcnow().isoformat(),
|
||||||
resource_metadata={'name': 'TestPublish'},
|
resource_metadata={'name': 'TestPublish'},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='test3',
|
name='test3',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='test',
|
user_id='test',
|
||||||
|
@ -27,7 +27,7 @@ from oslo.config import cfg
|
|||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.tests import db as test_db
|
from ceilometer.tests import db as test_db
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
@ -58,9 +58,9 @@ class DBTestBase(test_db.TestBase):
|
|||||||
timestamps_for_test_samples_default_order)
|
timestamps_for_test_samples_default_order)
|
||||||
|
|
||||||
self.msgs = []
|
self.msgs = []
|
||||||
self.counter = counter.Counter(
|
self.counter = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='user-id',
|
user_id='user-id',
|
||||||
@ -79,9 +79,9 @@ class DBTestBase(test_db.TestBase):
|
|||||||
self.conn.record_metering_data(self.msg1)
|
self.conn.record_metering_data(self.msg1)
|
||||||
self.msgs.append(self.msg1)
|
self.msgs.append(self.msg1)
|
||||||
|
|
||||||
self.counter2 = counter.Counter(
|
self.counter2 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='user-id',
|
user_id='user-id',
|
||||||
@ -100,9 +100,9 @@ class DBTestBase(test_db.TestBase):
|
|||||||
self.conn.record_metering_data(self.msg2)
|
self.conn.record_metering_data(self.msg2)
|
||||||
self.msgs.append(self.msg2)
|
self.msgs.append(self.msg2)
|
||||||
|
|
||||||
self.counter3 = counter.Counter(
|
self.counter3 = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='user-id-alternate',
|
user_id='user-id-alternate',
|
||||||
@ -126,9 +126,9 @@ class DBTestBase(test_db.TestBase):
|
|||||||
|
|
||||||
for i, ts in zip(range(start_idx - 1, end_idx - 1),
|
for i, ts in zip(range(start_idx - 1, end_idx - 1),
|
||||||
timestamp_list[start_idx:end_idx]):
|
timestamp_list[start_idx:end_idx]):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'instance',
|
'instance',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1,
|
volume=1,
|
||||||
user_id='user-id-%s' % i,
|
user_id='user-id-%s' % i,
|
||||||
@ -547,7 +547,7 @@ class StatisticsTest(DBTestBase):
|
|||||||
def prepare_data(self):
|
def prepare_data(self):
|
||||||
self.counters = []
|
self.counters = []
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
@ -568,7 +568,7 @@ class StatisticsTest(DBTestBase):
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
for i in range(3):
|
for i in range(3):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
@ -754,9 +754,9 @@ class StatisticsTest(DBTestBase):
|
|||||||
class CounterDataTypeTest(DBTestBase):
|
class CounterDataTypeTest(DBTestBase):
|
||||||
|
|
||||||
def prepare_data(self):
|
def prepare_data(self):
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'dummyBigCounter',
|
'dummyBigCounter',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=3372036854775807,
|
volume=3372036854775807,
|
||||||
user_id='user-id',
|
user_id='user-id',
|
||||||
@ -773,9 +773,9 @@ class CounterDataTypeTest(DBTestBase):
|
|||||||
|
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'dummySmallCounter',
|
'dummySmallCounter',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=-3372036854775807,
|
volume=-3372036854775807,
|
||||||
user_id='user-id',
|
user_id='user-id',
|
||||||
@ -791,9 +791,9 @@ class CounterDataTypeTest(DBTestBase):
|
|||||||
)
|
)
|
||||||
self.conn.record_metering_data(msg)
|
self.conn.record_metering_data(msg)
|
||||||
|
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'floatCounter',
|
'floatCounter',
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
unit='',
|
unit='',
|
||||||
volume=1938495037.53697,
|
volume=1938495037.53697,
|
||||||
user_id='user-id',
|
user_id='user-id',
|
||||||
|
@ -33,7 +33,7 @@ from oslo.config import cfg
|
|||||||
from tests.storage import base
|
from tests.storage import base
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer.storage import impl_mongodb
|
from ceilometer.storage import impl_mongodb
|
||||||
from ceilometer.storage import models
|
from ceilometer.storage import models
|
||||||
|
|
||||||
@ -223,7 +223,7 @@ class CompatibilityTest(MongoDBEngineTestBase):
|
|||||||
'record_metering_data',
|
'record_metering_data',
|
||||||
old_record_metering_data)
|
old_record_metering_data)
|
||||||
self.counters = []
|
self.counters = []
|
||||||
c = counter.Counter(
|
c = sample.Sample(
|
||||||
'volume.size',
|
'volume.size',
|
||||||
'gauge',
|
'gauge',
|
||||||
'GiB',
|
'GiB',
|
||||||
|
@ -21,7 +21,7 @@ import datetime
|
|||||||
|
|
||||||
from stevedore import extension
|
from stevedore import extension
|
||||||
|
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import publisher
|
from ceilometer import publisher
|
||||||
from ceilometer.publisher import test as test_publisher
|
from ceilometer.publisher import test as test_publisher
|
||||||
from ceilometer import transformer
|
from ceilometer import transformer
|
||||||
@ -101,9 +101,9 @@ class TestPipeline(base.TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestPipeline, self).setUp()
|
super(TestPipeline, self).setUp()
|
||||||
|
|
||||||
self.test_counter = counter.Counter(
|
self.test_counter = sample.Sample(
|
||||||
name='a',
|
name='a',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
volume=1,
|
volume=1,
|
||||||
unit='B',
|
unit='B',
|
||||||
user_id="test_user",
|
user_id="test_user",
|
||||||
@ -653,9 +653,9 @@ class TestPipeline(base.TestCase):
|
|||||||
]
|
]
|
||||||
self.pipeline_cfg[0]['counters'] = ['cpu']
|
self.pipeline_cfg[0]['counters'] = ['cpu']
|
||||||
counters = [
|
counters = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
volume=1200000000,
|
volume=1200000000,
|
||||||
unit='ns',
|
unit='ns',
|
||||||
user_id='test_user',
|
user_id='test_user',
|
||||||
@ -678,7 +678,7 @@ class TestPipeline(base.TestCase):
|
|||||||
cpu_mins = publisher.counters[-1]
|
cpu_mins = publisher.counters[-1]
|
||||||
self.assertEquals(getattr(cpu_mins, 'name'), 'cpu_mins')
|
self.assertEquals(getattr(cpu_mins, 'name'), 'cpu_mins')
|
||||||
self.assertEquals(getattr(cpu_mins, 'unit'), 'min')
|
self.assertEquals(getattr(cpu_mins, 'unit'), 'min')
|
||||||
self.assertEquals(getattr(cpu_mins, 'type'), counter.TYPE_CUMULATIVE)
|
self.assertEquals(getattr(cpu_mins, 'type'), sample.TYPE_CUMULATIVE)
|
||||||
self.assertEquals(getattr(cpu_mins, 'volume'), 20)
|
self.assertEquals(getattr(cpu_mins, 'volume'), 20)
|
||||||
|
|
||||||
def test_unit_identified_source_unit_conversion(self):
|
def test_unit_identified_source_unit_conversion(self):
|
||||||
@ -695,9 +695,9 @@ class TestPipeline(base.TestCase):
|
|||||||
self.pipeline_cfg[0]['counters'] = ['core_temperature',
|
self.pipeline_cfg[0]['counters'] = ['core_temperature',
|
||||||
'ambient_temperature']
|
'ambient_temperature']
|
||||||
counters = [
|
counters = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='core_temperature',
|
name='core_temperature',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
volume=36.0,
|
volume=36.0,
|
||||||
unit='°C',
|
unit='°C',
|
||||||
user_id='test_user',
|
user_id='test_user',
|
||||||
@ -706,9 +706,9 @@ class TestPipeline(base.TestCase):
|
|||||||
timestamp=timeutils.utcnow().isoformat(),
|
timestamp=timeutils.utcnow().isoformat(),
|
||||||
resource_metadata={}
|
resource_metadata={}
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='ambient_temperature',
|
name='ambient_temperature',
|
||||||
type=counter.TYPE_GAUGE,
|
type=sample.TYPE_GAUGE,
|
||||||
volume=88.8,
|
volume=88.8,
|
||||||
unit='°F',
|
unit='°F',
|
||||||
user_id='test_user',
|
user_id='test_user',
|
||||||
@ -748,7 +748,7 @@ class TestPipeline(base.TestCase):
|
|||||||
'source': {},
|
'source': {},
|
||||||
'target': {'name': 'cpu_util',
|
'target': {'name': 'cpu_util',
|
||||||
'unit': '%',
|
'unit': '%',
|
||||||
'type': counter.TYPE_GAUGE,
|
'type': sample.TYPE_GAUGE,
|
||||||
'scale': s},
|
'scale': s},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -758,7 +758,7 @@ class TestPipeline(base.TestCase):
|
|||||||
later = now + datetime.timedelta(minutes=offset)
|
later = now + datetime.timedelta(minutes=offset)
|
||||||
um = {'autoscaling_weight': weight} if weight else {}
|
um = {'autoscaling_weight': weight} if weight else {}
|
||||||
counters = [
|
counters = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=type,
|
type=type,
|
||||||
volume=prev,
|
volume=prev,
|
||||||
@ -770,7 +770,7 @@ class TestPipeline(base.TestCase):
|
|||||||
resource_metadata={'cpu_number': 4,
|
resource_metadata={'cpu_number': 4,
|
||||||
'user_metadata': um},
|
'user_metadata': um},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=type,
|
type=type,
|
||||||
volume=prev,
|
volume=prev,
|
||||||
@ -782,7 +782,7 @@ class TestPipeline(base.TestCase):
|
|||||||
resource_metadata={'cpu_number': 2,
|
resource_metadata={'cpu_number': 2,
|
||||||
'user_metadata': um},
|
'user_metadata': um},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=type,
|
type=type,
|
||||||
volume=curr,
|
volume=curr,
|
||||||
@ -794,7 +794,7 @@ class TestPipeline(base.TestCase):
|
|||||||
resource_metadata={'cpu_number': 4,
|
resource_metadata={'cpu_number': 4,
|
||||||
'user_metadata': um},
|
'user_metadata': um},
|
||||||
),
|
),
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=type,
|
type=type,
|
||||||
volume=curr,
|
volume=curr,
|
||||||
@ -821,44 +821,44 @@ class TestPipeline(base.TestCase):
|
|||||||
self.assertEquals(getattr(cpu_util, 'name'), 'cpu_util')
|
self.assertEquals(getattr(cpu_util, 'name'), 'cpu_util')
|
||||||
self.assertEquals(getattr(cpu_util, 'resource_id'), 'test_resource')
|
self.assertEquals(getattr(cpu_util, 'resource_id'), 'test_resource')
|
||||||
self.assertEquals(getattr(cpu_util, 'unit'), '%')
|
self.assertEquals(getattr(cpu_util, 'unit'), '%')
|
||||||
self.assertEquals(getattr(cpu_util, 'type'), counter.TYPE_GAUGE)
|
self.assertEquals(getattr(cpu_util, 'type'), sample.TYPE_GAUGE)
|
||||||
self.assertEquals(getattr(cpu_util, 'volume'), expected)
|
self.assertEquals(getattr(cpu_util, 'volume'), expected)
|
||||||
cpu_util = publisher.counters[1]
|
cpu_util = publisher.counters[1]
|
||||||
self.assertEquals(getattr(cpu_util, 'name'), 'cpu_util')
|
self.assertEquals(getattr(cpu_util, 'name'), 'cpu_util')
|
||||||
self.assertEquals(getattr(cpu_util, 'resource_id'), 'test_resource2')
|
self.assertEquals(getattr(cpu_util, 'resource_id'), 'test_resource2')
|
||||||
self.assertEquals(getattr(cpu_util, 'unit'), '%')
|
self.assertEquals(getattr(cpu_util, 'unit'), '%')
|
||||||
self.assertEquals(getattr(cpu_util, 'type'), counter.TYPE_GAUGE)
|
self.assertEquals(getattr(cpu_util, 'type'), sample.TYPE_GAUGE)
|
||||||
self.assertEquals(getattr(cpu_util, 'volume'), expected * 2)
|
self.assertEquals(getattr(cpu_util, 'volume'), expected * 2)
|
||||||
|
|
||||||
def test_rate_of_change_conversion(self):
|
def test_rate_of_change_conversion(self):
|
||||||
self._do_test_rate_of_change_conversion(120000000000,
|
self._do_test_rate_of_change_conversion(120000000000,
|
||||||
180000000000,
|
180000000000,
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
25.0)
|
25.0)
|
||||||
|
|
||||||
def test_rate_of_change_conversion_weight(self):
|
def test_rate_of_change_conversion_weight(self):
|
||||||
self._do_test_rate_of_change_conversion(120000000000,
|
self._do_test_rate_of_change_conversion(120000000000,
|
||||||
180000000000,
|
180000000000,
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
27.5,
|
27.5,
|
||||||
weight=1.1)
|
weight=1.1)
|
||||||
|
|
||||||
def test_rate_of_change_conversion_negative_cumulative_delta(self):
|
def test_rate_of_change_conversion_negative_cumulative_delta(self):
|
||||||
self._do_test_rate_of_change_conversion(180000000000,
|
self._do_test_rate_of_change_conversion(180000000000,
|
||||||
120000000000,
|
120000000000,
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
50.0)
|
50.0)
|
||||||
|
|
||||||
def test_rate_of_change_conversion_negative_gauge_delta(self):
|
def test_rate_of_change_conversion_negative_gauge_delta(self):
|
||||||
self._do_test_rate_of_change_conversion(180000000000,
|
self._do_test_rate_of_change_conversion(180000000000,
|
||||||
120000000000,
|
120000000000,
|
||||||
counter.TYPE_GAUGE,
|
sample.TYPE_GAUGE,
|
||||||
-25.0)
|
-25.0)
|
||||||
|
|
||||||
def test_rate_of_change_conversion_zero_delay(self):
|
def test_rate_of_change_conversion_zero_delay(self):
|
||||||
self._do_test_rate_of_change_conversion(120000000000,
|
self._do_test_rate_of_change_conversion(120000000000,
|
||||||
120000000000,
|
120000000000,
|
||||||
counter.TYPE_CUMULATIVE,
|
sample.TYPE_CUMULATIVE,
|
||||||
0.0,
|
0.0,
|
||||||
offset=0)
|
offset=0)
|
||||||
|
|
||||||
@ -871,7 +871,7 @@ class TestPipeline(base.TestCase):
|
|||||||
'source': {},
|
'source': {},
|
||||||
'target': {'name': 'cpu_util',
|
'target': {'name': 'cpu_util',
|
||||||
'unit': '%',
|
'unit': '%',
|
||||||
'type': counter.TYPE_GAUGE,
|
'type': sample.TYPE_GAUGE,
|
||||||
'scale': s}
|
'scale': s}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -879,9 +879,9 @@ class TestPipeline(base.TestCase):
|
|||||||
self.pipeline_cfg[0]['counters'] = ['cpu']
|
self.pipeline_cfg[0]['counters'] = ['cpu']
|
||||||
now = timeutils.utcnow()
|
now = timeutils.utcnow()
|
||||||
counters = [
|
counters = [
|
||||||
counter.Counter(
|
sample.Sample(
|
||||||
name='cpu',
|
name='cpu',
|
||||||
type=counter.TYPE_CUMULATIVE,
|
type=sample.TYPE_CUMULATIVE,
|
||||||
volume=120000000000,
|
volume=120000000000,
|
||||||
unit='ns',
|
unit='ns',
|
||||||
user_id='test_user',
|
user_id='test_user',
|
||||||
|
@ -28,7 +28,7 @@ import sys
|
|||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
|
|
||||||
from ceilometer.publisher import rpc
|
from ceilometer.publisher import rpc
|
||||||
from ceilometer import counter
|
from ceilometer import sample
|
||||||
from ceilometer import storage
|
from ceilometer import storage
|
||||||
from ceilometer.openstack.common import timeutils
|
from ceilometer.openstack.common import timeutils
|
||||||
|
|
||||||
@ -119,7 +119,7 @@ def main():
|
|||||||
# Generate events
|
# Generate events
|
||||||
n = 0
|
n = 0
|
||||||
while timestamp <= end:
|
while timestamp <= end:
|
||||||
c = counter.Counter(name=args.counter,
|
c = sample.Sample(name=args.counter,
|
||||||
type=args.type,
|
type=args.type,
|
||||||
unit=args.unit,
|
unit=args.unit,
|
||||||
volume=args.volume,
|
volume=args.volume,
|
||||||
|
Loading…
Reference in New Issue
Block a user