nearform / otlp-blueprint

Open Telemetry + Jaeger + 3-tier application Blueprint
7 stars 1 forks source link

CI

Open Telemetry Blueprint

A 3-tier application showcasing Open Telemetry and Jaeger on AWS:

Trace Flow Diagram

Flow Diagram

Features

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).

Resources

Running the application locally

Pre-requisites

Install npm packages

Run frontend app

Run backend end

Note that at this point in time we dont have db connectivity from the backend.

Run postgres database in a docker container

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

Run jaeger all-in-one docker container

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.

Run prometheus docker container

Port Protocol Function
9090 HTTP serve frontend

Running the application locally using docker compose

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 service

backend service

frontend service

open telemetry collector service

jaeger service

prometheus service

Run app in docker compose

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.

Features borrowed from the NearForm Bench Template

A feature-packed template to start a new repository on the bench, including:

Infrastructure

Refer the dedicated readme on this here