diff --git a/README.md b/README.md index a383193f..6f5e2a71 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,15 @@ ## Quick Start -This quick start guide will show you how to getting started. An simple use case `compose.yaml` like so: +This quick start guide will show you how to getting started. + +Open a new terminal window to create `compose.yaml` or get it from [examples/](./examples/) by running: + +```shell +wget https://raw.githubusercontent.com/qclaogui/codelab-monitoring/main/examples/github-exporter/compose.yaml +``` + +An simple use case `compose.yaml` like so: ```yaml # include is available in Docker Compose version 2.20 and later, and Docker Desktop version 4.22 and later. @@ -30,13 +38,11 @@ services: - REPOS=qclaogui/codelab-monitoring ``` -Open a new terminal window create the `compose.yaml` and run: - ```shell COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose up -d --remove-orphans ``` -Once all containers are up and running you can search for metrics(from Mimir) logs(from Loki) traces(from Tempo) and profiles(Pyroscope) in Grafana. Navigate to [http://localhost:3000](http://localhost:3000) +Once all containers are up and running you can search for metrics in Grafana. Navigate to [http://localhost:3000](http://localhost:3000) > In this case you can find `github-exporter` metrics and logs. diff --git a/docker-compose/common/compose-include/loki.yaml b/docker-compose/common/compose-include/loki.yaml new file mode 100644 index 00000000..e530a998 --- /dev/null +++ b/docker-compose/common/compose-include/loki.yaml @@ -0,0 +1,26 @@ +services: + loki: + labels: + - logs.agent.grafana.com/log-format=json + depends_on: + minio: + condition: service_healthy + image: ${LOKI_IMAGE:-docker.io/grafana/loki:2.9.6} + volumes: + - ../config/loki:/etc/loki + command: + - -config.file=/etc/loki/monolithic-mode-logs.yaml + - -target=all + - -config.expand-env=true + healthcheck: + test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3100/ready || exit 1" ] + interval: 10s + timeout: 5s + retries: 10 + # expose 33100 port so we can directly access loki inside container + ports: + - "33100:3100" + networks: + default: + aliases: + - loki-memberlist diff --git a/docker-compose/microservices-mode/traces/compose.yaml b/docker-compose/microservices-mode/traces/compose.yaml index 442481a8..bf28c48a 100644 --- a/docker-compose/microservices-mode/traces/compose.yaml +++ b/docker-compose/microservices-mode/traces/compose.yaml @@ -10,6 +10,7 @@ include: - path: ../../common/compose-include/minio.yaml - path: ../../common/compose-include/memcached.yaml - path: ../../common/compose-include/mimir.yaml + - path: ../../common/compose-include/loki.yaml - path: ../../common/compose-include/grafana-agent.yaml - path: ../../common/compose-include/grafana.yaml @@ -34,6 +35,7 @@ services: - ../../common/config/nginx/nginx.conf:/etc/nginx/templates/nginx.conf.template - ../../common/config/tempo/gateway_tempo.conf:/etc/nginx/templates/gateway_tempo.conf.template - ../../common/config/mimir/gateway_mimir.conf:/etc/nginx/templates/gateway_mimir.conf.template + - ../../common/config/loki/gateway_loki.conf:/etc/nginx/templates/gateway_loki.conf.template environment: - TEMPO_DISTRIBUTOR_HOST=distributor - TEMPO_INGESTER_HOST=ingester diff --git a/docker-compose/monolithic-mode/traces/compose.yaml b/docker-compose/monolithic-mode/traces/compose.yaml index ff0c35e6..aa8fc7f1 100644 --- a/docker-compose/monolithic-mode/traces/compose.yaml +++ b/docker-compose/monolithic-mode/traces/compose.yaml @@ -10,6 +10,7 @@ include: - path: ../../common/compose-include/minio.yaml - path: ../../common/compose-include/memcached.yaml - path: ../../common/compose-include/mimir.yaml + - path: ../../common/compose-include/loki.yaml - path: ../../common/compose-include/grafana.yaml x-environment: &jaeger-environment @@ -72,6 +73,7 @@ services: - ../../common/config/nginx/nginx.conf:/etc/nginx/templates/nginx.conf.template - ../../common/config/tempo/gateway_tempo.conf:/etc/nginx/templates/gateway_tempo.conf.template - ../../common/config/mimir/gateway_mimir.conf:/etc/nginx/templates/gateway_mimir.conf.template + - ../../common/config/loki/gateway_loki.conf:/etc/nginx/templates/gateway_loki.conf.template healthcheck: test: [ "CMD-SHELL", "wget --no-verbose --tries=1 --spider http://localhost:3200/ || exit 1" ] interval: 10s diff --git a/examples/github-exporter/README.md b/examples/github-exporter/README.md index 68b68338..6b2bf995 100644 --- a/examples/github-exporter/README.md +++ b/examples/github-exporter/README.md @@ -33,3 +33,24 @@ Once all containers are up and running you can search for metrics(from Mimir) lo > In this case you can find `github-exporter` metrics and logs. Navigate to [http://localhost:3000](http://localhost:3000) + +## Resource Utilization + +```shell +COMPOSE_EXPERIMENTAL_GIT_REMOTE=true docker compose stats +``` + +```shell +CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS +613d8d5e7e30 root-grafana-agent-1 2.72% 180.7MiB / 1.889GiB 9.34% 1.46MB / 4.61MB 3.15MB / 1.56MB 11 +53443e6d4c31 root-gateway-1 0.00% 8.102MiB / 1.889GiB 0.42% 497kB / 503kB 6.45MB / 20.5kB 3 +750ace278979 root-mimir-1 1.06% 121.2MiB / 1.889GiB 6.27% 5.09MB / 888kB 111kB / 8.7MB 8 +acb81816e078 root-loki-1 1.11% 83.13MiB / 1.889GiB 4.30% 157kB / 336kB 56.2MB / 340kB 8 +f5f28089da9c root-memcached-1 0.03% 6.762MiB / 1.889GiB 0.35% 31.6kB / 128kB 0B / 0B 10 +a91be648c677 root-memcached-exporter-1 0.00% 7.125MiB / 1.889GiB 0.37% 126kB / 75.2kB 0B / 0B 5 +4f755dee256b root-minio-1 3.99% 163.3MiB / 1.889GiB 8.44% 367kB / 889kB 1.77MB / 557kB 12 +fab3799e6a97 root-grafana-1 7.37% 72.63MiB / 1.889GiB 3.76% 666kB / 790kB 1.01MB / 34.2MB 9 +d16d6664924c root-load-rules-to-mimir-1 0.00% 31.69MiB / 1.889GiB 1.64% 54.7kB / 117kB 44.9MB / 4.1kB 1 +72262bb29bd1 root-github-exporter-1 0.00% 9.906MiB / 1.889GiB 0.51% 141kB / 41.4kB 3.4MB / 0B 5 + +```