Skip to content

Commit

Permalink
Deprecate event trait plugin 'split'
Browse files Browse the repository at this point in the history
'split' plugin can be replaced by an jsonpath expresion
since jsonpath-rw-ext>=0.1.8.

This change deprecates it

Depends-On: I8cd971d6dd98cd6c4c3dc83696969c47e8cdd8ac
Change-Id: Iac2253c81dacaa1b2a2258569716d20916fc9920
  • Loading branch information
Mehdi Abaakouk committed Oct 9, 2015
1 parent 6fe1319 commit d12d60d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
13 changes: 13 additions & 0 deletions ceilometer/event/trait_plugins.py
Expand Up @@ -15,8 +15,13 @@

import abc

from oslo_log import log
import six

from ceilometer.i18n import _LW

LOG = log.getLogger(__name__)


@six.add_metaclass(abc.ABCMeta)
class TraitPluginBase(object):
Expand Down Expand Up @@ -102,6 +107,14 @@ def __init__(self, separator=".", segment=0, max_split=None, **kw):
:param segment: Which segment to return. (int) default 0
:param max_split: Limit number of splits. Default: None (no limit)
"""
LOG.warning(_LW('split plugin is deprecated, '
'add ".`split(%(sep)s, %(segment)d, '
'%(max_split)d)`" to your jsonpath instead') %
dict(sep=separator,
segment=segment,
max_split=(-1 if max_split is None
else max_split)))

self.separator = separator
self.segment = segment
self.max_split = max_split
Expand Down
10 changes: 2 additions & 8 deletions etc/ceilometer/event_definitions.yaml
Expand Up @@ -8,15 +8,9 @@
instance_id:
fields: payload.instance_id
host:
fields: publisher_id
plugin:
name: split
parameters:
segment: 1
max_split: 1
fields: publisher_id.`split(., 1, 1)`
service:
fields: publisher_id
plugin: split
fields: publisher_id.`split(., 0, -1)`
memory_mb:
type: int
fields: payload.memory_mb
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Expand Up @@ -5,7 +5,7 @@
retrying!=1.3.0,>=1.2.3 # Apache-2.0
croniter>=0.3.4 # MIT License
eventlet>=0.17.4
jsonpath-rw-ext>=0.1.7
jsonpath-rw-ext>=0.1.9
jsonschema!=2.5.0,<3.0.0,>=2.0.0
kafka-python>=0.9.2 # Apache-2.0
keystonemiddleware>=2.0.0
Expand Down

0 comments on commit d12d60d

Please sign in to comment.