Skip to content

Sample application illustrating multiple aspects of observability with OpenTelemetry

Notifications You must be signed in to change notification settings

trstringer/otel-shopping-cart

Repository files navigation

OpenTelemetry shopping cart application

Sample application to highlight distributed tracing and other aspects with OpenTelemetry including:

  • Microservices
  • Traffic generator
  • Quality of service interruptor
  • Traces, metrics, and logs all through OpenTelemetry
  • A variety of observability backends for consumption

Why?

OpenTelemetry can be thought of as observability middleware:

Middleware

These three "layers" can be considered a full implementation. This repo aims at providing all of them (the microservices applications, the OpenTelemetry implementation, and observability backends).

Instead of taking an opinionated approach on what observability backends should be included, this ships multiple:

  • Metrics - Prometheus
  • Traces - Jaeger and Grafana Tempo
  • Logs - Elasticsearch and Grafana Loki

Usage

There are a few ways to "use" this repository...

Everything running local in a new kind cluster

make run-local

Everything in an existing cluster

make install-tools-and-app

Just the sample application

make install-app

Just the observability tools

make install-tools

Viewing telemetry

Traces

Jaeger

$ make port-forward-jaeger

Jaeger

Tempo

$ make port-forward-grafana

Tempo

Metrics

$ make port-forward-grafana

Prometheus

Logs

Elasticsearch

$ make port-forward-kibana

Elasticsearch

Loki

$ make port-forward-grafana

Loki

Cleanup

To cleanup the local environment:

$ make stop-local

Application design

Application design

There are three services in this application:

  • Cart - Service handling user requests for shopping cart data (written in Go)
  • User - Handles user verification and lookup requests from the cart service (written in Go)
  • Price - Serves update pricing information for products (written in Python)

The backend persistent application data storage is with PostgreSQL.

Instrumentation is entirely with OpenTelemetry's APIs and SDKs. Telemetry collection is achieved through the OpenTelemetry Collector sending trace data to Jaeger.