From 03ffc8bc344cde95ac2796980ea0c718578e4ae4 Mon Sep 17 00:00:00 2001 From: Rajat Vig Date: Wed, 22 Dec 2021 12:15:56 +0000 Subject: [PATCH] Create a new otel directory; Add a readme and makefile --- otel/Makefile | 20 ++++++++++ otel/README.md | 37 +++++++++++++++++++ .../docker-compose.yaml | 4 +- otel-config.yaml => otel/otel-config.yaml | 0 4 files changed, 59 insertions(+), 2 deletions(-) create mode 100644 otel/Makefile create mode 100644 otel/README.md rename docker-compose.yaml => otel/docker-compose.yaml (96%) rename otel-config.yaml => otel/otel-config.yaml (100%) diff --git a/otel/Makefile b/otel/Makefile new file mode 100644 index 0000000..0b9410a --- /dev/null +++ b/otel/Makefile @@ -0,0 +1,20 @@ +DC=docker-compose -f docker-compose.yaml + +.PHONY: help +.DEFAULT_GOAL := help + +help: + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +stop: ## Stop all Docker Containers run in Compose + $(DC) stop + +clean: stop ## Clean all Docker Containers and Volumes + $(DC) down --rmi local --remove-orphans -v + $(DC) rm -f -v + +build: clean ## Rebuild the Docker Image for use by Compose + $(DC) build + +run: stop ## Run the Application + $(DC) up diff --git a/otel/README.md b/otel/README.md new file mode 100644 index 0000000..8a23f58 --- /dev/null +++ b/otel/README.md @@ -0,0 +1,37 @@ +# Tracing Demo + +The directory contains sample [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) +and [Jaeger](https://www.jaegertracing.io) configurations for a tracing demo. + +## Configuration + +The provided [docker-compose.yaml](docker-compose.yaml) sets up 4 Containers + +1. PodInfo Frontend on port 9898 +2. PodInfo Backend on port 9899 +3. OpenTelemetry Collector listening on port 4317 for GRPC +4. Jaeger all-in-one listening on multiple ports + +## How does it work? + +The frontend pods are configured to call onto the backend pods. Both the podinfo +pods are configured to send traces over to the collector at port 4317 using GRPC. +The collector forwards all received spans to Jaeger over port 14250 and Jaeger +exposes a UI over port `16686`. + +## Running it locally + +1. Start all the Containers +```shell +make run +``` +2. Send some sample requests +```shell +curl -v http://localhost:9898/status/200 +curl -X POST -v http://localhost:9898/api/echo +``` +3. Visit `http://localhost:16686/` to see the spans +4. Stop all the containers +```shell +make stop +``` diff --git a/docker-compose.yaml b/otel/docker-compose.yaml similarity index 96% rename from docker-compose.yaml rename to otel/docker-compose.yaml index 4e22604..ab9b56b 100644 --- a/docker-compose.yaml +++ b/otel/docker-compose.yaml @@ -2,14 +2,14 @@ version: '2' services: podinfo_frontend: - build: . + build: .. command: ./podinfo --backend-url http://podinfo_backend:9899/status/200 --otel-service-name=podinfo_frontend environment: - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel:4317 ports: - "9898:9898" podinfo_backend: - build: . + build: .. command: ./podinfo --port 9899 --otel-service-name=podinfo_backend environment: - OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel:4317 diff --git a/otel-config.yaml b/otel/otel-config.yaml similarity index 100% rename from otel-config.yaml rename to otel/otel-config.yaml