Skip to content

Commit 1ff1b00

Browse files
authored
Build modules for Opentracing 1.6.0 (#155)
* Upgrade Docker image to support Opentracing 1.6.0 Among all tracers only Jaeger and Datadog fully supports Opentracing 1.6.0. Remove Zipkin and Lightstep tracers, because are not fully supported from Dockerfile. Jaeger covers a lot of formats: Zippkin and W3C. Upgrade jaeger cpp to 0.7.0 DataDog opentracing from master to support Opentracing 1.6.0. Build modules for both opentracing libs 1.5.1 and 1.6.0 Update scripts to use Opentracing v1.6.0 by default.
1 parent 87358d7 commit 1ff1b00

18 files changed

+618
-78
lines changed

.circleci/config.yml

Lines changed: 65 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,22 @@ jobs:
1111
./ci/system_testing.sh
1212
- store_artifacts:
1313
path: ./test-log
14-
build_gcc48:
14+
build_gcc48_opentracing_15:
1515
docker:
1616
- image: ubuntu:18.04
17+
environment:
18+
OPENTRACING_VERSION: v1.5.1
19+
steps:
20+
- checkout
21+
- run: ./ci/setup_build_environment.sh
22+
- run: ./ci/install_gcc4.8.sh
23+
- run: ./ci/install_opentracing.sh
24+
- run: ./ci/do_ci.sh build
25+
build_gcc48_opentracing_16:
26+
docker:
27+
- image: ubuntu:18.04
28+
environment:
29+
OPENTRACING_VERSION: v1.6.0
1730
steps:
1831
- checkout
1932
- run: ./ci/setup_build_environment.sh
@@ -32,27 +45,63 @@ jobs:
3245
- checkout
3346
- run:
3447
command: docker build -t opentracing/openresty -f Dockerfile-openresty .
35-
module_binaries:
48+
module_binaries_opentracing_15:
3649
docker:
3750
- image: ubuntu:18.04
51+
environment:
52+
OPENTRACING_VERSION: v1.5.1
53+
MODULE_DIR: /workspace/modules
3854
steps:
3955
- checkout
56+
- run: mkdir -p /workspace/modules
4057
- run: ./ci/setup_build_environment.sh
41-
- run: ./ci/do_ci.sh module.binaries
58+
- run:
59+
name: Build modules with opentracing v1.5.1
60+
command: ./ci/do_ci.sh module.binaries
4261
- store_artifacts:
43-
path: /modules
62+
path: /workspace/modules
63+
- persist_to_workspace:
64+
root: /workspace
65+
paths:
66+
- modules
67+
module_binaries_opentracing_16:
68+
docker:
69+
- image: ubuntu:18.04
70+
environment:
71+
OPENTRACING_VERSION: v1.6.0
72+
MODULE_DIR: /workspace/modules
73+
NAME_SUFFIX: "-ot16"
74+
steps:
75+
- checkout
76+
- run: ./ci/setup_build_environment.sh
77+
- attach_workspace:
78+
at: /workspace
79+
- run:
80+
name: Build modules with opentracing v1.6.0
81+
command: ./ci/do_ci.sh module.binaries
82+
- store_artifacts:
83+
path: /workspace/modules
84+
- persist_to_workspace:
85+
root: /workspace
86+
paths:
87+
- modules
4488
push_docker_image:
4589
machine: true
4690
steps:
4791
- checkout
4892
- run:
4993
command: ./ci/do_ci.sh push_docker_image
94+
5095
release:
5196
docker:
5297
- image: ubuntu:18.04
98+
environment:
99+
MODULE_DIR: /workspace/modules
53100
steps:
54101
- run: apt-get -qq update; apt-get -y install git ssh
55102
- checkout
103+
- attach_workspace:
104+
at: /workspace
56105
- run: ./ci/setup_build_environment.sh
57106
- run: ./ci/do_ci.sh release
58107

@@ -67,17 +116,27 @@ workflows:
67116
tags:
68117
only: /^v[0-9]+(\.[0-9]+)*$/
69118
- release:
119+
requires:
120+
- module_binaries_opentracing_15
121+
- module_binaries_opentracing_16
122+
- system_testing
70123
filters:
71124
branches:
72125
ignore: /.*/
73126
tags:
74127
only: /^v[0-9]+(\.[0-9]+)*$/
75128
- system_testing
76-
- build_gcc48
129+
- build_gcc48_opentracing_15
130+
- build_gcc48_opentracing_16:
131+
requires:
132+
- build_gcc48_opentracing_15
77133
- docker_image:
78134
requires:
79135
- system_testing
80136
- openresty_docker_image:
81137
requires:
82138
- system_testing
83-
- module_binaries
139+
- module_binaries_opentracing_15
140+
- module_binaries_opentracing_16:
141+
requires:
142+
- module_binaries_opentracing_15

Dockerfile

Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,10 @@ ARG NGINX_LABEL=latest
22

33
FROM nginx:${NGINX_LABEL}
44

5-
ARG OPENTRACING_CPP_VERSION=v1.5.1
6-
ARG ZIPKIN_CPP_VERSION=v0.5.2
7-
ARG LIGHTSTEP_VERSION=v0.8.1
8-
ARG JAEGER_CPP_VERSION=v0.4.2
9-
ARG GRPC_VERSION=v1.22.x
10-
ARG DATADOG_VERSION=v1.1.2
5+
ARG OPENTRACING_CPP_VERSION=v1.6.0
6+
ARG JAEGER_CPP_VERSION=v0.7.0
7+
ARG GRPC_VERSION=v1.27.x
8+
ARG DATADOG_VERSION="master"
119

1210
COPY . /src
1311

@@ -40,17 +38,23 @@ RUN set -x \
4038
autoconf \
4139
libtool \
4240
g++-7 \
43-
&& true
44-
RUN true \
4541
# reset apt-mark's "manual" list so that "purge --auto-remove" will remove all build dependencies
4642
# (which is done after we install the built packages so we don't have to redownload any overlapping dependencies)
4743
&& apt-mark showmanual | xargs apt-mark auto > /dev/null \
4844
&& { [ -z "$savedAptMark" ] || apt-mark manual $savedAptMark; } \
49-
\
5045
&& cd "$tempDir" \
5146
### Use g++ 7
5247
&& update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 5 \
5348
&& update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-7 5 \
49+
### Build gRPC
50+
&& git clone --depth 1 -b $GRPC_VERSION https://github.com/grpc/grpc \
51+
&& cd grpc \
52+
&& git submodule update --depth 1 --init \
53+
&& make HAS_SYSTEM_PROTOBUF=false \
54+
&& make install \
55+
&& cd third_party/protobuf \
56+
&& make install \
57+
&& cd "$tempDir" \
5458
### Build opentracing-cpp
5559
&& git clone --depth 1 -b $OPENTRACING_CPP_VERSION https://github.com/opentracing/opentracing-cpp.git \
5660
&& cd opentracing-cpp \
@@ -59,24 +63,18 @@ RUN true \
5963
-DBUILD_TESTING=OFF .. \
6064
&& make && make install \
6165
&& cd "$tempDir" \
62-
### Build zipkin-cpp-opentracing
63-
&& apt-get --no-install-recommends --no-install-suggests -y install libcurl4-gnutls-dev \
64-
&& git clone --depth 1 -b $ZIPKIN_CPP_VERSION https://github.com/rnburn/zipkin-cpp-opentracing.git \
65-
&& cd zipkin-cpp-opentracing \
66-
&& mkdir .build && cd .build \
67-
&& cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. \
68-
&& make && make install \
69-
&& cd "$tempDir" \
70-
&& ln -s /usr/local/lib/libzipkin_opentracing.so /usr/local/lib/libzipkin_opentracing_plugin.so \
7166
### Build Jaeger cpp-client
7267
&& git clone --depth 1 -b $JAEGER_CPP_VERSION https://github.com/jaegertracing/cpp-client.git jaeger-cpp-client \
7368
&& cd jaeger-cpp-client \
74-
&& mkdir .build && cd .build \
69+
&& mkdir .build \
70+
&& cd .build \
7571
&& cmake -DCMAKE_BUILD_TYPE=Release \
7672
-DBUILD_TESTING=OFF \
7773
-DJAEGERTRACING_WITH_YAML_CPP=ON .. \
78-
&& make && make install \
74+
&& make \
75+
&& make install \
7976
&& export HUNTER_INSTALL_DIR=$(cat _3rdParty/Hunter/install-root-dir) \
77+
&& cp $HUNTER_INSTALL_DIR/lib/libyaml*so /usr/local/lib/ \
8078
&& cd "$tempDir" \
8179
&& ln -s /usr/local/lib/libjaegertracing.so /usr/local/lib/libjaegertracing_plugin.so \
8280
### Build dd-opentracing-cpp
@@ -88,22 +86,6 @@ RUN true \
8886
&& make && make install \
8987
&& cd "$tempDir" \
9088
&& ln -s /usr/local/lib/libdd_opentracing.so /usr/local/lib/libdd_opentracing_plugin.so \
91-
### Build gRPC
92-
&& git clone --depth 1 -b $GRPC_VERSION https://github.com/grpc/grpc \
93-
&& cd grpc \
94-
&& git submodule update --init \
95-
&& make HAS_SYSTEM_PROTOBUF=false && make install \
96-
&& cd third_party/protobuf \
97-
&& make install \
98-
&& cd "$tempDir" \
99-
### Build lightstep-tracer-cpp
100-
&& git clone --depth 1 -b $LIGHTSTEP_VERSION https://github.com/lightstep/lightstep-tracer-cpp.git \
101-
&& cd lightstep-tracer-cpp \
102-
&& mkdir .build && cd .build \
103-
&& cmake -DBUILD_SHARED_LIBS=1 -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. \
104-
&& make && make install \
105-
&& cd "$tempDir" \
106-
&& ln -s /usr/local/lib/liblightstep_tracer.so /usr/local/lib/liblightstep_tracer_plugin.so \
10789
### Build nginx-opentracing modules
10890
&& NGINX_VERSION=`nginx -v 2>&1` && NGINX_VERSION=${NGINX_VERSION#*nginx/} \
10991
&& echo "deb-src http://nginx.org/packages/mainline/debian/ stretch nginx" >> /etc/apt/sources.list \

Dockerfile-openresty

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
# https://github.com/openresty/docker-openresty
33

44
ARG RESTY_IMAGE_BASE="ubuntu"
5-
ARG RESTY_IMAGE_TAG="xenial"
5+
ARG RESTY_IMAGE_TAG="20.04"
66

77
FROM ${RESTY_IMAGE_BASE}:${RESTY_IMAGE_TAG}
88

99
# Docker Build Arguments
10-
ARG RESTY_VERSION="1.13.6.2"
10+
ARG RESTY_VERSION="1.19.3.1"
1111
ARG RESTY_LUAROCKS_VERSION="2.4.4"
12-
ARG RESTY_OPENSSL_VERSION="1.1.0h"
13-
ARG RESTY_PCRE_VERSION="8.42"
12+
ARG RESTY_OPENSSL_VERSION="1.1.1i"
13+
ARG RESTY_PCRE_VERSION="8.44"
1414
ARG RESTY_J="1"
1515
ARG RESTY_CONFIG_OPTIONS="\
1616
--with-file-aio \
@@ -44,11 +44,8 @@ ARG RESTY_CONFIG_OPTIONS="\
4444
--add-dynamic-module=/src/opentracing \
4545
"
4646
ARG RESTY_CONFIG_OPTIONS_MORE=""
47-
ARG OPENTRACING_CPP_VERSION="v1.5.1"
48-
ARG LUA_BRIDGE_TRACER_VERSION="937059912311da3b4f45f46cd7d9a2942a248b2d"
49-
ARG JAEGER_VERSION="v0.4.2"
50-
ARG LIGHTSTEP_VERSION="v0.10.1"
51-
ARG ZIPKIN_VERSION="v0.5.2"
47+
ARG OPENTRACING_CPP_VERSION="v1.6.0"
48+
ARG JAEGER_VERSION="0.7.0"
5249

5350
LABEL resty_version="${RESTY_VERSION}"
5451
LABEL resty_luarocks_version="${RESTY_LUAROCKS_VERSION}"
@@ -100,21 +97,28 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
10097
&& make && make install \
10198
&& cd /tmp \
10299
&& rm -rf opentracing-cpp \
103-
### Build bridge tracer
100+
### Install tracers
101+
#&& wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/v${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so \
104102
&& cd /tmp \
105-
&& git clone https://github.com/opentracing/lua-bridge-tracer.git \
106-
&& cd lua-bridge-tracer \
107-
&& git checkout ${LUA_BRIDGE_TRACER_VERSION} \
108-
&& mkdir .build && cd .build \
103+
&& wget https://github.com/jaegertracing/jaeger-client-cpp/archive/v${JAEGER_VERSION}.tar.gz \
104+
&& tar xzf v${JAEGER_VERSION}.tar.gz \
105+
&& cd jaeger-client-cpp-${JAEGER_VERSION} \
106+
&& ls -la \
107+
&& mkdir .build \
108+
&& cd .build \
109109
&& cmake -DCMAKE_BUILD_TYPE=Release \
110-
.. \
111-
&& make && make install \
110+
-DBUILD_TESTING=OFF \
111+
-DJAEGERTRACING_WITH_YAML_CPP=ON .. \
112+
&& make \
113+
&& make install \
114+
&& export HUNTER_INSTALL_DIR=$(cat _3rdParty/Hunter/install-root-dir) \
115+
&& cp $HUNTER_INSTALL_DIR/lib/libyaml*so /usr/local/lib/ \
116+
&& ln -s /usr/local/lib/libjaegertracing.so /usr/local/lib/libjaegertracing_plugin.so \
112117
&& cd /tmp \
113-
&& rm -rf lua-bridge-tracer \
114-
### Install tracers
115-
&& wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/${JAEGER_VERSION}/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so \
116-
&& wget -O - https://github.com/lightstep/lightstep-tracer-cpp/releases/download/${LIGHTSTEP_VERSION}/linux-amd64-liblightstep_tracer_plugin.so.gz | gunzip -c > /usr/local/lib/liblightstep_tracer_plugin.so \
117-
&& wget -O - https://github.com/rnburn/zipkin-cpp-opentracing/releases/download/${ZIPKIN_VERSION}/linux-amd64-libzipkin_opentracing_plugin.so.gz | gunzip -c > /usr/local/lib/libzipkin_opentracing_plugin.so \
118+
&& rm -rf jaeger-client-cpp-${JAEGER_VERSION} v${JAEGER_VERSION}.tar.gz /root/.hunter \
119+
&& true
120+
121+
RUN true \
118122
### Copied from https://github.com/openresty/docker-openresty/blob/master/xenial/Dockerfile
119123
&& cd /tmp \
120124
&& curl -fSL https://www.openssl.org/source/openssl-${RESTY_OPENSSL_VERSION}.tar.gz -o openssl-${RESTY_OPENSSL_VERSION}.tar.gz \

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ http {
6363
# Load a vendor tracer
6464
opentracing_load_tracer /usr/local/lib/libjaegertracing_plugin.so /etc/jaeger-nginx-config.json;
6565
66-
# or
66+
# or
6767
# opentracing_load_tracer /usr/local/lib/liblightstep_tracer_plugin.so /path/to/config;
68-
# or
68+
# or
6969
# opentracing_load_tracer /usr/local/lib/libzipkin_opentracing_plugin.so /path/to/config;
7070
# or
7171
# opentracing_load_tracer /usr/local/lib/libdd_opentracing_plugin.so /path/to/config;
@@ -102,7 +102,7 @@ directives.
102102
Docker
103103
------
104104
A docker image `opentracing/nginx-opentracing` is provided to support using nginx with OpenTracing
105-
in a manner analogous to the [nginx Docker image](https://hub.docker.com/_/nginx/).
105+
in a manner analogous to the [nginx Docker image](https://hub.docker.com/_/nginx/).
106106
See [here](example/) for examples of how to use it.
107107

108108
Additionally, custom images can be built by running
@@ -113,7 +113,7 @@ docker build \
113113
.
114114
```
115115

116-
and arguments to weak the versions used can be provided with
116+
and arguments to tweak the versions used can be provided with
117117

118118
```bash
119119
docker build \
@@ -134,15 +134,21 @@ Other build arguments
134134

135135
Building From Source
136136
--------------------
137+
137138
```
138139
$ tar zxvf nginx-1.9.x.tar.gz
139140
$ cd nginx-1.9.x
140141
$ ./configure --add-dynamic-module=/absolute/path/to/nginx-opentracing/opentracing
141142
$ make && sudo make install
142143
```
143144

144-
You will also need to install a C++ tracer for either [Jaeger](https://github.com/jaegertracing/jaeger-client-cpp), [LightStep](
145-
https://github.com/lightstep/lightstep-tracer-cpp), [Datadog](https://github.com/DataDog/dd-opentracing-cpp), or [Zipkin](https://github.com/rnburn/zipkin-cpp-opentracing). For linux x86-64, portable binary plugins are available:
145+
You will also need to install a C++ tracer for either
146+
[Jaeger](https://github.com/jaegertracing/jaeger-client-cpp),
147+
[LightStep](https://github.com/lightstep/lightstep-tracer-cpp),
148+
[Datadog](https://github.com/DataDog/dd-opentracing-cpp),
149+
or [Zipkin](https://github.com/rnburn/zipkin-cpp-opentracing).
150+
For linux x86-64, portable binary plugins are available:
151+
146152
```
147153
# Jaeger
148154
wget https://github.com/jaegertracing/jaeger-client-cpp/releases/download/v0.4.2/libjaegertracing_plugin.linux_amd64.so -O /usr/local/lib/libjaegertracing_plugin.so
@@ -155,9 +161,11 @@ wget -O - https://github.com/rnburn/zipkin-cpp-opentracing/releases/download/v0.
155161
156162
# Datadog
157163
wget -O - https://github.com/DataDog/dd-opentracing-cpp/releases/download/v0.3.0/linux-amd64-libdd_opentracing_plugin.so.gz | gunzip -c > /usr/local/lib/libdd_opentracing_plugin.so
158-
159164
```
160165

166+
Make sure the nginx module for opentracing and a tracer plugin were built against the same version of [C++ OpenTracing Library](https://github.com/opentracing/opentracing-cpp).
167+
By default [Opentracing v1.6.0](https://github.com/opentracing/opentracing-cpp/releases/tag/v1.6.0) is used.
168+
161169
Testing
162170
--------
163171

ci/build_module_binaries.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
set -e
44

5-
export OPENTRACING_VERSION=1.5.1
5+
[ -z "${OPENTRACING_VERSION}" ] && export OPENTRACING_VERSION="v1.6.0"
6+
NAME_SUFFIX=${NAME_SUFFIX:-""}
7+
68
NGINX_VERSIONS=(1.19.8 1.19.7 1.19.6 1.19.5 1.19.4 1.19.3 1.19.2 1.18.0 1.17.8 1.17.3 1.17.2 1.17.1 1.17.0 1.16.1 1.16.0 1.15.8 1.15.1 1.15.0 1.14.2 1.13.6)
79

810
# Compile for a portable cpu architecture
@@ -14,5 +16,5 @@ export LDFLAGS="-fPIC"
1416

1517
for NGINX_VERSION in ${NGINX_VERSIONS[*]}
1618
do
17-
./ci/build_module_binary.sh $NGINX_VERSION
19+
./ci/build_module_binary.sh "${NGINX_VERSION}" "${NAME_SUFFIX}"
1820
done

ci/build_module_binary.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ set -e
44

55
pushd "${BUILD_DIR}"
66
NGINX_VERSION=$1
7+
NAME_SUFFIX=${2:-""}
8+
79
wget -O nginx-release-${NGINX_VERSION}.tar.gz https://github.com/nginx/nginx/archive/release-${NGINX_VERSION}.tar.gz
810
tar zxf nginx-release-$NGINX_VERSION.tar.gz
911
cd nginx-release-$NGINX_VERSION
@@ -35,7 +37,7 @@ make modules
3537
-Wl,--version-script="${PWD}/export.map" \
3638
-shared
3739

38-
TARGET_NAME=linux-amd64-nginx-${NGINX_VERSION}-ngx_http_module.so.tgz
40+
TARGET_NAME=linux-amd64-nginx-${NGINX_VERSION}${NAME_SUFFIX}-ngx_http_module.so.tgz
3941
tar czf ${TARGET_NAME} ngx_http_opentracing_module.so
4042
cp ${TARGET_NAME} "${MODULE_DIR}"/
4143
popd

0 commit comments

Comments
 (0)