LightStep Documentation

Welcome to the LightStep developer hub. You'll find comprehensive guides and documentation to help you start working with LightStep as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

JavaScript Quick Start

For Browser and Node JavaScript

This Quick Start will have you configure your tracer to communicate with the LightStep Satellites and create a single span - span - Represents a logical unit of work in the system that has a start time and a duration. Spans can be nested. on your service. You install both the OpenTracing API and LightStep tracer and then use the OpenTracing and LightStep APIs to instrument your code.

You need to know OpenTracing before proceeding

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.
    a. Click the Project Settings button.
    b. In the Access Tokens table, click the Copy icon to copy your access token to the clipboard.

  2. Install the LightStep tracer and OpenTracing API.

npm install --save lightstep-tracer opentracing
  1. Import the LightStep tracer and OpenTracing API.
var opentracing = require('opentracing');
var lightstep   = require('lightstep-tracer');
  1. 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.
var tracer = new lightstep.Tracer({
  component_name : 'YOUR_SERVICE_NAME',
  access_token : 'YOUR_ACCESS_TOKEN',
  1. 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.
var span = opentracing.globalTracer().startSpan('test_span');
span.setTag("KEY", "VALUE")
span.log({event: "it's a beautiful day"})

// tracer.flush() will ensure that your span is sent
  1. Run your app.

  2. 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 JavaScript: Add Spans.

Updated 4 months ago

JavaScript Quick Start

For Browser and Node JavaScript

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.