File tree Expand file tree Collapse file tree 6 files changed +51
-7
lines changed Expand file tree Collapse file tree 6 files changed +51
-7
lines changed Original file line number Diff line number Diff line change @@ -3,9 +3,10 @@ ARG NGINX_LABEL=latest
3
3
FROM nginx:${NGINX_LABEL}
4
4
5
5
ARG OPENTRACING_CPP_VERSION=v1.6.0
6
+ ARG ZIPKIN_CPP_VERSION=master
6
7
ARG JAEGER_CPP_VERSION=v0.7.0
7
8
ARG GRPC_VERSION=v1.27.x
8
- ARG DATADOG_VERSION=" master"
9
+ ARG DATADOG_VERSION=master
9
10
10
11
COPY . /src
11
12
@@ -63,6 +64,15 @@ RUN set -x \
63
64
-DBUILD_TESTING=OFF .. \
64
65
&& make && make install \
65
66
&& cd "$tempDir" \
67
+ # ## Build zipkin-cpp-opentracing
68
+ && apt-get --no-install-recommends --no-install-suggests -y install libcurl4-gnutls-dev \
69
+ && git clone --depth 1 -b $ZIPKIN_CPP_VERSION https://github.com/rnburn/zipkin-cpp-opentracing.git \
70
+ && cd zipkin-cpp-opentracing \
71
+ && mkdir .build && cd .build \
72
+ && cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. \
73
+ && make && make install \
74
+ && cd "$tempDir" \
75
+ && ln -s /usr/local/lib/libzipkin_opentracing.so /usr/local/lib/libzipkin_opentracing_plugin.so \
66
76
# ## Build Jaeger cpp-client
67
77
&& git clone --depth 1 -b $JAEGER_CPP_VERSION https://github.com/jaegertracing/cpp-client.git jaeger-cpp-client \
68
78
&& cd jaeger-cpp-client \
Original file line number Diff line number Diff line change @@ -23,7 +23,8 @@ $ docker-compose up --build
23
23
Send requests to the app:
24
24
25
25
``` shell
26
- $ curl localhost:8081
26
+ $ curl localhost:8081 # W3C format traces
27
+ $ curl localhost:8082 # Zipkin format traces
27
28
```
28
29
29
30
Visit http://localhost:16686 to view the traces in Jaeger.
Original file line number Diff line number Diff line change @@ -14,9 +14,11 @@ services:
14
14
# - "6831/udp" # Default endpoint for Jaeger thrift_compact receiver
15
15
- " 14268" # Jaeger http thrift receiver
16
16
- " 55680" # Default endpoint for OpenTelemetry receiver
17
+ - " 9411" # Zipkin port
17
18
- " 8888" # Metrics
18
19
ports :
19
20
- " 55680:55680"
21
+ - " 9411:9411"
20
22
# - "6831:6831/udp"
21
23
- " 8888:8888"
22
24
- " 14268:14268"
@@ -33,24 +35,27 @@ services:
33
35
volumes :
34
36
- ./nginx.conf:/etc/nginx/nginx.conf
35
37
- ./jaeger-config.json:/etc/jaeger-config.json
38
+ - ./zipkin-config.json:/etc/zipkin-config.json
36
39
expose :
37
40
- " 8081"
41
+ - " 8082"
38
42
ports :
39
43
- " 8081:8081"
44
+ - " 8082:8082"
40
45
41
46
jaeger :
42
47
image : jaegertracing/all-in-one
48
+ environment :
49
+ - COLLECTOR_ZIPKIN_HTTP_PORT=19411
43
50
pull_policy : always
44
51
networks :
45
52
example :
46
53
aliases :
47
54
- jaeger
48
55
expose :
49
- - " 9411"
50
56
- " 16686"
51
57
- " 14250"
52
58
ports :
53
- - " 9411:9411"
54
59
- " 16686:16686"
55
60
- " 14250:14250"
56
61
Original file line number Diff line number Diff line change @@ -4,19 +4,39 @@ events {}
4
4
5
5
http {
6
6
opentracing on;
7
-
8
7
opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /etc/jaeger-config.json;
8
+ opentracing_tag nginx_global http;
9
9
10
10
server {
11
+ opentracing_tag nginx_server server;
12
+
11
13
root /var/www;
12
14
error_log /var/log/nginx/debug.log debug ;
13
15
listen 8081 ;
14
16
server_name web.info;
15
17
16
18
location / {
17
- opentracing_trace_locations off;
19
+ opentracing_tag nginx_location location;
20
+ opentracing_trace_locations on;
18
21
proxy_pass http://web:8080;
19
22
opentracing_propagate_context;
20
23
}
21
24
}
25
+
26
+ # Zipkin example
27
+ # server {
28
+ # opentracing_tag server_nginx_tag server;
29
+ # opentracing_load_tracer /usr/local/lib/libzipkin_opentracing_plugin.so /etc/zipkin-config.json;
30
+
31
+ # root /var/www;
32
+ # error_log /var/log/nginx/debug.log debug;
33
+ # listen 8081;
34
+ # server_name web.info;
35
+
36
+ # location / {
37
+ # opentracing_trace_locations off;
38
+ # proxy_pass http://web:8080;
39
+ # opentracing_propagate_context;
40
+ # }
41
+ # }
22
42
}
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ receivers:
9
9
thrift_http :
10
10
# 6831/UDP - not used but specified in jaeger-config.json
11
11
thrift_compact :
12
+ # 9411 - default zipkin port
13
+ zipkin :
12
14
processors :
13
15
batch :
14
16
exporters :
@@ -20,6 +22,6 @@ exporters:
20
22
service :
21
23
pipelines :
22
24
traces :
23
- receivers : [otlp, jaeger]
25
+ receivers : [otlp, jaeger, zipkin ]
24
26
processors : [batch]
25
27
exporters : [logging, jaeger]
Original file line number Diff line number Diff line change
1
+ {
2
+ "service_name" : " nginx" ,
3
+ "collector_host" : " otel" ,
4
+ "collector_port" : 9411 ,
5
+ "sample_rate" : 1
6
+ }
You can’t perform that action at this time.
0 commit comments