Skip to content

A ruby gem wrapping the lttng-ust library (see http://lttng.org/ for details about lttng)

Notifications You must be signed in to change notification settings

riddochc/lttng-agent-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lttng-agent-ruby

Description

Tracing ruby applications with LTTng.

A simple API for sending tracepoints from Ruby programs to LTTng.

Requirements

Ruby 2.0 or newer

Installation

You need to have the lttng-ust library and headers installed on your system to build this.

Use

The documentation for lttng will be useful for understanding how to make good use of this gem. http://lttng.org/docs/

$ lttng create
$ lttng enable-channel channel0 -u
$ lttng enable-event 'ruby_log:*' -u -c channel0
$ lttng start
$ my-ruby-program.rb
$ lttng stop
$ lttng view | less
$ lttng destroy

Note that logs aren’t deleted when you run lttng destroy, only the lttng session. The logs are stored by default in ~/lttng-traces.

Simplest possible use:

LTTng.info("This string should be logged in lttng.")

Conforming to Ruby’s built-in Logger class API:

require 'lttng-agent-ruby'
require 'lttng-agent-ruby/logger'
logger = LTTngLogger.new
logger.info("Something informative")

Note that the standard 'formatter' attribute is present for compatibility with applications that expect it to be present, but has no effect when used.

With the built-in TracePoint class:

require 'lttng-agent-ruby'
require 'lttng-agent-ruby/logger'
require 'tracer'
tracer = TracePoint.new() {|tp| LTTng.debug(tp.inspect) }
tracer.enable

Be careful about the span of your program covered by tracing at this level; this can use up disk space at alarming rates!

Parsing libraries

Until I can provide a more comprehensive tool, I’ve put together a couple libraries that can parse the output of the babeltrace tool.

Using these parsers requires that you have the 'parslet' gem installed, but as it’s not a hard requirement for using the core facilities of LTTng, it’s not a dependency.

Contributing

Pull requests welcome.

Contributors

  • Chris Riddoch

History

Version 0.0.1

  • Initial release, yay!

License

Copyright © 2016 Chris Riddoch

See LICENSE for license details

About

A ruby gem wrapping the lttng-ust library (see http://lttng.org/ for details about lttng)

Resources

Stars

Watchers

Forks

Packages

No packages published