[lttng-dev] Creating custom application

Mosleh Uddin mosleh1235 at gmail.com
Wed Apr 3 16:50:15 EDT 2019


Apologies, did not mean for the message to be private.

Thank you for all your assistance, for now I think compiling with the flag
to disable cli is the way to go.

Regards,
Mosleh

On Wed, Apr 3, 2019 at 4:00 PM Jonathan Rajotte-Julien <
jonathan.rajotte-julien at efficios.com> wrote:

> Hi Mosleh,
>
> I just saw this was a private email.
>
> As you will understand based on my previous email, this is slowly starting
> the
> be out of scope of our public support effort.
>
> Note that we do offer commercial support if it is something you would be
> interested in. You would be able to talk openly of the requirements, more
> importantly of the project you are working on and how to integrate lttng
> with
> it.
>
> Cheers
>
> On Wed, Apr 03, 2019 at 02:15:55PM -0400, Mosleh Uddin wrote:
> > I apologize, I will give the bigger picture of what I am trying to do.
> >
> > So the restraint I have is that I can't install lttng-tools and lttng-ust
> > libraries as part of the yocto build, mostly because we have release
> > software (for the public) and we don't want these CLI features available
> to
> > the public (if they were to somehow access the CLI).
> >
> > I have compiled a userspace application using the 'lttng-ust' compile
> flag
> > with lttng tracepoints distributed throughout the code. I am creating a
> > separate custom lttng application (compiled with lttng-ctl) which will
> > communicate with the application (via domain socket) in order to dictate
> > when to start/stop sessions. I want the this custom application to have
> the
> > ability to not only start/stop sessions but also spawn the session
> daemon.
> >
> > From my description, you see that the system we are building for will not
> > any have lttng libraries installed, I will be cross-compiling the
> > applications with the libraries that are needed. I know you said
> lttng-ctl
> > doesn't expose spawning sessiond, so I was curious how I could get this
> > functionality for my custom lttng application.
> >
> > Regards,
> > Mosleh
> >
> > On Wed, Apr 3, 2019 at 11:55 AM Jonathan Rajotte-Julien <
> > jonathan.rajotte-julien at efficios.com> wrote:
> >
> > > On Wed, Apr 03, 2019 at 11:04:19AM -0400, Mosleh Uddin wrote:
> > > > Hello,
> > > >
> > > > It is a limitation for both size and some security measures. We want
> to
> > > > ensure that we can set limits controlled by our custom application.
> > >
> > > What security measure? What limits? Unless you provide clear
> requirement
> > > it is
> > > quite hard to understand where you are going and how we can help you
> get
> > > there.
> > >
> > > >
> > > > For testing purposes, I did initially have lttng-tools and lttng-ust
> > > added
> > > > to the build image but again for the limitations described it cannot
> go
> > > > into the final 'production' rootfs. So it's nice that the service
> file
> > > > exists, but without the tools installed I do not think I can make
> use of
> > > > it, unless there is a way to strip out everything from lttng-tools
> except
> > > > for the sessiond functionality.
> > >
> > > Well the biggest part of lttng-tools project is lttng-sessiond and
> > > lttng-consumerd. If the cli is the problem you can pass
> > > "--disable-bin-lttng" at
> > > configure time to simply exclude it from being built and installed.
> > >
> > > As for lttng-sessiond executable, you can limit the user able to use
> it via
> > > regular user/group permissions.
> > >
> > > >
> > > > My guess from everything you are saying is that I will have to
> create a
> > > > custom method for spawning a session daemon without having
> lttng-tools
> > > > available, however I am unsure where to start.
> > >
> > > No, you will need lttng-tools (in the sense of the project, no the
> > > executable) to
> > > be present on the system if you want to trace at all.
> > >
> > > > From way lttng-tools does
> > > > it, I see it call the executable 'lttng-sessiond', but I cannot find
> a
> > > > reference to when or how that executable is getting built.
> > >
> > > Take a look at the src/bin folder (git tree). The "lttng" subfolder is
> > > only the
> > > CLI. The meat of lttng is lttng-sessiond/relayd/consumerd.
> > >
> > > >
> > > > Thanks again for quick responses.
> > > >
> > > > Regards,
> > > > Mosleh
> > > >
> > > >
> > > >
> > > > On Wed, Apr 3, 2019 at 10:25 AM Jonathan Rajotte-Julien <
> > > > jonathan.rajotte-julien at efficios.com> wrote:
> > > >
> > > > > On Wed, Apr 03, 2019 at 09:08:45AM -0400, Mosleh Uddin wrote:
> > > > > > Hello,
> > > > > >
> > > > > > Sorry, I should be more specific. I am creating a custom yocto
> > > build. I
> > > > > > have seen some examples where systemd is utilized to start the
> > > sessiond
> > > > > as
> > > > > > a service. The limitation I have is that I don't want to include
> the
> > > > > whole
> > > > > > lttng-tools librray in my build. I understand that the sessiond
> is an
> > > > >
> > > > > You will have to if you plan on tracing any applications on your
> > > resulting
> > > > > image. Why is it a limitation? Size constraint?
> > > > >
> > > > > lttng-tools is already part of OE-core (the meta/ layer). Use this
> > > recipe
> > > > > to
> > > > > build it [1] or as a base for a custom one.
> > > > >
> > > > > [1]
> > > > >
> > >
> https://git.yoctoproject.org/cgit/cgit.cgi/poky/tree/meta/recipes-kernel/lttng/lttng-tools_2.10.6.bb
> > > > >
> > > > > You can add the following to your local.conf file to build only
> > > lttng-ust
> > > > > and
> > > > > lttng-tools.
> > > > >
> > > > > CORE_IMAGE_EXTRA_INSTALL += "lttng-ust lttng-tools"
> > > > > PACKAGECONFIG_pn-lttng-tools_append = " lttng-ust"
> > > > >
> > > > > By default a systemd service file is installed but is not activated
> > > (which
> > > > > seems
> > > > > to be what you want).
> > > > >
> > > > > Cheers
> > > > >
> > > > >
> > > > > > executable, I am just unsure how I could build or get this in my
> > > build.
> > > > > > Moving forward from this I could use fork/exec to daemonize which
> > > would
> > > > > be
> > > > > > simple.
> > > > > > Is there perhaps a existing recipe?
> > > > > >
> > > > > > Regards,
> > > > > > Mosleh
> > > > > >
> > > > > > On Tue, Apr 2, 2019 at 6:01 PM Mosleh Uddin <
> mosleh1235 at gmail.com>
> > > > > wrote:
> > > > > >
> > > > > > > Hi,
> > > > > > >
> > > > > > > That makes complete sense. I was more curious about the
> sessiond
> > > > > > > executable. I'm guessing this is something I will have to
> create
> > > along
> > > > > with
> > > > > > > my build?
> > > > > > >
> > > > > > > Regards,
> > > > > > > Mosleh
> > > > > > >
> > > > > > > On Tue, Apr 2, 2019 at 5:18 PM Jonathan Rajotte-Julien <
> > > > > > > jonathan.rajotte-julien at efficios.com> wrote:
> > > > > > >
> > > > > > >> 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
> > > > > > >>
> > > > > > >
> > > > >
> > > > > --
> > > > > Jonathan Rajotte-Julien
> > > > > EfficiOS
> > > > >
> > >
> > > --
> > > Jonathan Rajotte-Julien
> > > EfficiOS
> > >
>
> --
> Jonathan Rajotte-Julien
> EfficiOS
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.lttng.org/pipermail/lttng-dev/attachments/20190403/74f4bdc5/attachment-0001.html>


More information about the lttng-dev mailing list