Skip to content

Commit 8d7dcf8

Browse files
committed
feat(cat-gateway): add demo for telemetry services
1 parent 3157470 commit 8d7dcf8

File tree

5 files changed

+273
-0
lines changed

5 files changed

+273
-0
lines changed

catalyst-gateway/demo/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Catalyst Gateway Telemetry Demo
2+
3+
The intention for this demonstration is to show how to enable Telemetry for Catalyst Gateway using the OpenTelemetry.
4+
5+
## Steps to run the demo
6+
7+
* Build the docker containers:
8+
9+
```sh
10+
cd catalyst-voices/catalyst-gateway
11+
earthly ./tests+all-images
12+
```
13+
14+
* Start demo docker services
15+
16+
```sh
17+
cd demo
18+
docker compose up
19+
```
20+
21+
This will start all the required services, including Jaeger. You can look at the Jaeger UI at `http://localhost:16686/`.
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
# cspell: words statusgossip socat
2+
3+
services:
4+
event-db:
5+
image: event-db:latest
6+
container_name: event-db
7+
environment:
8+
- DB_HOST=localhost
9+
- DB_PORT=5432
10+
- DB_NAME=CatalystEventDev
11+
- DB_DESCRIPTION="Catalyst Event DB"
12+
- DB_SUPERUSER=postgres
13+
- DB_SUPERUSER_PASSWORD=postgres
14+
- DB_USER=catalyst-event-dev
15+
- DB_USER_PASSWORD=CHANGE_ME
16+
17+
- INIT_AND_DROP_DB=true
18+
- WITH_MIGRATIONS=false
19+
ports:
20+
- 5432:5432
21+
healthcheck:
22+
test:
23+
[
24+
"CMD-SHELL",
25+
"pg_isready -U $${POSTGRES_USER} -d $${POSTGRES_PASSWORD}",
26+
]
27+
interval: 10s
28+
timeout: 5s
29+
retries: 10
30+
31+
# runs old migrations for the separate `postgres` service
32+
# a special package for applying migrations only up to "V2_**" migrations
33+
event-db-v1-migrations:
34+
image: event-db:v1
35+
container_name: event-db-v1-migrations
36+
environment:
37+
- DB_HOST=event-db
38+
- DB_PORT=5432
39+
- DB_NAME=CatalystEventDev
40+
- DB_SUPERUSER=postgres
41+
- DB_SUPERUSER_PASSWORD=postgres
42+
- DB_USER=catalyst-event-dev
43+
- DB_USER_PASSWORD=CHANGE_ME
44+
45+
- INIT_AND_DROP_DB=false
46+
- WITH_SEED_DATA=.
47+
- WITH_MIGRATIONS=true
48+
restart: "no"
49+
depends_on:
50+
event-db:
51+
condition: service_healthy
52+
53+
# runs migrations for the separate `postgres` service
54+
event-db-migrations:
55+
image: event-db:latest
56+
container_name: event-db-migrations
57+
environment:
58+
- DB_HOST=event-db
59+
- DB_PORT=5432
60+
- DB_NAME=CatalystEventDev
61+
- DB_SUPERUSER=postgres
62+
- DB_SUPERUSER_PASSWORD=postgres
63+
- DB_USER=catalyst-event-dev
64+
- DB_USER_PASSWORD=CHANGE_ME
65+
66+
- INIT_AND_DROP_DB=false
67+
- WITH_SEED_DATA=.
68+
- WITH_MIGRATIONS=true
69+
restart: "no"
70+
depends_on:
71+
event-db-v1-migrations:
72+
condition: service_started
73+
74+
scylla-node:
75+
image: scylladb/scylla:latest
76+
container_name: scylla-node
77+
restart: unless-stopped
78+
command: --smp 2 --memory 1G --overprovisioned 1 --api-address 0.0.0.0
79+
ports:
80+
- 9042:9042
81+
healthcheck:
82+
test: cqlsh -e "SHOW VERSION" || exit 1
83+
interval: 15s
84+
timeout: 30s
85+
retries: 10
86+
87+
cat-gateway:
88+
image: cat-gateway:latest
89+
container_name: cat-gateway
90+
healthcheck:
91+
test: "curl -s -i localhost:3030/api/v1/health/started | head -n 1 | grep 204"
92+
start_period: 30s
93+
interval: 30s
94+
timeout: 30s
95+
# approximately a 25 minutes of waiting
96+
retries: 50
97+
environment:
98+
- EVENT_DB_URL=postgres://catalyst-event-dev:CHANGE_ME@${EVENT_DB_URL:-event-db}/CatalystEventDev
99+
- CASSANDRA_PERSISTENT_URL=${INDEX_DB_URL:-scylla-node:9042}
100+
- CASSANDRA_VOLATILE_URL=${INDEX_DB_URL:-scylla-node:9042}
101+
- CHAIN_NETWORK=${ENV_TARGET:-Preprod}
102+
- INTERNAL_API_KEY=123
103+
- YES_I_REALLY_WANT_TO_PANIC=panic attack
104+
- SERVICE_LIVE_COUNTER_THRESHOLD=100
105+
- SERVICE_LIVE_TIMEOUT_INTERVAL=30
106+
- OTEL_EXPORTER_OTLP_ENDPOINT=http://192.168.1.125:4317
107+
- OTEL_SERVICE_NAME=cat-gateway
108+
- RUST_LOG=info,catalyst_gateway=debug
109+
- TELEMETRY_ENABLED=true
110+
# - LOG_LEVEL=error
111+
# - RUST_LOG="error,cat_gateway=debug,cardano_chain_follower=debug,mithril-client=debug"
112+
ports:
113+
- 3030:3030
114+
depends_on:
115+
event-db-migrations:
116+
condition: service_started
117+
scylla-node:
118+
condition: service_healthy
119+
jaeger:
120+
condition: service_started
121+
prometheus:
122+
condition: service_started
123+
124+
# Jaeger (visualization and storage backend)
125+
jaeger:
126+
image: jaegertracing/jaeger:2.12.0
127+
container_name: jaeger
128+
environment:
129+
- COLLECTOR_OTLP_ENABLED=true
130+
volumes:
131+
- ./jaeger.config.yaml:/jaeger/config.yaml
132+
ports:
133+
- "16685:16685" # gRPC UI
134+
- "16686:16686" # Web UI
135+
- "4317:4317" # OTLP gRPC receiver
136+
- "4318:4318" # OTLP HTTP receiver
137+
- "8888:8888" # OTLP Metrics exporter endpoint
138+
command: "--config /jaeger/config.yaml"
139+
140+
prometheus:
141+
image: prom/prometheus:latest
142+
container_name: prometheus
143+
volumes:
144+
- ./prometheus.yml:/etc/prometheus/prometheus.yml
145+
ports:
146+
- "9090:9090"
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Jaeger v2 Configuration - config.yaml
2+
# Receives OpenTelemetry logs and traces with batch processing
3+
4+
service:
5+
telemetry:
6+
resource:
7+
service.name: jaeger
8+
metrics:
9+
level: detailed
10+
readers:
11+
- pull:
12+
exporter:
13+
prometheus:
14+
host: 0.0.0.0
15+
port: 8888
16+
logs:
17+
level: debug
18+
extensions: [jaeger_storage, jaeger_query, healthcheckv2]
19+
pipelines:
20+
traces:
21+
receivers: [otlp]
22+
processors: [batch]
23+
exporters: [jaeger_storage_exporter]
24+
logs:
25+
receivers: [otlp]
26+
processors: [batch]
27+
exporters: [debug]
28+
29+
extensions:
30+
healthcheckv2:
31+
use_v2: true
32+
http:
33+
34+
jaeger_query:
35+
storage:
36+
traces: memstore
37+
grpc:
38+
endpoint: 0.0.0.0:16685
39+
http:
40+
endpoint: 0.0.0.0:16686
41+
42+
jaeger_storage:
43+
backends:
44+
memstore:
45+
memory:
46+
max_traces: 100000
47+
48+
receivers:
49+
otlp:
50+
protocols:
51+
grpc:
52+
endpoint: 0.0.0.0:4317
53+
http:
54+
endpoint: 0.0.0.0:4318
55+
56+
processors:
57+
batch:
58+
timeout: 1s
59+
send_batch_size: 1024
60+
send_batch_max_size: 2048
61+
62+
exporters:
63+
jaeger_storage_exporter:
64+
trace_storage: memstore
65+
queue:
66+
num_consumers: 10
67+
queue_size: 100
68+
69+
debug:
70+
verbosity: detailed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
receivers:
2+
otlp:
3+
protocols:
4+
grpc:
5+
endpoint: 0.0.0.0:4317
6+
http:
7+
endpoint: 0.0.0.0:4318
8+
9+
processors:
10+
batch:
11+
timeout: 1s
12+
send_batch_size: 1024
13+
14+
exporters:
15+
otlp:
16+
endpoint: otel-collector:4317
17+
tls:
18+
insecure: true
19+
prometheus:
20+
endpoint: prometheus:9090
21+
debug:
22+
verbosity: detailed
23+
24+
service:
25+
pipelines:
26+
traces:
27+
receivers: [otlp]
28+
processors: [batch]
29+
exporters: [otlp, prometheus, debug]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
global:
2+
scrape_interval: 60s
3+
4+
scrape_configs:
5+
- job_name: 'otel-collector'
6+
static_configs:
7+
- targets: ['192.168.1.125:9090', '192.168.1.125:3030']

0 commit comments

Comments
 (0)