Create a new otel directory; Add a readme and makefile

This commit is contained in:
Rajat Vig
2021-12-22 12:15:56 +00:00
parent c4f2a6c5e6
commit 03ffc8bc34
4 changed files with 59 additions and 2 deletions

20
otel/Makefile Normal file
View File

@@ -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

37
otel/README.md Normal file
View File

@@ -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
```

View File

@@ -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