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 LightStep tracer and then use the LightStep API 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. Install the LightStep tracer using CocoaPods.

    1
    
    pod 'lightstep', '~>3.2'
    
  3. Run pod install in your project directory. Open the newly created workspace file.

  4. In your application, configure the LightStep tracer and register it as the OpenTracing global tracer. As part of the configuration, you need to add your access token.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    
    #import "LSTracer.h"
    #import "OTGlobal.h"
    
    - (BOOL)application:(UIApplication *)application
        didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    
        // Initialize the LightStep tracer implementation
        LSTracer* tracer = [[LSTracer alloc] initWithToken:@"{your_access_token}"];
        [OTGlobal initSharedTracer:tracer];
    
        // <Your normal initialization code here>
    
        return YES;
    }
    
  5. Test that everything is connected by sending a test span.

    1
    2
    3
    4
    5
    6
    
    - (void)someFunction:... {
    
        id<OTSpan> span = [[OTGlobal sharedTracer] startSpan:@"someFunction:"];
        ...
        [span finish];
    }
    
  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 Objective-C: Add Spans.