Convert file publisher to be equivalent to file dispatcher
Deprecate the file dispatcher and now file publisher can do the same instead. And add a release note about it. Change-Id: I6a5040e2e57389f9f7f5d246c528f8c49cfc05d8 Related-Bug: #1630570
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
import logging
|
||||
import logging.handlers
|
||||
|
||||
from debtcollector import removals
|
||||
from oslo_config import cfg
|
||||
|
||||
from ceilometer import dispatcher
|
||||
@@ -35,6 +36,8 @@ OPTS = [
|
||||
cfg.CONF.register_opts(OPTS, group="dispatcher_file")
|
||||
|
||||
|
||||
@removals.removed_class("FileDispatcher", message="Use file publisher instead",
|
||||
removal_version="9.0.0")
|
||||
class FileDispatcher(dispatcher.MeterDispatcherBase,
|
||||
dispatcher.EventDispatcherBase):
|
||||
"""Dispatcher class for recording metering data to a file.
|
||||
|
@@ -19,7 +19,6 @@ import logging.handlers
|
||||
from oslo_log import log
|
||||
from six.moves.urllib import parse as urlparse
|
||||
|
||||
import ceilometer
|
||||
from ceilometer.i18n import _
|
||||
from ceilometer import publisher
|
||||
|
||||
@@ -29,7 +28,7 @@ LOG = log.getLogger(__name__)
|
||||
class FilePublisher(publisher.ConfigPublisherBase):
|
||||
"""Publisher metering data to file.
|
||||
|
||||
The publisher which records metering data into a file. The file name and
|
||||
The file publisher pushes metering data into a file. The file name and
|
||||
location should be configured in ceilometer pipeline configuration file.
|
||||
If a file name and location is not specified, this File Publisher will not
|
||||
log any meters other than log a warning in Ceilometer log file.
|
||||
@@ -58,7 +57,7 @@ class FilePublisher(publisher.ConfigPublisherBase):
|
||||
|
||||
self.publisher_logger = None
|
||||
path = parsed_url.path
|
||||
if not path or path.lower() == 'file':
|
||||
if not path:
|
||||
LOG.error(_('The path for the file publisher is required'))
|
||||
return
|
||||
|
||||
@@ -101,4 +100,6 @@ class FilePublisher(publisher.ConfigPublisherBase):
|
||||
|
||||
:param events: events from pipeline after transformation
|
||||
"""
|
||||
raise ceilometer.NotImplementedError
|
||||
if self.publisher_logger:
|
||||
for event in events:
|
||||
self.publisher_logger.info(event.as_dict())
|
||||
|
@@ -0,0 +1,6 @@
|
||||
---
|
||||
deprecations:
|
||||
- With collector service being deprecated, we now have to
|
||||
address the duplication between dispatchers and publishers.
|
||||
The file dispatcher is now marked as deprecated. Use the
|
||||
file publisher to push samples into a file.
|
Reference in New Issue
Block a user