Lightstep from ServiceNow Logo

Products

Solutions

Developers

Resources

Login

Lightstep from ServiceNow Logo
OpenTelemetry

Observability Mythbusters: How hard is it to get started with OpenTelemetry?


Adriana Villela

by Adriana Villela

Observability Mythbusters: How hard is it to get started with OpenTelemetry?

Explore more OpenTelemetry Blogs

View of Georgian Bay from top of Blue Mountain

So you're new to Observability and OpenTelemetry and Lightstep and you want to send traces to Lightstep to get a feel for the flow of things. But you're not sure how to get started. There's a LOT to learn and take in, and things can get pretty overwhelming, pretty fast, amirite? I feel ya. I've been there before. That was me last year. Solidarity!!

But, not to worry, my friend, because I am here to walk you through things. If you're looking to do a quickie setup to learn how to send OpenTelemetry data over to Lightstep, then you, my friend, have come to the right place!

The OpenTelemetry Demo Webstore repo was created to help lower the barrier to entry into OpenTelemetry and to illustrate its awesomeness. It features a fully-functioning online store made up of multiple micro-services, written in different languages that are supported by OpenTelemetry, that can send traces to an Observability back end, like Lightstep. (OMG that was a mouthful!) Most importantly, I found it superly duperly easy to set up and get going!

In today's tutorial, I will show you how to get Traces produced by the OpenTelemetry Demo Webstore into Lightstep. The example uses the OpenTelemetry (OTel) Collector to ingest the Traces and send them to an Observability back-end, which in our case, will be Lightstep.

A few important notes:

  • I am assuming that you have a basic understanding of OpenTelemetry and Observability. If not, check out this great OpenTelemetry overview and Observability oberview.
  • I will not be covering application instrumentation with OpenTelemetry - our goal is merely to get Trace data into Lightstep via the OTel Collactor.

Before we start the tutorial, let's do a quick OTel Collector overview, so that you can understand how you're getting data into Lightstep!

OTel Collector 101

The OpenTelemetry (OTel) Collector is a vendor-neutral service that ingests, transforms, and exports data to one or more Observability back-ends.

OTel Collector

The OTel Collector consists of 3 main components:

  • Receivers ingest data. Example data sources include: Kubernetes clusters, Prometheus, and application code.
  • Processors transform data. This can include adding/removing data, modifying data (e.g. data masking), and even filtering data.
  • Exporters send data to an Observability back-end. In our case, Lightstep. Lightstep ingests OTel data natively, using the OpenTelemetry Protocol (OTLP).

Pipelines are used to define how data flows in and out of the OTel Collector.

For more on the OTel Collector, please see the official OTel docs site.

NOTE: Although your instrumented code could technically send data directly to an Observability back-end (e.g. Lightstep) without a Collector, it's not really the right way to go about it. You should always funnel all OTel data (regardless of the soure) to your back-end by way of the OTel Collector.

Running the OTel Collector

There are several ways to deploy the OTel Collector; however, we're keeping things simple and local today, using Docker Compose, which runs Docker.

Configuration

The OTel Collector is configured via YAML.

The YAML file is used to define receivers, processors, exporters, and pipelines.

Tutorial

Ah, now the moment y'all have been waiting for - the tutorial! Let's do this!

For this tutorial, we will be using a modified version of the OpenTelemetry Demo Webstore repo. This repo has been modified to demonstrate how to send data to Lightstep using the OTel Collector. While the upstream repo contains configs to send data to a local installation of Jaeger, the modified version contains configs to send data to Lightstep. We will be keeping the Lightstep repo in sync with the upstream repo.

Pre-Requisites

