b7e59be826 | ||
---|---|---|
benchmark | ||
bin | ||
examples | ||
lib | ||
scripts | ||
spec | ||
.gitignore | ||
.rspec | ||
Gemfile | ||
LICENSE.txt | ||
Makefile | ||
README.md | ||
Rakefile | ||
circle.yml | ||
example.rb | ||
lightstep-tracer.gemspec |
README.md
lightstep-tracer-ruby
The LightStep distributed tracing library for Ruby.
Installation
Add this line to your application's Gemfile:
gem 'lightstep-tracer'
And then execute:
$ bundle
Or install it yourself as:
$ gem install lightstep-tracer
Getting started
require 'lightstep-tracer'
# Initialize the singleton tracer
LightStep.configure(component_name: 'lightstep/ruby/example', access_token: 'your_access_token')
# Create a basic span and attach a log to the span
span = LightStep.start_span('my_span')
span.log_event('hello world', 'count' => 42)
# Create a child span (and add some artificial delays to illustrate the timing)
sleep(0.1)
child = LightStep.start_span('my_child', child_of: span)
sleep(0.2)
child.finish
sleep(0.1)
span.finish
Thread Safety
The LightStep Tracer is threadsafe. For increased performance, you can add the
concurrent-ruby-ext
gem to your Gemfile. This will enable C extensions for
concurrent operations.
The LightStep Tracer is not inherently Fork-safe. When forking, you should
disable
the Tracer before forking, then enable
it in the child Process
and parent Process after forking. See the fork_children
example for more.
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run make test
to run the tests.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.