Skip to content

Commit

Permalink
Create a new otel directory; Add a readme and makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatvig committed Dec 22, 2021
1 parent c4f2a6c commit 03ffc8b
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
20 changes: 20 additions & 0 deletions otel/Makefile
Original file line number Diff line number Diff line change
@@ -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 changes: 37 additions & 0 deletions otel/README.md
Original file line number Diff line number Diff line change
@@ -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
```
4 changes: 2 additions & 2 deletions docker-compose.yaml → otel/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
File renamed without changes.

0 comments on commit 03ffc8b

Please sign in to comment.