Running the Webstore App Locally

  1. Clone the repo

    git clone https://github.com/lightstep/opentelemetry-demo-webstore.git
  2. Edit the OTel Collector Config file

    cd opentelemetry-demo-webstore

    Open otelcollector/otelcol-config.yml for editing using your favourite editor. The file looks like this:

    receivers:
      otlp:
        protocols:
          grpc:
          http:
    
    exporters:
      logging:
        logLevel: debug
      otlp/ls:
        endpoint: ingest.lightstep.com:443
        headers: 
          "lightstep-access-token": "${LIGHTSTEP_ACCESS_TOKEN}"
    
    processors:
      batch:
    
    service:
      pipelines:
        traces:
          receivers: [otlp]
          processors: [batch]
          exporters: [logging, otlp/ls]

    Replace ${LIGHTSTEP_ACCESS_TOKEN} with your own Lightstep Access Token, and save the file. The Access Token tells what Lightstep project to send your telemetry data to.

    A few noteworthy items:

    • The Collector can ingest data using both HTTP and gRPC. The receivers configuration may appear to be empty; however, it actually means that we are using the defult values for the receivers config. It is actually the same as saying:
    receivers:
      otlp:
        protocols:
          grpc:
            endpoint: 0.0.0.0:4317
          http:
            endpoint: 0.0.0.0:4318
    • Lightstep ingests data in native OpenTelemetry Protocol (OTLP) format, so we will use the OTLP Exporter. The exporter can be called either otlp or follow the naming format otlp/<something>. We could call it otlp/bob if we wanted to. We're calling our exporter otlp/ls to signal to us that we are using the OTLP exporter to send the data to Lightstep.
    • Though not mandatory, we are also using a Logging Exporter. This is helpful, as it prints our traces to the Collector's stdout. As you might imagine, this is great for debugging, especially if you see traces sent to stdout, but not to your back-end.
    • We must define a pipeline in the service.pipelines section of the YAML config. Specifically, we need to define a pipeline for our taces. The pipeline tells the Collector:
      • Where it's getting Trace data from (it's being sent via OTLP)
      • If there's any processing that needs to be done (this is optional)
      • Where to send data to. In our case, it's to stdout (via the Logging Exporter) and to Lightstep (via OTLP Exporter)

TIP: If you find that you can't see data in Lightstep, make sure that you've defined a pipeline, and that the pipeline's exporter lists your otlp/ls exporter. I can tell you that twice this week I forgot to add my exporter to the pipeline, and was sitting in front of my computer in sheer panic trying to figure out why I could see my traces in stdout but not in Lightstep. 😱

  1. Launch the sample app

    If you're not already in the repo root, make sure you go there:

    cd opentelemetry-demo-webstore/

    Run Docker compose

    docker compose up

    NOTE: If you're building the Docker images for the first time, this may about 20 minutes. Be patient. Unlike me. 😊

    Once the app is up and running, you will see text continuously scrolling down the screen. This is expected!! The sample output looks something like this:

    otel-webstore-app-output

    ASIDE: After the app started up, I kept waiting for the scrolling text to stop, only to realize that, "Oh, this thing is running. Guess I can access the URL now!" 🙄

    Since we added our Logging Exporter to our pipeline definition, you'll also see that zoom by past you in the terminal:

    otel-collector-stdout

    NOTE: Obviously the Logging Exporter is more useful when it's not running with a bunch of other services competing for your attention on your terminal. This will be more useful if you're running it in Kubernetes or Nomad, or running standalone with Docker.

    You can now access the Webstore app: http://localhost:8080

    Be sure to play around. Browse. Add items to your cart. Remove items from your cart. Checkout.

  2. See the Traces in Lightstep

Log into Lightstep. You'll be able to see the services listed in the Service Directory, as per below:

ls-service-directory

And that's it! Didn't I tell you? Pretty straightforward!

Conclusion

Today we saw how easy it was to get Trace data into Lightstep using the modified version of the OpenTelemetry Demo Webstore, which uses our good friend, the OTel Collector.

Now that you've been able to get Trace data into Lightstep, I encourage you to play around with it. If you have any questions about Observability or OTel, pop into the Lightstep Community Discord, or get in touch by e-mail.

And to reward you for your work today, please enjoy this cartoon drawn by my daughter.

The Coffee Break by Hannah Maxwell

Peace, love, and code. 🦄 🌈 💫


The OpenTelemetry Demo Webstore App is always looking for feedback and contributors. Please consider joining the OTel Community to help make OpenTelemetry AWESOME!

Explore more OpenTelemetry Blogs