Skip to content

Commit 66dac89

Browse files
author
Uzziah Eyee
committed
Added the jaeger-agent which will receive traces from instrumented services and send them to the collector.
1 parent 47628de commit 66dac89

File tree

4 files changed

+59
-0
lines changed

4 files changed

+59
-0
lines changed

docker-compose.dev.yml

+15
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,21 @@ services:
4545
- "24224:24224/udp"
4646
env_file: log-shipper/.env
4747

48+
jaeger-agent:
49+
build: jaeger-agent
50+
environment:
51+
# more options: https://www.jaegertracing.io/docs/1.11/deployment/#all-options-1
52+
REPORTER_TYPE: grpc
53+
REPORTER_GRPC_HOST_PORT: jaeger-collector:14250
54+
PROCESSOR_JAEGER_BINARY_SERVER_HOST_PORT: :6832
55+
command: wait.sh http://jaeger-collector:14269 5 20 "jaeger-agent"
56+
ports:
57+
- "6832:6832" # receiving traces via UDP
58+
- "5778:5778" # get sampling strategies
59+
networks:
60+
- aparnet
61+
depends_on:
62+
- jaeger-collector
4863

4964
jaeger-collector:
5065
build: jaeger-collector

jaeger-agent/Dockerfile

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM alpine:3.9.3
2+
3+
# required by wait script
4+
RUN apk add --no-cache bash curl
5+
6+
COPY jaeger-agent wait.sh /usr/local/bin/
7+
8+
RUN chmod +x /usr/local/bin/wait.sh

jaeger-agent/jaeger-agent

21.4 MB
Binary file not shown.

jaeger-agent/wait.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
# Requires a container with Bash and Curl installed.
4+
5+
is_healthy () {
6+
retryInterval=${2:-5}
7+
maxAttempts=${3:-1000000}
8+
9+
i=0
10+
while [ $i -lt $maxAttempts ]
11+
do
12+
status=$(curl -s -L -o /dev/null -w %{http_code} $1)
13+
14+
# stop trying if we get a success response
15+
if [ $status -ge 200 ] && [ $status -lt 300 ]
16+
then
17+
return 0
18+
fi
19+
20+
((i++))
21+
echo "Attempt $i of $maxAttempts: Endpoint $1 returned code $status. Retrying in $retryInterval seconds."
22+
sleep $retryInterval
23+
done
24+
25+
return 1
26+
}
27+
28+
# args: endpoint, retryInterval (secs), maxAttempts, command
29+
if is_healthy $1 $2 $3
30+
then
31+
echo "Running command: $4"
32+
# vulnerable to input-injection attacts (but I don't care :)
33+
eval "$4"
34+
else
35+
echo "Exiting: Cannot run command because health-check failed."
36+
fi

0 commit comments

Comments
 (0)