Refactor: lttng-ctl: follow terminology of the tracker documentation
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 17 Mar 2020 20:14:30 +0000 (16:14 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 26 Mar 2020 22:01:40 +0000 (18:01 -0400)
commit159b042f34366d0fde5dcd73b4231c558922a664
tree60ac5360c9e48507d574beb61828997a1d95117f
parentac41e67e39946acd97752ce52b964976890c5e87
Refactor: lttng-ctl: follow terminology of the tracker documentation

This commit harmonizes the process attribute tracker API and
serialization formats (save/restore and MI) with the documentation
with regards to the terminology used.

The message of the parent commit adjusting the manual pages of the
lttng-track and lttng-untrack commands details those terminology
changes and their rationale.

Some problems with the API introduced during the 2.12 development
cycle are also adressed:

Type safety:
  - The process attribute tracker is made type safe with regards
    to the platform's native types to express process
    attributes. Where the original API casted all integral values to
    integers, this change introduces accessors for all process
    attribute types (pid_t, uid_t, gid_t). This makes it easier to
    use the API safely and without producing warnings in user's
    code.

    Another benefit of adopting this explicit type-safe approach is
    that is will make it easier to add new attributes which are not
    expressible (or non-ambiguously expressible) using `int` and
    `string` types (e.g. tracking a virtual PID within a given
    namespace).

Ambiguity of INCLUDE_ALL, EXCLUDE_ALL, and INCLUDE_SET states:
  - The original tracker API has a notion of 'enabled' pid_tracker
    which is confusing to users:
      - enable = 0: everything is tracked,
      - enable = 1: a list of tracked pids is provided, which may be
        empty.
      - pid '-1' is *special* and tracks or untracks everything.

    This was replaced with a 'special' opaque value meaning 'ALL'
    which, while being clearer, was still confusing and hard to
    document.

    The revised API explicitly expresses the notion of a tracking
    policy (`enum lttng_tracking_policy`). When that policy is set
    to `LTTNG_TRACKING_POLICY_INCLUDE_SET`, the inclusion set can
    be queried and/or mutated.

    On top of being clearer, this aligns more closely with the
    internal lttng-sessiond daemon API which gets rid of a lot
    of code to handle those special cases. The resulting code is
    more verbose, but a lot easier to understand.

    Moreover, the types introduced (e.g. lttng_process_attr_values)
    are meant to be re-used if a new
    `LTTNG_TRACKING_POLICY_EXCLUDE_SET` tracking policy is added in
    the future.

Documentation:
  - The revised API includes a complete documentation. It documents
    the API usage, but also adds implementation notes such explicitly
    mentionning when/where user names and group names are resolved.

Client:
  - While making the changes to use this new API, some error messages
    are clarified (or added). The resulting output when listing the
    trackers was also changed to be more compact.

    The CLI output now also makes use of the terminology used in
    the documentation for all commands interacting with process
    attribute trackers.

    It is now also possible to specify multiple process attribute
    trackers along with the --all option for the lttng-track and
    lttng-untrack command.  For instance: `lttng tracker --userspace
    --vpid --vuid --all` is now allowed.

    The same process attribute tracker can also be specified more than
    once in a command, as follows:
    `lttng track --userspace --vpid 43,11 --vpid 55,77`

Since the serialization had been changed during the 2.12 cycle, I
changed them further to use the API's terminology in the element
names.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: I5f0ea2849eb024ea6944b2ee7dbadfd893cc0be4
43 files changed:
include/Makefile.am
include/lttng/lttng-error.h
include/lttng/tracker-internal.h [deleted file]
include/lttng/tracker.h
src/bin/lttng-sessiond/client.c
src/bin/lttng-sessiond/cmd.c
src/bin/lttng-sessiond/cmd.h
src/bin/lttng-sessiond/kernel.c
src/bin/lttng-sessiond/kernel.h
src/bin/lttng-sessiond/save.c
src/bin/lttng-sessiond/trace-kernel.c
src/bin/lttng-sessiond/trace-kernel.h
src/bin/lttng-sessiond/trace-ust.c
src/bin/lttng-sessiond/trace-ust.h
src/bin/lttng-sessiond/tracker.c
src/bin/lttng-sessiond/tracker.h
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng/commands/list.c
src/bin/lttng/commands/track-untrack.c
src/common/Makefile.am
src/common/config/config-session-abi.h
src/common/config/session-config.c
src/common/config/session.xsd
src/common/error.c
src/common/kernel-ctl/kernel-ctl.c
src/common/kernel-ctl/kernel-ctl.h
src/common/macros.h
src/common/mi-lttng-4.0.xsd
src/common/mi-lttng.c
src/common/mi-lttng.h
src/common/sessiond-comm/sessiond-comm.h
src/common/tracker.c
src/common/tracker.h [new file with mode: 0644]
src/common/utils.c
src/common/utils.h
src/lib/lttng-ctl/Makefile.am
src/lib/lttng-ctl/deprecated-symbols.c
src/lib/lttng-ctl/lttng-ctl-helper.h
src/lib/lttng-ctl/lttng-ctl.c
src/lib/lttng-ctl/tracker.c [new file with mode: 0644]
tests/regression/tools/mi/test_mi
tests/regression/tools/save-load/load-42-trackers.lttng
tests/regression/tools/save-load/test_load
This page took 0.031221 seconds and 5 git commands to generate.