LightStep

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    

C# Quick Start

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. Add the LightStep tracer to your .NET project using NuGet or by running the following command for .NET Core projects

dotnet add package LightStep
  
  1. In your application code, add a reference to the LightStep tracer and OpenTracing API
using LightStep;
using OpenTracing.Util;
  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 a tag for your service's name. Use this table for Satellite options.
Option
On-Premise
LightStep Public
Developer Mode

SatelliteHost

Your load balancer
DNS name or IP address

ingest.lightstep.com

localhost

SatellitePort

80

8360

UsePlaintext

true

false

true

var satelliteOptions = new SatelliteOptions("ingest.lightstep.com");
var overrideTags = new Dictionary<string, object> 
{
  { LightStepConstants.ComponentNameKey, "{your_service_name}" },
  {"my_tag", "foobar"}
};

var tracerOptions = new Options("YOUR_ACCESS_TOKEN").WithSatellite(satelliteOptions).WithTags(overrideTags);
var lightStepTracer = new Tracer(tracerOptions);

GlobalTracer.Register(lightStepTracer);
  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 = lightStepTracer.BuildSpan("testSpan").Start();
span.Log("This is a log message!");
span.SetTag("testTag", "I'm a tag!");
span.Finish();
// manually flush the tracer to make sure your span is sent.
lightStepTracer.Flush();

// if this is a console app, make sure you Console.ReadKey() or have some other sort of blocking behavior as flushing the tracer is asynchronous.
  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 C#: Add Spans.

Updated 4 months ago


C# Quick Start


Suggested Edits are limited on API Reference Pages

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