Add Grafana and Loki to demo (#1882)
* Add Grafana and Loki to demo * Refine docs * Fix possible socket exhaustion Co-authored-by: Piotr Kiełkowicz <pkiekowicz@splunk.com> Co-authored-by: Rasmus Kuusmann <rkuusmann@splunk.com> Co-authored-by: Paulo Janotti <pjanotti@splunk.com>
This commit is contained in:
parent
1aa9403c7d
commit
be4adec4bd
|
|
@ -18,5 +18,6 @@ jobs:
|
|||
steps:
|
||||
- uses: actions/checkout@v3.2.0
|
||||
- name: Test demo
|
||||
run: make all
|
||||
run: make test
|
||||
working-directory: examples/demo
|
||||
timeout-minutes: 10
|
||||
|
|
|
|||
|
|
@ -27,8 +27,11 @@ if (args.Length != 1)
|
|||
return 2;
|
||||
}
|
||||
|
||||
var uri = args[0];
|
||||
var url = args[0];
|
||||
using var httpClient = new HttpClient();
|
||||
var content = await httpClient.GetStringAsync(uri);
|
||||
Console.WriteLine(content);
|
||||
return 0;
|
||||
while (true)
|
||||
{
|
||||
Thread.Sleep(5000);
|
||||
var content = await httpClient.GetStringAsync(url);
|
||||
Console.WriteLine(content);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,22 +2,16 @@
|
|||
run:
|
||||
mkdir -p log
|
||||
chmod 777 log
|
||||
docker-compose build
|
||||
docker-compose up -d service
|
||||
sleep 30 # wait for bootstrap
|
||||
docker-compose run client
|
||||
sleep 10 # wait for telemetry export
|
||||
docker-compose up -d --build
|
||||
|
||||
.PHONY: clean
|
||||
clean:
|
||||
docker-compose down --remove-orphans
|
||||
rm -rf log
|
||||
|
||||
.PHONY: test
|
||||
test:
|
||||
test -f "./log/traces.log" || (echo "traces not exported"; exit 1)
|
||||
test -f "./log/metrics.log" || (echo "metrics not exported"; exit 1)
|
||||
test -f "./log/logs.log" || (echo "logs not exported"; exit 1)
|
||||
.PHONY: wait
|
||||
wait:
|
||||
until [ -f "./log/traces.log" ] && [ -f "./log/metrics.log" ] && [ -f "./log/logs.log" ]; do sleep 5; done
|
||||
|
||||
.PHONY: all
|
||||
all: run test clean
|
||||
.PHONY: test
|
||||
test: run wait clean
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ It consists of following services:
|
|||
which collects the telemetry send by `client` and `service`
|
||||
5. `jaeger` - [Jaeger](https://www.jaegertracing.io/) as traces backend
|
||||
6. `prometheus` - [Prometheus](https://prometheus.io/) as metrics backend
|
||||
7. `loki` - [Grafana Loki](https://grafana.com/oss/loki/) as logs backend
|
||||
8. `grafana` - [Grafana](https://grafana.com/oss/grafana/) as telemetry UI
|
||||
|
||||
## Usage
|
||||
|
||||
Windows (Git Bash):
|
||||
|
||||
```sh
|
||||
docker-compose build
|
||||
docker-compose up -d service
|
||||
docker-compose run client
|
||||
docker-compose up -d --build
|
||||
```
|
||||
|
||||
macOS and Linux:
|
||||
|
|
@ -34,10 +34,8 @@ macOS and Linux:
|
|||
make
|
||||
```
|
||||
|
||||
The following Web UI endpoints are exposed:
|
||||
|
||||
- <http://localhost:16686/search> - traces (Jaeger)
|
||||
- <http://localhost:9090/graph> - metrics (Prometheus)
|
||||
You can [explore](https://grafana.com/docs/grafana/v9.3/explore/)
|
||||
the telemetry in [Grafana UI](http://localhost:3000/).
|
||||
|
||||
You can also find the exported telemetry in the `log` directory.
|
||||
|
||||
|
|
|
|||
|
|
@ -51,6 +51,7 @@ services:
|
|||
command: --config /etc/otel/config.yaml
|
||||
environment:
|
||||
JAEGER_ENDPOINT: "jaeger:4317"
|
||||
LOKI_ENDPOINT: "http://loki:3100/loki/api/v1/push"
|
||||
ports:
|
||||
- "8889:8889" # Prometheus metrics exporter (scrape endpoint)
|
||||
- "13133:13133" # health_check extension
|
||||
|
|
@ -58,6 +59,7 @@ services:
|
|||
depends_on:
|
||||
- jaeger
|
||||
- prometheus
|
||||
- loki
|
||||
|
||||
jaeger:
|
||||
image: jaegertracing/all-in-one:1.38.1
|
||||
|
|
@ -72,3 +74,18 @@ services:
|
|||
- ./prometheus.yml:/etc/prometheus/prometheus.yml
|
||||
ports:
|
||||
- "9090:9090"
|
||||
|
||||
loki:
|
||||
image: grafana/loki:2.7.1
|
||||
ports:
|
||||
- "3100:3100"
|
||||
|
||||
grafana:
|
||||
image: grafana/grafana:9.3.2
|
||||
volumes:
|
||||
- ./grafana-datasources.yml:/etc/grafana/provisioning/datasources/datasources.yml
|
||||
environment:
|
||||
GF_AUTH_ANONYMOUS_ENABLED: "true"
|
||||
GF_AUTH_ANONYMOUS_ORG_ROLE: "Admin"
|
||||
ports:
|
||||
- "3000:3000"
|
||||
|
|
|
|||
|
|
@ -0,0 +1,20 @@
|
|||
apiVersion: 1
|
||||
|
||||
datasources:
|
||||
- name: Prometheus
|
||||
uid: prom
|
||||
type: prometheus
|
||||
access: proxy
|
||||
url: http://prometheus:9090
|
||||
|
||||
- name: Loki
|
||||
uid: loki
|
||||
type: loki
|
||||
access: proxy
|
||||
url: http://loki:3100
|
||||
|
||||
- name: Jaeger
|
||||
type: jaeger
|
||||
uid: jaeger
|
||||
access: proxy
|
||||
url: http://jaeger:16686
|
||||
|
|
@ -32,6 +32,10 @@ exporters:
|
|||
insecure: true
|
||||
prometheus:
|
||||
endpoint: "0.0.0.0:8889"
|
||||
loki:
|
||||
endpoint: "${LOKI_ENDPOINT}"
|
||||
tls:
|
||||
insecure: true
|
||||
|
||||
service:
|
||||
pipelines:
|
||||
|
|
@ -60,7 +64,7 @@ service:
|
|||
exporters:
|
||||
- logging
|
||||
- file/logs
|
||||
- otlp
|
||||
- loki
|
||||
extensions:
|
||||
- health_check
|
||||
- zpages
|
||||
|
|
|
|||
Loading…
Reference in New Issue