-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yaml
More file actions
89 lines (85 loc) · 2.48 KB
/
docker-compose.yaml
File metadata and controls
89 lines (85 loc) · 2.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# Local development setup for cased-agent
# Runs the agent in a Linux container with cgroup access
services:
# The metrics agent
agent:
build:
context: .
dockerfile: Dockerfile
environment:
- CASED_API_ENDPOINT=http://host.docker.internal:8000
- CASED_API_KEY=${CASED_API_KEY:-bFTw2c00znFGnolNCXqsmuAjjQ8OaXBa}
- CASED_CLUSTER_ID=local-docker
- NODE_NAME=docker-desktop
- ENABLE_OTEL=true
volumes:
# Mount host cgroups (works on Docker Desktop for Mac/Windows)
- /sys/fs/cgroup:/sys/fs/cgroup:ro
# Mount /proc for node-level metrics
- /proc:/host/proc:ro
ports:
# OpenTelemetry receiver port
- "4318:4318"
# Run every 5 seconds for local dev
command: ["--interval=5s", "--batch-size=50", "--proc-path=/host/proc", "--enable-otel"]
extra_hosts:
- "host.docker.internal:host-gateway"
# Privileged mode required for eBPF (optional - only needed with --enable-ebpf)
# privileged: true
cap_add:
- SYS_ADMIN
- SYS_PTRACE
# A sample workload to generate metrics
workload:
image: alpine:3.19
command: |
sh -c "
echo 'Starting sample workload...'
while true; do
# CPU stress
dd if=/dev/zero of=/dev/null bs=1M count=100 2>/dev/null
# Memory allocation
head -c 10M /dev/urandom > /tmp/test 2>/dev/null
rm -f /tmp/test
sleep 2
done
"
deploy:
resources:
limits:
cpus: '0.5'
memory: 128M
# Sample web service with OTel tracing
web:
image: python:3.12-slim
environment:
- OTEL_ENDPOINT=http://agent:4318/v1/traces
volumes:
- ./demo_web.py:/app/demo_web.py:ro
command: >
sh -c "pip install -q opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp-proto-http && python /app/demo_web.py"
ports:
- "8081:8080"
deploy:
resources:
limits:
cpus: '0.25'
memory: 128M
# Traffic generator to hit the web service
traffic:
image: alpine:3.19
depends_on:
- web
command: |
sh -c "
apk add --no-cache curl
sleep 10
echo 'Starting traffic generator...'
while true; do
curl -s http://web:8080/ > /dev/null
curl -s http://web:8080/api/users > /dev/null
curl -s http://web:8080/api/orders > /dev/null
curl -s http://web:8080/health > /dev/null
sleep 0.5
done
"