Installation and setup of TraceView for your Ruby application is a simple two step process that can be done in 10 minutes or less. Traceview gives a unique in-depth view into requests even as they cross hosts and software stacks. I run it on Gameface and PasswordPusher - it’s an essential tool in identifying problem areas, application performance bottlenecks and simply poor performing code. (Read: ActionView) To learn more about TraceView, visit http://appneta.com/traceview or read the AppNeta blog at http://appneta.com/blog
Ride the Storm: Navigating Through Unstable Periods / Katerina Rudko (Belka G...
Instrumenting Ruby on Rails With Traceview
1.
1
On
Building
:
Instrumen1ng
Ruby
with
TraceView
in
10
minutes
Peter
Lombardo
h$p://blog.gameface.in
h$p://www.appneta.com/blog
2. I’ve
been
a
Rubyist
and
Linux
addict
for
over
a
decade,
mainly
developing
in
Ruby
and
JavaScript
(as
well
as
PHP
and
Perl).
I’m
the
creator
of
numerous
soHware
tools
and
applicaIons,
most
recently
Password
Pusher,
a
Ruby
on
Rails
applicaIon
to
communicate
passwords
over
the
web
and
Gameface,
a
social
networking
plaLorm
for
gamers
using
Rails
3.
When
I’m
not
creaIng
my
own
applicaIons,
I
help
develop
and
maintain
the
infrastructure
at
OurStage
and
manage
the
Ruby
community
for
AppNeta.
Peter
Lombardo
3.
“Gameface
was
created
to
showcase
games,
the
people
who
play
them,
and
the
characters
they
play”
4.
5. TraceView
by
AppNeta
gives
a
unique
in-‐depth
view
into
requests
even
as
they
cross
hosts
and
soKware
stacks.
Installa1on
and
setup
of
TraceView
for
your
app
is
a
simple
two
step
process
that
can
be
done
in
10
minutes
or
less.
h$p://www.appneta.com/traceview
h$p://www.appneta.com/
6. TraceView
provides
deep
performance
monitoring
of
web
apps.
It
gives
insight
into
your
web
app
performance
such
as
this:
7.
8. …and
a
per
request
drill-‐down
that
shows
you
the
niOy
griOy
detail
of
where
1me
is
spent
in
individual
requests
13. I
run
it
on
Gameface
and
PasswordPusher
-‐
it’s
essen1al
in
iden1fying
problem
areas,
performance
boOlenecks
and
poor
performing
code.
(Read:
Ac1onView)
Disclaimer:
I
authored
the
Ruby
instrumenta6on
for
Traceview
so
I
may
be
a
bit
biased.
…but
with
good
reason!
h$p://gameface.in
h$p://pwpush.com/
15. Installing
TraceView
consists
of
two
parts:
1) installing
the
system
daemon
on
your
host,
and
2) installing
the
Ruby
gem
in
your
applica1on
h$p://www.appneta.com/apm-‐datasheet
16. Why
a
system
daemon?
TraceView
uses
a
system
daemon
to
collect
instrumenta6on
from
sources
beyond
applica6on
code
such
as
host
metrics,
Apache
or
Resque.
17. The
system
daemon
is
installed
with
two
commands
that
can
be
pasted
into
your
shell.
An
account
specific
version
of
these
commands
is
available
in
your
TraceView
dashboard
once
you
create
an
account.
(Under
SeWngs;
App
Configura1on;
Trace
New
Hosts)
18.
19. And
the
gem
for
your
applica1on
Gemfile
available
on
RubyGems:
h$ps://rubygems.org/gems/oboe
gem 'oboe' !
21. TraceView
func1ons
by
sampling
a
subset
of
all
requests
that
go
through
your
web
applica1on.
This
sample
rate
must
be
set
at
the
entry
point
of
requests
in
your
applica1on.
22. This
can
be
a
load
balancer,
Apache/
nginx
or
Ruby
itself.
Successive
hosts
and
soKware
stacks
that
requests
pass
through
will
act
appropriately
according
to
upstream
seWngs.!
23. Yes.
That
means
requests
can
be
traced
across
hosts,
so6ware
stacks,
even
track
internal
API
calls
via
HTTP/SOAP/
REST
which
make
for
spectacular
applicaEon
insight.
…But
that’s
another
post
for
another
Eme.
24. For
this
walkthrough
we’re
going
to
assume
that
you’re
running
a
Ruby
on
Rails
applica1on
with
Unicorn,
Thin,
Puma
or
any
other
Rack
based
Ruby
webserver.
To
instead
configure
Apache/nginx
as
the
entry
point,
see
here.
25. This
can
be
a
load
balancer,
Apache/
nginx
or
Ruby
itself.
Successive
hosts
and
soKware
stacks
that
requests
pass
through
will
act
appropriately
according
to
upstream
seWngs.!
26. If
you
setup
Apache
or
nginx
as
your
entry
point
then
you
can
skip
this
part
enErely.
The
gem
will
take
it’s
tracing
instrucEons
from
upstream
automaEcally.
Oboe!
27. When
the
gem
is
installed
in
your
applica1on,
it
makes
available
!
!
which
is
a
nested
hash
of
configura1on
op1ons
that
affect
how
your
applica1on
is
instrumented.
Oboe::Config !
Oboe!
28. Luckily,
the
defaults
are
very
smart
and
only
a
couple
ini1al
values
need
to
be
configured.
The
two
required
values
are:
Oboe::Config[:tracing_mode] = 'always' !
Oboe::config[:sample_rate] = 100000 # 10% of incoming requests !
29. These
values
enable
tracing
(:tracing_mode)
and
sets
the
sample
rate
to
10%
(:sample_rate).
The
sample_rate
is
calculated
by
the
value
out
of
one
million.
e.g.
300000
would
equal
a
30%
sample
rate
meaning
3
out
of
10
requests
would
be
sampled.
(For
low
traffic
sites,
you
may
want
to
set
these
values
higher.)!
30. These
values
are
usually
set
in
a
Rails
ini1alizer
for
Ruby
on
Rails.
See
the
OpEonal
Rails
IniEalizer
sec1on
on
this
page.
A
complete
list
of
all
configura1on
op1ons
for
is
here.!Oboe::Config !
33. If
you
want
to
test
that
the
oboe
gem
is
func1onal,
start-‐up
a
Rails
console,
you
should
see
a
message
to
stdout
similar
to:
Tracelytics oboe gem 1.4.0.2 successfully loaded. !
34. Note
that
on
hosts
that
don’t
have
the
system
daemon
installed,
the
oboe
gem
disables
itself
and
outputs
a
message
to
that
fact:
Deploy/restart
your
applica1on
and
you
should
start
seeing
traces
show
up
in
your
TraceView
dashboard
aKer
a
couple
minutes.
Unsupported Tracelytics environment (no libs). Going No-op. !
35. Things
are
moving
fast
for
the
Ruby
language
instrumenta1on
in
TraceView.
We
support
tracing
of:
39. A
screenshot
that
I
sent
to
Linode
when
performance
unexpectedly
dropped:
40.
41. Linode
migrated
my
VPS
to
a
lesser
u1lized
host
with
evident
results
(Thanks
Linode):
42.
43. An
older
issue
that
Gameface
had
with
atrocious
rendering
1mes:
44.
45. If
you
haven’t
tried
out
TraceView
yet,
give
it
a
run.
You
won’t
be
disappointed.
Note:
AppNeta
now
offers
free
tracing
for
single
projects.
Check
it
out
on
their
pricing
page.