[lttng-dev] [RFC babeltrace 0/2] fs-src: add metadata-src parameter
Philippe Proulx
eeppeliteloop at gmail.com
Mon Apr 30 19:11:30 EDT 2018
On Mon, Apr 30, 2018 at 5:31 PM, Alexander Aring <aring at mojatatu.com> wrote:
> Hi,
>
> my use-case is just... we have several application with the same metadata
> file. Currently I build a wrapper around babeltrace to run something like:
>
> find $(TRACE_DIR}/* -maxdepth 1 -type d -exec cp ${PATH_TO_MY_APP_DATA}/ctf/metadata '{}' \;
>
> which is terrible... so I try this here somehow.
> As you see it has no support for fs-query and I didn't figured out yet
> for what fs-query is for.
>
> Also I was struggle some hours how to tell popt the right argument string,
> it need to be:
>
> --metadata-src=\"/usr/share/$APP_DIR/ctf\"
>
> with the ugly escape things... I saw there is a complex INI parser system
> behind (never saw such complex option parser in an open source project).
A note about this: there are two ways to add component initialization
parameters with `babeltrace run`: with
--params 'key1="the value", key2=23, key3=simple_string'
and, for string parameters, with:
--key key1 --value 'the value'
The --params option parses what you call a "complex INI" format. It's
not so complex in reality and well-explained in the man page.
The job of `babeltrace convert` (the default command) is only to create
a valid `babeltrace run` command line and run it. In your first patch,
you use append_implicit_component_param(): this one appends a key/value
pair to the --params option's argument of a given implicit component.
It's simply appending `,KEY=VAL` to the current INI-style parameter
string for that component, which is why you need to pass the double
quotes above, because the effective string to append is exactly:
,metadata-src="/usr/share/app-dir-expansion/ctf"
What you want to do is have this instead:
--key metadata-src --value /usr/share/app-dir-expansion/ctf
(where `app-dir-expansion` is the expansion of $APP_DIR). You can use
append_implicit_component_extra_param() for this. This is what we use
for complex string values like for --begin, --end, --debug-info-dir,
etc. Then you could use:
--metadata-src="/usr/share/$APP_DIR/ctf"
so that popt returns `/usr/share/app-dir-expansion/ctf`.
Hope it helps.
Phil
>
> It's not easy to add such use-case because the whole code things everything
> which has a metadata inside is ctf trace... and so far I know that's what
> the spec and man-page says [0].
>
> As there is no metadata file anymore needed with this parameter, it will
> assume every regular file is a ctf stream, if only there is no other subdir
> inside the directory. So only "leafs" regular files will be assume as a ctf
> stream. If there exists regular files not as leafs - babeltrace will fail.
>
> Also I think I still need to have a wrapper around babeltrace to specify the
> metadata dir as metadata-src then... but better than this cp in front of it.
>
> - Alex
>
> [0] http://man7.org/linux/man-pages/man7/babeltrace-source.ctf.fs.7.html
> See "trace naming".
>
> Alexander Aring (2):
> fs-src: add argument for metadata src dir
> doc: man: babeltrace-source.ctf.fs.7: add metadata-src
>
> cli/babeltrace-cfg-cli-args.c | 10 ++++
> doc/man/babeltrace-source.ctf.fs.7.txt | 7 +++
> plugins/ctf/fs-src/fs.c | 88 ++++++++++++++++++++++++++++------
> plugins/ctf/fs-src/fs.h | 3 +-
> plugins/ctf/fs-src/metadata.c | 8 +++-
> plugins/ctf/fs-src/metadata.h | 1 +
> plugins/ctf/fs-src/query.c | 2 +-
> 7 files changed, 101 insertions(+), 18 deletions(-)
>
> --
> 2.11.0
>
> _______________________________________________
> 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