A 3-tier application showcasing Open Telemetry and Jaeger on AWS:
The project implements traces and metrics. It does not implement logs as those features are still in developement (check opentelemetry-js feature status page for more details).
npm install
from the root of the projct directorynpm install
npm install
npm run dev
npm run start
Note that at this point in time we dont have db connectivity from the backend.
Download the specific image of PostgreSQL by running docker pull postgres:14.2-alpine
Run below docker command to spin up a local postgres db instance
docker run /
--name <container_name> /
-p 5455:5432 /
-e POSTGRES_USER=<postgres_user> /
-e POSTGRES_PASSWORD=<postgres_user_password> /
-e POSTGRES_DB=<db_name> /
-d /
postgres:14.2-alpine /
Download the specific image of open telemetry collector by running docker pull otel/opentelemetry-collector:0.56.0
Run below docker command to spin up a local open telemetry collector instance
docker run -v $(pwd)/collector-config.yaml:/etc/otelcol/collector-config.yaml \
-p "1888:1888" \
-p "8888:8888" \
-p "8889:8889" \
-p "13133:13133" \
-p "4317:4317" \
-p "4318:4318" \
-p "55679:55679" \
otel/opentelemetry-collector:0.56.0
You can validate the container logs to see if the collector is running correctly The container exposes the following ports:
Port | Protocol | Function |
---|---|---|
1888 | HTTP | pprof extension |
8888 | HTTP | Prometheus metrics exposed by the collector |
8889 | HTTP | Prometheus exporter metrics |
13133 | HTTP | health_check extension |
4317 | HTTP | OTLP gRPC receiver |
4318 | HTTP | OTLP http receiver |
55679 | HTTP | zpages extension |
docker pull jaegertracing/all-in-one:1.38.1
docker run -d --name jaeger \
-e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
-p 5775:5775/udp \
-p 6831:6831/udp \
-p 6832:6832/udp \
-p 5778:5778 \
-p 16686:16686 \
-p 14250:14250 \
-p 14268:14268 \
-p 14269:14269 \
-p 9411:9411 \
jaegertracing/all-in-one:latest
You can then navigate to http://localhost:16686 to access the Jaeger UI. The container exposes the following ports:
Port | Protocol | Component | Function |
---|---|---|---|
5775 | UDP | agent | accept zipkin.thrift over compact thrift protocol (deprecated, used by legacy clients only) |
6831 | UDP | agent | accept jaeger.thrift over compact thrift protocol |
6832 | UDP | agent | accept jaeger.thrift over binary thrift protocol |
5778 | HTTP | agent | serve configs |
16686 | HTTP | query | serve frontend |
14268 | HTTP | collector | accept jaeger.thrift directly from clients |
14250 | HTTP | collector | accept model.proto |
9411 | HTTP | collector | Zipkin compatible endpoint (optional) |
14269 | HTTP | health endpoint | admin port: health check at / and metrics at /metrics |
Use postman to hit the health endpoint above to check the health status.
docker pull prom/prometheus:v2.43.0
docker run -d --name prometheus \
-p 9090:9090 \
prom/prometheus:v2.43.0
You can then navigate to http://localhost:9090 to access the Prometheus UI. The container exposes the following ports:
Port | Protocol | Function |
---|---|---|
9090 | HTTP | serve frontend |
At the root of the project a docker compose file is defined all the containers needed to run the app locally for development and test.
Before running the docker compose setup run below command to generate .env
file from sample from the root of both backend and frontend service. This is a one time setup. If the .env
already exists and you wanted to get it from template again then delete the .env
file before running below command.
npm run create:env
There are five services defined in the docker compose
postgres:14.2-alpine
from dockerhub. /postgresql/docker_postgres_init.sql
which creates the database needed and seed sample data as a starter. postgresql/data
is mounted as a volume in the container where the db files are persisted for subsequent restarts of the container.node:14-alpine
official image..sample.env
file is copied to .env file so any new addition to env variables should go into sample file first.node:lts-alpine
..sample.env
file is copied to .env file so any new addition to env variables should go into sample file first.opentelemetry-collector:0.56.0
from dockerhub.collector-config.yaml
that has all the configurations regarding receivers, processors, and exporters is mounted as a volume inside of the container.jaegertracing/all-in-one:1.38.1
image which is a all in one image which is suitable for local development.prom/prometheus:v2.43.0
image. Run below command from CLI from the root of the project directory to run the build the container and run the app.
docker-compose --verbose up --build
or
docker-compose up -d
The application will be available at http://localhost:8080 , the backend is on http://localhost:3000 and the database can be reached at localhost:5432.
A feature-packed template to start a new repository on the bench, including:
Refer the dedicated readme on this here