Bases: ceilometer.event.trait_plugins.TraitPluginBase
Plugin to set flags on a bitfield.
Bases: ceilometer.event.trait_plugins.TraitPluginBase
Plugin that splits a piece off of a string value.
Bases: ceilometer.event.trait_plugins.TraitPluginBase
Setup timedelta meter volume of two timestamps fields.
Example:
trait's fields definition: ['payload.created_at',
'payload.launched_at']
value is been created as total seconds between 'launched_at' and
'created_at' timestamps.
Bases: exceptions.Exception
Bases: object
Base class for plugins.
It converts notification fields to Trait values.
Convert a set of fields to one or multiple Trait values.
This method is called each time a trait is attempted to be extracted from a notification. It will be called even if no matching fields are found in the notification (in that case, the match_list will be empty). If this method returns None, the trait will not be added to the event. Any other value returned by this method will be used as the value for the trait. Values returned will be coerced to the appropriate type for the trait.
Parameters: | match_list – A list (may be empty if no matches) of tuples. Each tuple is (field_path, value) where field_path is the jsonpath for that specific field. |
---|
Example:
trait's fields definition: ['payload.foobar',
'payload.baz',
'payload.thing.*']
notification body:
{
'message_id': '12345',
'publisher': 'someservice.host',
'payload': {
'foobar': 'test',
'thing': {
'bar': 12,
'boing': 13,
}
}
}
match_list will be: [('payload.foobar','test'),
('payload.thing.bar',12),
('payload.thing.boing',13)]
Here is a plugin that emulates the default (no plugin) behavior:
class DefaultPlugin(TraitPluginBase):
"Plugin that returns the first field value."
def __init__(self, **kw):
super(DefaultPlugin, self).__init__()
def trait_value(self, match_list):
if not match_list:
return None
return [ match[1] for match in match_list]