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

View of Georgian Bay from the top fo Blue Mountain.
View of Georgian Bay from the top fo Blue Mountain. Photo by Adri Villela.

So you’re new to Observability and OpenTelemetry and Lighststep and you want to send traces to Lighstep 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 importat 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 Lighstep!

OTel Collector 101

The OTel Collector is made up of receivers, processors, and exporters
The OTel Collector. Image by Adri Villela.

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

The OTel Collector consists of 3 main components:

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 Lighstep 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.git

2- Edit the OTel Collector Config file

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

cd opentelemetry-demo

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

# extra settings to be merged into OpenTelemetry Collector configuration
# do not delete this file

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]
metrics:
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:

receivers:
otlp:
protocols:
grpc:
endpoint: 0.0.0.0:4317
http:
endpoint: 0.0.0.0:4318

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 app

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

cd opentelemetry-demo

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:

Sample output on stdout from running the OpenTelemetry Demo Webstore application
Sample output from OTel Demo Webstore. Image by Adri Villela

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:

Sample output on stdout from the Logging Exporter when running the OpenTelemetry Demo Webstore app
Sample Logging Exporter output from the OTel Demo Webstore. Image by Adri Villela.

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

Screen capture of the OpenTelemetry Demo App main screen
OpenTelemetry Demo App main screen

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

4- See the Traces in Lightstep

To view traces in your Lightstep Observability project, check out Lightstep Observability Notebooks.

Screen capture of sample Traces in Lightstep

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 Lighstep, 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.

Cartoon of frog-like man in a shirt and tie holding a coffee cup that says “Yo” while his co-worker, a hovering octopus in a hoodie stands next to him. They are in a kitchen.
“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!

For more Observability articles, check out my Unpacking Observability series:

Unpacking Observability

18 stories
The image shows an adorable hand drawn cow looking though a telescope right at the reader. The cow is white with brown spots and the background is a cool teal.
Brick wall with the words “Look up to the starts” written on it.

Originally published at https://lightstep.com.

--

--

I talk Observability, DevOps, and SRE | Former corporate 🤖 | OTel End-User Working Group Co-Lead | On-Call Me Maybe Podcast co-host

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adri Villela

I talk Observability, DevOps, and SRE | Former corporate 🤖 | OTel End-User Working Group Co-Lead | On-Call Me Maybe Podcast co-host