Merge "add ceilometer publisher"

This commit is contained in:
Jenkins 2017-02-22 04:28:44 +00:00 committed by Gerrit Code Review
commit d785015552
5 changed files with 60 additions and 0 deletions

View File

@ -13,6 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import debtcollector
from oslo_log import log
from oslo_utils import timeutils
@ -38,6 +39,9 @@ class DatabaseDispatcher(object):
"""
def __init__(self, conf):
debtcollector.deprecate("Panko dispatcher is deprecated."
"Use publisher to push data instead",
version="3.0", removal_version="4.0")
# NOTE(jd) The `conf' arg is the Ceilometer conf, but we don't really
# need it here.
conf = service.prepare_service([])

View File

View File

@ -0,0 +1,40 @@
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from panko import service
from panko import storage
class DatabasePublisher(object):
"""Publisher class for recording event data into database.
The publisher class which records each event into a database configured
in Ceilometer configuration file.
To enable this publisher, the following section needs to be present in
panko.conf file
[database]
connection = mysql+pymysql://panko:password@127.0.0.1/panko?charset=utf8
Then, panko:// should be added to Ceilometer's event_pipeline.yaml
"""
def __init__(self, parsed_url):
conf = service.prepare_service([])
self.conn = storage.get_connection_from_config(conf)
def publish_events(self, events):
if not isinstance(events, list):
events = [events]
self.conn.record_events(events)

View File

@ -0,0 +1,13 @@
---
features:
- |
A new ceilometer to panko publisher is created to avoid ceilometer
collector dependency. This streamlines the process of pushing data to Panko
upgrade:
- |
In ceilometer.conf, remove `panko` from event_dispatchers. Add `panko://`
to the publishers in event_pipeline.yaml
deprecations:
- |
The ceilometer to panko dispatcher is now deprecated. The publisher
should be used going foward.

View File

@ -47,6 +47,9 @@ wsgi_scripts =
ceilometer.dispatcher.event =
panko = panko.dispatcher.database:DatabaseDispatcher
ceilometer.event.publisher =
panko = panko.publisher.database:DatabasePublisher
oslo.config.opts =
panko = panko.opts:list_opts