1
# -*- encoding: utf-8 -*-
3
# Copyright © 2013 eNovance
5
# Author: Julien Danjou <julien@danjou.info>
7
# Licensed under the Apache License, Version 2.0 (the "License"); you may
8
# not use this file except in compliance with the License. You may obtain
9
# a copy of the License at
11
# http://www.apache.org/licenses/LICENSE-2.0
13
# Unless required by applicable law or agreed to in writing, software
14
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16
# License for the specific language governing permissions and limitations
18
"""Publish a counter in memory, useful for testing
21
from ceilometer import publisher
24
class TestPublisher(publisher.PublisherBase):
25
"""Publisher used in unit testing."""
27
def __init__(self, parsed_url):
30
def publish_counters(self, context, counters, source):
31
"""Send a metering message for publishing
33
:param context: Execution context from the service or RPC call
34
:param counter: Counter from pipeline after transformation
35
:param source: counter source
37
self.counters.extend(counters)