[lttng-dev] [barectf] Support for empty payload ?

Philippe Proulx eeppeliteloop at gmail.com
Fri Mar 25 18:33:07 UTC 2016


On Fri, Mar 25, 2016 at 10:57 AM, Jean-François Monestier
<jean-francois.monestier at st.com> wrote:
>
> Le 3/25/2016 3:34 PM, Simon Marchi a écrit :
>>
>> On 2016-03-25 10:14, Jean-François Monestier wrote:
>>>
>>> Hello Tracers,
>>>
>>> Does anyone know whether barectf supports some sort of empty payloads
>>> for events specified in the .yaml configuration file ?
>>>
>>> Something such as the well-known lttng_ust_statedump:start event :
>>>
>>> event {
>>>          name = "lttng_ust_statedump:start";
>>>          id = 0;
>>>          stream_id = 0;
>>>          loglevel = 13;
>>>          fields := struct {
>>>          };
>>> };
>>>
>>> I can't figure out the yaml syntax for such an event, your help would
>>> be welcome.

Hi Jean-François,

Thanks for writing.

This was an arbitrary limitation, and I can't remember why it was like
that.

I write "was" because I just "fixed" it in v2.1.3. The only requirement
now is that the event must contain at least one field in one of the
following types:

  * The event header type of its parent stream
  * The event context type of its parent stream
  * Its context type
  * Its payload type

In other words, the event cannot be completely empty. This would make it
impossible for the reader to finish, since it would mean a stream of
many 0-sized events (since there's no event ID, there's only one event in
this stream). Babeltrace does not like this:

    [error] Invalid 0 byte event encountered.
    [error] Reading event failed.

All the following event objects should work as expected in v2.1.3:

  1. Empty event object:

         {}

  2. Null payload type (sets the payload type to its default value,
     which is no payload type):

         payload-type: null

  3. Structure with no fields (you must still explicitly align the type
     to at least 8-bit; this is a requirement for object types which is
     usually satisfied by the fact that one of the fields is
     byte-aligned):

         payload-type:
           class: struct
           min-align: 8

I added such an event in the linux-fs-simple example, and it seems like
everything is okay on the Babeltrace side afterwards:

    ...
    context_no_payload: { }, { a = 223, b = "ctx" }, { }
    ...
    no_context_no_payload: { }, { }
    ...

>>>
>>> I must confess I'm still stuck to barectf v2.0.2

May I ask you why you're "stuck" at v2.0.2? How are you installing
barectf?

barectf v2.1 is fully backward-compatible with v2.0 (supports config
files with version 2.0), so upgrading it is just a matter of running:

    pip3 install --upgrade barectf

>>>
>>>
>>> Thanks in advance,
>>
>>
>> Hi Jean-François,
>>
>> I don't believe barectf allows specifying empty payloads as of now.
>> Trying to specify an empty fields dict, such as:
>>
>> simple_uint32:
>>     log-level: CRIT
>>     payload-type:
>>       class: struct
>>       fields: {}
>>
>> yields:
>>
>> Error:
>>     cannot create configuration from YAML file "config.yaml":
>>     metadata error:
>>     invalid event in stream "default":
>>     event payload type must have at least one field for event
>> "simple_uint32"
>>
>> See:
>> https://github.com/efficios/barectf/blob/master/barectf/config.py#L1119
>>
>> The maintainers will be able to confirm/infirm, and say whether it's in
>> the plans to add support for that.

Thanks for the fast support ;-).

>>
>> Simon
>>
>
> Thank you, Simon, for your prompt response.
>
> I should have mentionned it, but my numerous, 'creative' attempts popped up a few error messages, such as
>
> Error:
>   cannot create configuration from YAML file:
>   cannot create stream "default":
>   cannot create event "start":
>   missing "payload-type" property in event object
>
> Error:
>   cannot create configuration from YAML file:
>   cannot create stream "default":
>   cannot create event "start":
>   cannot create event's payload type object:
>   type objects must be associative arrays
>
> Error:
>   cannot create configuration from YAML file:
>   metadata error:
>   invalid event in stream "default":
>   event payload type must have at least one field for event "start"
>
> Error:
>   cannot create configuration from YAML file:
>   cannot create stream "default":
>   cannot create event "start":
>   cannot create event's payload type object:
>   "fields" property of structure type object must be an associative array
>
>
> Bye for now,
> --
> Jean-Francois Monestier
> 041-6766
>
> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> https://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev


More information about the lttng-dev mailing list