[lttng-dev] Creating custom application
Jonathan Rajotte-Julien
jonathan.rajotte-julien at efficios.com
Tue Apr 2 17:18:06 EDT 2019
On Tue, Apr 02, 2019 at 04:54:00PM -0400, Mosleh Uddin wrote:
> Hello,
>
> Could you give me some more insight into spawning my own sessiond? Sorry
> I'm not completely clear on the topic.
> Thank you for all your assistance.
Normally lttng-sessiond is treated as a "server/service/daemon" (think http
server as apache) and is *normally* launched as a daemon (systemd/sysVinit) at
boot time.
Managing manually the lifetime of a lttng-sessiond process is done the same way
as any other process. You can manage it via the command line (./lttng-sessiond), via a
service manager (systemd/upstart etc.) or with a custom service manager (a
python script/c etc.).
You could spawn a lttng-sessiond from your application with the appropriate
parameters set to isolate it if you need. LTTNG_HOME is an important one. The
output directory also can be manipulated. See man lttng-sessiond for more
details. You will need to manage the process or leave it to a system
administrator and only active tracing when a sessiond is present for example.
Cheers
>
> Regards,
> Mosleh
>
> On Wed, Mar 27, 2019 at 1:52 PM Jonathan Rajotte-Julien <
> jonathan.rajotte-julien at efficios.com> wrote:
>
> > Hi Mosleh,
> >
> > On Wed, Mar 27, 2019 at 12:09:54PM -0400, Mosleh Uddin wrote:
> > > Hello,
> > >
> > > Thank you for the quick response. I was able to use the documentation you
> > > provided to start a session and get tracepoint list. I do have some
> > > follow-up questions:
> > >
> > > 1) I needed to create a session daemon before executing my custom
> > > application. In the API I did see functionality to see if a daemon is
> > > active, however, it is possible to spawn a session daemon in my custom
> > app?
> >
> > liblttng-ctl does not expose a lttng-sessiond spawning function since by
> > definition it is a daemon executable (think apache,mysql etc.), you will
> > have to
> > use system/popen/exec.. to spawn the lttng-sessiond process etc. if you
> > want to
> > control its lifetime using your custom application.
> >
> > >
> > > 2) I am able to get a list of active traces lttng can see in userspace, I
> > > enable all the traces and start tracing. The traces however seem to not
> > be
> > > written anywhere on my filesystem. Do I have to specify a location? Or
> > am I
> > > missing something? My current flow is:
> >
> > Please refer to the create command. If outputting locally you will need to
> > pass
> > a "file://...." url to lttng_create_session.
> >
> > You can check on the result for each steps using "lttng list" and "lttng
> > list
> > <session_name>" as you go to troubleshot your setup script.
> >
> > While debugging you can also start the lttng-sessiond in verbose mode to
> > understand what is going on.
> >
> > Also note that you could also use the lttng "load" api if the session you
> > are
> > trying to load is "static" and always the same. You would only need to
> > ship an
> > xml file with your application.
> >
> > Cheers
> >
> > >
> > > - Creating a session
> > > - Specifying the domain
> > > - Creating a handle
> > > - Creating a channel (with default attributes)
> > > - Enabling the channel
> > > - Enabling event (for all traces)
> > > - Start tracing
> > >
> > > Thanks again for all the assistance.
> > >
> > > Regards,
> > > Mosleh
> > >
> > > On Tue, Mar 26, 2019 at 11:29 AM Jonathan Rajotte-Julien <
> > > jonathan.rajotte-julien at efficios.com> wrote:
> > >
> >
--
Jonathan Rajotte-Julien
EfficiOS
More information about the lttng-dev
mailing list