From 1cf7101637cb1c7108531aebaa0abb543fcd1ce2 Mon Sep 17 00:00:00 2001 From: Pradeep Kilambi Date: Tue, 10 Jun 2014 07:51:44 -0700 Subject: [PATCH] Fix the meter type for LB Bytes This fixes the type on bytes in/out to cumulative. Eventually when connections are fixed in LBaaS side, those would be cumulative too. Also update the measurement docs to reflect the newest changes. Closes-Bug: 1328573 Change-Id: Iab221829702ab36a844d0ae65c6a3312a311a92b --- ceilometer/network/services/lbaas.py | 4 ++-- .../tests/network/services/test_lbaas.py | 17 ++++++++----- doc/source/measurements.rst | 24 +++++++++---------- 3 files changed, 25 insertions(+), 20 deletions(-) diff --git a/ceilometer/network/services/lbaas.py b/ceilometer/network/services/lbaas.py index 96f1b688a..739a8dc44 100644 --- a/ceilometer/network/services/lbaas.py +++ b/ceilometer/network/services/lbaas.py @@ -308,7 +308,7 @@ class LBBytesInPollster(_LBStatsPollster): return make_sample_from_pool( pool, name='network.services.lb.incoming.bytes', - type=sample.TYPE_GAUGE, + type=sample.TYPE_CUMULATIVE, unit='B', volume=data.bytes_in, ) @@ -323,7 +323,7 @@ class LBBytesOutPollster(_LBStatsPollster): return make_sample_from_pool( pool, name='network.services.lb.outgoing.bytes', - type=sample.TYPE_GAUGE, + type=sample.TYPE_CUMULATIVE, unit='B', volume=data.bytes_out, ) diff --git a/ceilometer/tests/network/services/test_lbaas.py b/ceilometer/tests/network/services/test_lbaas.py index c0e0be990..15ef1002b 100644 --- a/ceilometer/tests/network/services/test_lbaas.py +++ b/ceilometer/tests/network/services/test_lbaas.py @@ -367,7 +367,8 @@ class TestLBStatsPollster(_BaseTestLBPollster): } @mock.patch('ceilometer.pipeline.setup_pipeline', mock.MagicMock()) - def _check_get_samples(self, factory, sample_name, expected_volume): + def _check_get_samples(self, factory, sample_name, expected_volume, + expected_type): pollster = factory() cache = {} @@ -380,20 +381,24 @@ class TestLBStatsPollster(_BaseTestLBPollster): match = [s for s in samples if s.name == sample_name] self.assertEqual(1, len(match), 'missing counter %s' % sample_name) self.assertEqual(expected_volume, match[0].volume) - self.assertEqual('gauge', match[0].type) + self.assertEqual(expected_type, match[0].type) def test_lb_total_connections(self): self._check_get_samples(lbaas.LBTotalConnectionsPollster, - 'network.services.lb.total.connections', 4L) + 'network.services.lb.total.connections', + 4L, 'gauge') def test_lb_active_connections(self): self._check_get_samples(lbaas.LBActiveConnectionsPollster, - 'network.services.lb.active.connections', 2L) + 'network.services.lb.active.connections', + 2L, 'gauge') def test_lb_incoming_bytes(self): self._check_get_samples(lbaas.LBBytesInPollster, - 'network.services.lb.incoming.bytes', 1L) + 'network.services.lb.incoming.bytes', + 1L, 'cumulative') def test_lb_outgoing_bytes(self): self._check_get_samples(lbaas.LBBytesOutPollster, - 'network.services.lb.outgoing.bytes', 3L) + 'network.services.lb.outgoing.bytes', + 3L, 'cumulative') diff --git a/doc/source/measurements.rst b/doc/source/measurements.rst index faa5fe840..bd63b3662 100644 --- a/doc/source/measurements.rst +++ b/doc/source/measurements.rst @@ -268,18 +268,18 @@ switch.flow.bytes Cumulative B switch ID pollster Rece LoadBalancer as a Service (LBaaS) ================================= -======================================= ======= ========== ========== ========= ============================== -Meter Type Unit Resource Origin Note -======================================= ======= ========== ========== ========= ============================== - network.services.lb.pool Gauge pool pool ID pollster Existence of a LB Pool - network.services.lb.vip Gauge vip vip ID pollster Existence of a LB Vip - network.services.lb.member Gauge member member ID pollster Existence of a LB Member - network.services.lb.health_monitor Gauge monitor monitor ID pollster Existence of a LB Health Probe - network.services.lb.total_connections Delta connection pool ID pollster Total connections on a LB - network.services.lb.active_connections Delta connection pool ID pollster Active connections on a LB - network.services.lb.incoming.bytes Delta B pool ID pollster Number of incoming Bytes - network.services.lb.outgoing.bytes Delta B pool ID pollster Number of outgoing Bytes -======================================= ======= ========== ========== ========= ============================== +======================================= ========== ========== ========== ========= ============================== +Meter Type Unit Resource Origin Note +======================================= ========== ========== ========== ========= ============================== +network.services.lb.pool Gauge pool pool ID pollster Existence of a LB Pool +network.services.lb.vip Gauge vip vip ID pollster Existence of a LB Vip +network.services.lb.member Gauge member member ID pollster Existence of a LB Member +network.services.lb.health_monitor Gauge monitor monitor ID pollster Existence of a LB Health Probe +network.services.lb.total_connections Delta connection pool ID pollster Total connections on a LB +network.services.lb.active_connections Delta connection pool ID pollster Active connections on a LB +network.services.lb.incoming.bytes Cumulative B pool ID pollster Number of incoming Bytes +network.services.lb.outgoing.bytes Cumulative B pool ID pollster Number of outgoing Bytes +======================================= ========== ========== ========== ========= ============================== Dynamically retrieving the Meters via ceilometer client