Lightstep from ServiceNow Logo

Products

Solutions

Documentation

Resources

Lightstep from ServiceNow Logo
< all blogs

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

View of Georgian Bay from top of Blue Mountain

So you're new to Observabilitynew to Observability and OpenTelemetryOpenTelemetry 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 WebstoreOpenTelemetry 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 TracesTraces produced by the OpenTelemetry Demo WebstoreOpenTelemetry Demo Webstore into Lightstep. The example uses the OpenTelemetry (OTel) CollectorOpenTelemetry (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:

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:

PipelinesPipelines 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 siteofficial 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 Collectorseveral ways to deploy the OTel Collector; however, we're keeping things simple and local today, using Docker ComposeDocker Compose, which runs DockerDocker.

Configuration

The OTel Collector is configured via YAMLconfigured via YAML.

The YAML file is used to define receiversreceivers, processorsprocessors, exportersexporters, and pipelinespipelines.

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 Webstoremodified 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 repoupstream 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 fileOTel Collector Config file

This file allows you to configure the OpenTelemetry Collector with your own Observability back-end. This case, otelcol-config-extras.ymlotelcol-config-extras.yml is already configured to use Lightstep as the back-end. All you need to do is add your Lightstep Access TokenLightstep Access Token to the file, to be able to send traces to Lightstep.

cd opentelemetry-demo-webstore

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

exporters:
   logging:
     logLevel: debug
   otlp/ls:
     endpoint: ingest.lightstep.com:443
     headers: 
       "lightstep-access-token": "${LIGHTSTEP_ACCESS_TOKEN}"

service:
   pipelines:
     traces:
       receivers: [otlp]
       processors: [batch]
       exporters: [logging, otlp/ls]

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

A few noteworthy items:

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)OpenTelemetry Protocol (OTLP) format, so we will use the OTLP ExporterOTLP 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 ExporterLogging 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:

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:

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. 😱

3- 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. If you’re on an x86-64 machine (i.e. Intel or AMD-based, non-Apple Silicon), run the command below. If you’re running the Demo App for the first time, it will download all of the Docker images first. This may take several minutes.

docker compose up --no-build

If you’re on an Apple Silicon machine, you will need to build all images from source using the command below, as the images hosted in the GitHub Container Registry (GHCR) are built and optimized for x86-64 machines. This can take upwards of 20 minutes.

docker compose build
docker compose up

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 ExporterLogging 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 KubernetesKubernetes or NomadNomad, or running standalone with DockerDocker.

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

OTel Demo App UI running on http://localhost:8080

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

4- See the Traces in Lightstep

ls-trace-view

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 Webstoremodified 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 DiscordLightstep Community Discord, or get in touch by e-mailget 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 AppOpenTelemetry Demo Webstore App is always looking for feedback and contributors. Please consider joining the OTel Communityjoining the OTel Community to help make OpenTelemetry AWESOME!

June 13, 2022
•
7 min read
OpenTelemetry

Share this article

About the author

Adriana Villela

Adriana Villela

Read moreRead more

From Day 0 to Day 2: Reducing the anxiety of scaling up cloud-native deployments

Jason English | Mar 7, 2023

The global cloud-native development community is facing a reckoning. There are too many tools, too much telemetry data, and not enough skilled people to make sense of it all.  See how you can.

Learn moreLearn more

OpenTelemetry Collector in Kubernetes: Get started with autoscaling

Moh Osman | Jan 6, 2023

Learn how to leverage a Horizontal Pod Autoscaler alongside the OpenTelemetry Collector in Kubernetes. This will enable a cluster to handle varying telemetry workloads as the collector pool aligns to demand.

Learn moreLearn more

Observability-Landscape-as-Code in Practice

Adriana Villela, Ana Margarita Medina | Oct 25, 2022

Learn how to put Observability-Landscape-as-Code in this hands-on tutorial. In it, you'll use Terraform to create a Kubernetes cluster, configure and deploy the OTel Demo App to send Traces and Metrics to Lightstep, and create dashboards in Lightstep.

Learn moreLearn more
THE CLOUD-NATIVE RELIABILITY PLATFORM

Lightstep sounds like a lovely idea

Monitoring and observability for the world’s most reliable systems