Skip to content

enesonus/jaeger-demo

Repository files navigation

img_1.png

Jaeger Demo

Jaeger is a distributed tracing system. It is used for monitoring and troubleshooting microservices-based distributed systems. It is compatible with OpenTracing and OpenTelemetry.

This demo demonstrates a system consisting of 4 services that return a list of albums and their details. The services are written in Go and the demo is deployed to a Kubernetes cluster using Helm.

In this example we will use Jaeger with Elasticsearch v7 as the storage backend.

Getting Started

Prerequisites

Prepare The Cluster

Cluster Creation

Create a Kubernetes cluster using kind with ingress configurations so that we can access the service locally:

cat <<EOF | kind create cluster --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  kubeadmConfigPatches:
  - |
    kind: InitConfiguration
    nodeRegistration:
      kubeletExtraArgs:
        node-labels: "ingress-ready=true"
  extraPortMappings:
  - containerPort: 80
    hostPort: 80
    protocol: TCP
  - containerPort: 443
    hostPort: 443
    protocol: TCP
EOF

Ingress Controller For Accessing Services

Install ingress controller for accessing services in the cluster:

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/kind/deploy.yaml
kubectl wait --namespace ingress-nginx \
  --for=condition=ready pod \
  --selector=app.kubernetes.io/component=controller \
  --timeout=90s

Deploying Jaeger with Elasticsearch v7

We will start the Jaeger and Elasticsearch v7 using Helm.

helm repo add jaegertracing https://jaegertracing.github.io/helm-charts
helm -n default install --wait jaeger jaegertracing/jaeger \
  --set provisionDataStore.cassandra=false \
  --set provisionDataStore.elasticsearch=true \
  --set storage.type=elasticsearch \
  --set elasticsearch.replicas=1 \
  --set elasticsearch.minimumMasterNodes=1 \
  --set collector.service.otlp.grpc.name=otlp \
  --set collector.service.otlp.http.name=otlp-http \
  --set query.ingress.enabled=true \
  --set 'query.ingress.hosts[0]=jaeger-127-0-0-1.nip.io'

This helm installation creates pods that enable us to do tracing. Pods are:

  • Jaeger Agent: Collects traces from the application and sends them to the collector.
  • Jaeger Collector: Receives traces from the agent and stores them in the storage backend (Elasticsearch for this application).
  • Jaeger Query: Provides a UI to query traces.
  • Elasticsearch: Storage backend to store traces.

This helm installation also enables OTLP over gRPC and OTLP-HTTP for the collector service. We will use OTLP over gRPC to send traces to the collector.

Deploy Our Application

By default domain name is enesonus-127-0-0-1.nip.io. You can change it by setting ingress.domain parameter.

helm install --wait jaeger-demo oci://ghcr.io/enesonus/jaeger-demo/jaeger-demo --version 0.2.6 \
  --set ingress.domain=enesonus-127-0-0-1.nip.io

After this command we will have 4 services running in our cluster. These are:

  • Public Service: Returns details of the album with the given id
  • Price Service: Returns the price of an album with the given id
  • Title Service: Returns the title of an album with the given id
  • Artist Service: Returns the artist name of an album with the given id

Accessing The Application

Now our domain name is enesonus-127-0-0-1.nip.io. We can access our application using this domain name.

curl 'enesonus-127-0-0-1.nip.io/album?id=1'

This should return an album (id=1) with title, price and artist name. An example is:

{ 
  "id":"1", 
  "title":"Blue Train",
  "artist":"John Coltrane",
  "price":56.99
}

Query Traces

Query Traces Using Jaeger UI

We can query traces using Jaeger UI. Go to http://jaeger-127-0-0-1.nip.io and query traces!

About

This github repo is for understanding the how Jaeger and OTel collector operates

Resources

Stars

Watchers

Forks