Change counter to sample vocable in cm.publisher

This changes counter to sample vocable in ceilometer.publisher code

Parts of the blueprint remove-counter

Change-Id: I1fe0269ef9f1f98a93ef12bd5a4d55b7b1d5a5f2
This commit is contained in:
Mehdi Abaakouk
2013-08-20 17:24:52 +02:00
parent 32b135f1ea
commit 6f7da3a192
4 changed files with 38 additions and 38 deletions

View File

@@ -15,7 +15,7 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""Publish a counter using an UDP mechanism
"""Publish a sample using an UDP mechanism
"""
from ceilometer import publisher
@@ -41,23 +41,23 @@ class UDPPublisher(publisher.PublisherBase):
self.socket = socket.socket(socket.AF_INET,
socket.SOCK_DGRAM)
def publish_samples(self, context, counters):
def publish_samples(self, context, samples):
"""Send a metering message for publishing
:param context: Execution context from the service or RPC call
:param counter: Counter from pipeline after transformation
:param samples: Samples from pipeline after transformation
"""
for counter in counters:
msg = counter.as_dict()
for sample in samples:
msg = sample.as_dict()
host = self.host
port = self.port
LOG.debug(_("Publishing counter %(msg)s over UDP to "
LOG.debug(_("Publishing sample %(msg)s over UDP to "
"%(host)s:%(port)d") % {'msg': msg, 'host': host,
'port': port})
try:
self.socket.sendto(msgpack.dumps(msg),
(self.host, self.port))
except Exception as e:
LOG.warn(_("Unable to send counter over UDP"))
LOG.warn(_("Unable to send sample over UDP"))
LOG.exception(e)