This Quick Start will have you configure your tracer to communicate with the LightStep Satellites and create a single span on your service. You install both the OpenTracing API and LightStep tracer and then use the OpenTracing and LightStep APIs to instrument your code.

While LightStep offers tracers and APIs specific to its tracing software, you will still use the OpenTracing API to fully instrument your code. Be sure you have read and are familiar with both LightStep tracers and the OpenTracing specification in your application’s language.

  1. Find your access token in LightStep. You’ll need this to configure your LightStep tracer.

    • Click the Project Settings button.

    • In the Access Tokens table, click the Copy icon to copy your access token to the clipboard.

  2. Add the LightStep tracer and OpenTracing to your Gemfile (if you don’t have a Gemfile yet, run bundle init to create one). Run bundle to complete installation

    1
    2
    3
    4
    
    gem "opentracing"
    gem "lightstep"
    
    bundle
    
  3. In your application, import the LightStep tracer and OpenTracing API.

    1
    2
    
    require "lightstep"
    require "opentracing"
    
  4. Early in your application’s initialization, configure the LightStep tracer and register it as the OpenTracing global tracer. As part of the configuration, you need to add your access token and add your service’s name.

    1
    2
    3
    4
    
    transport = LightStep::Transport::HTTPJSON.new(access_token: "YOUR_ACCESS_TOKEN")
    
    tracer = LightStep::Tracer.new(component_name: "YOUR_SERVICE_NAME", transport: transport)
    OpenTracing.global_tracer = tracer
    
  5. Test that everything is connected by sending a test span. Annotate the span by adding a tag (key/value pair) and logs, then flush the tracer.

    1
    2
    3
    4
    5
    6
    
    span = OpenTracing.start_span('first_span')
    span.set_tag("KEY", "VALUE")
    span.log(event: "it's a beautiful day")
    span.finish()
    
    tracer.flush()
    
  6. Run your app.

  7. Open LightStep. You should see your service in the Service directory list.

    If you want to continue adding instrumentation by creating more spans and connecting them into traces, continue on with Ruby: Add Spans.