Generate session name and default output on sessiond's end
The lttng client currently generates the default session name and
output parameters. This has, over time, resulted in a number of
problems. Notably, it is possible for scripts to create session
too quickly using automatically-generated session names that would
clash since the session's creation timestamp is the only variable part
of a session "automatic" name. Hence, sessions created in the same
second would clash and result in spurious session creation failures.
More importantly, generating session names and outputs on the client
end makes it impossible to reliably differentiate output locations that
were automatically generated vs. those that were explicitly provided.
This causes destinations to be "opaque" to the LTTng daemons as
the subdir, session name, and session's creation timestamp are all
"cooked" as part of the output destination path/subdir. Keeping these
path components separate will make it easier to implement output path
configurations that allow the grouping of session outputs by name, by
host, etc.
Since a session's creation time is used as part of its shm-path, an
accessor to the session's creation time is added to the public API:
lttng_session_get_creation_time(). This creation time attribute can be
accessed when an lttng_session structure is created using the session
listing API.
Note that existing session creation functions are preserved to
maintain the binary compatibility with existing liblttng-ctl users.
The session creation functions are reimplemented on top of this
newly-introduced API. The only function for which compatibility is
dropped is the hidden _lttng_create_session_ext().
Overhaul of path separation
---
Not generating paths on the client-end has uncovered a number
of problems in the path handling of the session daemon, especially
when a network output was used. A lot of code presumed that a
network session would be created with a URL containing a sub-directory
of the form "session_name-timestamp". While this is true for
remote sessions created by the lttng client, a sub-directory is
not required when liblttng-ctl is used directly.
Hence, this commit ensures that session directories are split
as base path, chunk directory, domain directory, application
directory.
A number of changes in this fix ensure that a session's base path
contains everything up to the "session" path element _or_ up to
the user-specified output directory.
For example, creating a local session using default output settings,
the session base output is:
/home/user/lttng-traces/session-timestamp
Creating a remote session using default output settings, the session
base output path is:
/hostname/session-timestamp/
Using custom output directories, whether locally or remotely, causes
the session base path to be set to that custom output directory.
For example, using a local output path of /tmp/my_path will result
in a session base path of the form:
/tmp/my_path
Whereas creating a session with a network output of
net://localhost/my_path will result in a session base path of the
form:
/hostname/my_path
Another problematic element is the subdir of the kernel_session
and ust_session consumer output which in different scenarios
contained chunk names and arbitrary parts of the path hierarchy.
The consumer output subdir has been renamed to 'domain_subdir'
and now only ever contains: "kernel/", "ust/", or "".
Finally, the chunk_path session attribute only contains the name
of the current chunk directory being produced.
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
32 files changed:
This page took 0.030387 seconds and 5 git commands to generate.