-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
374 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
ARG BASE_IMAGE=ubuntu:latest | ||
ARG GRPC_IMAGE=grpc-${BASE_IMAGE} | ||
ARG THRIFT_IMAGE=thrift-${BASE_IMAGE} | ||
|
||
FROM ${GRPC_IMAGE} as grpc | ||
FROM ${THRIFT_IMAGE} as thrift | ||
|
||
FROM base-${BASE_IMAGE}-dev AS otel-cpp | ||
|
||
ARG CORES=${nproc} | ||
ARG OTEL_GIT_TAG=v1.3.0 | ||
|
||
COPY --from=grpc / /usr/local | ||
COPY --from=thrift / /usr/local | ||
|
||
#install opentelemetry-cpp | ||
RUN git clone --recurse-submodules -j ${CORES} --depth=1 \ | ||
-b ${OTEL_GIT_TAG} https://github.com/open-telemetry/opentelemetry-cpp.git \ | ||
&& cd opentelemetry-cpp \ | ||
&& mkdir -p build && cd build \ | ||
&& cmake \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE \ | ||
-DWITH_ZIPKIN=ON \ | ||
-DWITH_JAEGER=ON \ | ||
-DCMAKE_INSTALL_PREFIX=/opt/third_party/install \ | ||
-DBUILD_TESTING=OFF \ | ||
-DWITH_OTLP=ON \ | ||
-DWITH_OTLP_GRPC=ON \ | ||
-DBUILD_SHARED_LIBS=ON \ | ||
.. \ | ||
&& cmake --build . -j ${CORES} --target install | ||
|
||
FROM scratch as final | ||
|
||
COPY --from=otel-cpp /opt/third_party/install / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
ARG BASE_IMAGE=alpine:latest | ||
ARG CORES=${nproc} | ||
|
||
FROM ${BASE_IMAGE} as final | ||
|
||
RUN apk update | ||
|
||
RUN apk add --update alpine-sdk \ | ||
&& apk add cmake openssl openssl-dev g++ \ | ||
curl-dev git autoconf libtool linux-headers \ | ||
boost-dev libevent-dev openssl-dev | ||
|
||
RUN mkdir -p /opt/third_party/install | ||
|
||
WORKDIR /opt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# OpenTelemetry library builder | ||
|
||
**How to use this build script:** | ||
|
||
The build script `build.sh` can be used to build OpenTelemetry and | ||
it's dependencies within the desired base image. | ||
The final image only contains the necessary files in `/`. | ||
|
||
```sh | ||
bash build.sh -b alpine -j ${nproc} -g v1.43.2 -o v1.3.0 -t 0.14.1 | ||
|
||
# copy to current dir | ||
docker create -ti --name otel otel-cpp-<base_image> bash | ||
docker cp otel:/ ./ | ||
docker rm -f otel | ||
|
||
docker create -ti --name grpc grpc-<base_image> bash | ||
docker cp grpc:/ ./ | ||
docker rm -f grpc | ||
|
||
docker create -ti --name thrift thrift-<base_image> bash | ||
docker cp thrift:/ ./ | ||
docker rm -f thrift | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/bin/bash | ||
|
||
# Copyright The OpenTelemetry Authors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
Help() | ||
{ | ||
# Display Help | ||
echo "Add description of the script functions here." | ||
echo | ||
echo "Syntax: scriptTemplate [-b|o|g|j]" | ||
echo "options:" | ||
echo "b Base image" | ||
echo "o OpenTelemetry-cpp git tag" | ||
echo "h Print Help." | ||
echo "g gRPC git tag" | ||
echo "t thrift version" | ||
echo "j Parallel jobs" | ||
echo | ||
echo "how to use:" | ||
echo | ||
echo "docker create -ti --name otel otel-cpp-<base_image> bash" | ||
echo "docker cp otel:/ ./" | ||
echo "docker rm -f otel" | ||
echo | ||
echo "or:" | ||
echo | ||
echo "COPY --from=otel-cpp-<base_image> /usr" | ||
} | ||
|
||
base_image=${base_image:="alpine"} | ||
grpc_git_tag=${grpc_git_tag:="v1.43.2"} | ||
thrift_version=${thrift_version:="0.14.1"} | ||
otel_git_tag=${otel_git_tag:="v1.3.0"} | ||
cores=${cores:=1} | ||
|
||
while getopts ":h:b:o:g:j:t:" option; do | ||
case $option in | ||
h) # display Help | ||
Help | ||
exit;; | ||
b) # base image | ||
base_image=$OPTARG | ||
;; | ||
o) # OpenTelemetry-cpp git tag | ||
otel_git_tag=$OPTARG | ||
;; | ||
g) # gRPC git tag | ||
grpc_git_tag=$OPTARG | ||
;; | ||
t) # thrfit version | ||
thrift_version=$OPTARG | ||
;; | ||
j) # number of cores | ||
cores=$OPTARG | ||
;; | ||
\?) | ||
Help | ||
exit;; | ||
esac | ||
done | ||
|
||
docker build -t base-${base_image}-dev -f Dockerfile.${base_image}.base . | ||
|
||
pushd grpc/ | ||
docker build --build-arg BASE_IMAGE=base-${base_image}-dev \ | ||
--build-arg GRPC_GIT_TAG=${grpc_git_tag} \ | ||
--build-arg CORES=${cores} \ | ||
-t grpc-${base_image} -f Dockerfile . | ||
popd | ||
|
||
pushd thrift/ | ||
docker build --build-arg BASE_IMAGE=base-${base_image}-dev \ | ||
--build-arg THRIFT_VERSION=${thrift_version} \ | ||
--build-arg CORES=${cores} \ | ||
-t thrift-${base_image} -f Dockerfile . | ||
popd | ||
|
||
docker build --build-arg BASE_IMAGE=${base_image} \ | ||
--build-arg CORES=${cores} \ | ||
--build-arg OTEL_GIT_TAG=${otel_git_tag} \ | ||
-t otel-cpp-${base_image} -f Dockerfile . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
cmake_minimum_required(VERSION 3.11 FATAL_ERROR) | ||
|
||
project( | ||
dependencies | ||
LANGUAGES CXX | ||
VERSION 0.0.1) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_FLAGS "-O2") | ||
|
||
set(CMAKE_BUILD_TYPE | ||
Release | ||
CACHE STRING "Build type" FORCE) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY | ||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY | ||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY | ||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) | ||
|
||
set(INSTALL_LIBDIR | ||
${CMAKE_INSTALL_LIBDIR} | ||
CACHE PATH "directory for libraries") | ||
set(INSTALL_BINDIR | ||
${CMAKE_INSTALL_BINDIR} | ||
CACHE PATH "directory for executables") | ||
set(INSTALL_INCLUDEDIR | ||
${CMAKE_INSTALL_INCLUDEDIR} | ||
CACHE PATH "directory for header files") | ||
|
||
set(DEF_INSTALL_CMAKEDIR share/cmake/${PROJECT_NAME}) | ||
set(INSTALL_CMAKEDIR | ||
${DEF_INSTALL_CMAKEDIR} | ||
CACHE PATH "directory for CMake files") | ||
|
||
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/subs) | ||
|
||
set(STAGED_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/stage) | ||
message(STATUS "${PROJECT_NAME} staged install: ${STAGED_INSTALL_PREFIX}") | ||
|
||
find_package(OpenSSL REQUIRED) | ||
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") | ||
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}") | ||
|
||
set(GRPC_GIT_TAG | ||
"v1.45.2" | ||
CACHE STRING "gRPC version") | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add( | ||
grpc | ||
GIT_REPOSITORY https://github.com/grpc/grpc.git | ||
GIT_TAG ${GRPC_GIT_TAG} | ||
GIT_SHALLOW 1 | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX} | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DgRPC_SSL_PROVIDER=package | ||
-DOPENSSL_ROOT_DIR=OpenSSL | ||
-DgRPC_BUILD_TESTS=OFF | ||
-DBUILD_SHARED_LIBS=ON | ||
-DgRPC_BUILD_GRPC_NODE_PLUGIN=OFF | ||
-DgRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF | ||
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF | ||
-DgRPC_BUILD_GRPC_PHP_PLUGIN=OFF | ||
-DgRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF | ||
-DgRPC_BUILD_GRPC_RUBY_PLUGIN=OFF | ||
CMAKE_CACHE_ARGS -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} | ||
TEST_AFTER_INSTALL 0 | ||
DOWNLOAD_NO_PROGRESS 1 | ||
LOG_CONFIGURE 1 | ||
LOG_BUILD 0 | ||
LOG_INSTALL 1) | ||
|
||
install( | ||
DIRECTORY ${STAGED_INSTALL_PREFIX}/ | ||
DESTINATION . | ||
USE_SOURCE_PERMISSIONS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG BASE_IMAGE=ubuntu:latest | ||
FROM ${BASE_IMAGE} AS grpc | ||
|
||
ARG CORES=${nproc} | ||
ARG GRPC_GIT_TAG=v1.45.2 | ||
|
||
RUN mkdir mkdir -p /opt/third_party/grpc | ||
|
||
WORKDIR /opt/third_party/grpc | ||
|
||
ADD CMakeLists.txt /opt/third_party/grpc | ||
|
||
RUN mkdir build \ | ||
&& cd build \ | ||
&& cmake -DCMAKE_INSTALL_PREFIX=/opt/third_party/install \ | ||
-DGRPC_GIT_TAG=${GRPC_GIT_TAG} /opt/third_party/grpc \ | ||
&& cmake --build . -j ${CORES} --target install | ||
|
||
FROM scratch as final | ||
|
||
COPY --from=grpc /opt/third_party/install / |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
cmake_minimum_required(VERSION 3.11 FATAL_ERROR) | ||
|
||
project( | ||
dependencies | ||
LANGUAGES CXX | ||
VERSION 0.0.1) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
set(CMAKE_CXX_EXTENSIONS OFF) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
set(CMAKE_CXX_FLAGS "-O2") | ||
|
||
set(CMAKE_BUILD_TYPE | ||
Release | ||
CACHE STRING "Build type" FORCE) | ||
|
||
include(GNUInstallDirs) | ||
|
||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY | ||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY | ||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY | ||
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}) | ||
|
||
set(INSTALL_LIBDIR | ||
${CMAKE_INSTALL_LIBDIR} | ||
CACHE PATH "directory for libraries") | ||
set(INSTALL_BINDIR | ||
${CMAKE_INSTALL_BINDIR} | ||
CACHE PATH "directory for executables") | ||
set(INSTALL_INCLUDEDIR | ||
${CMAKE_INSTALL_INCLUDEDIR} | ||
CACHE PATH "directory for header files") | ||
|
||
set(DEF_INSTALL_CMAKEDIR share/cmake/${PROJECT_NAME}) | ||
set(INSTALL_CMAKEDIR | ||
${DEF_INSTALL_CMAKEDIR} | ||
CACHE PATH "directory for CMake files") | ||
|
||
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/subs) | ||
|
||
set(STAGED_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/stage) | ||
message(STATUS "${PROJECT_NAME} staged install: ${STAGED_INSTALL_PREFIX}") | ||
|
||
find_package(OpenSSL REQUIRED) | ||
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}") | ||
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}") | ||
|
||
set(THRIFT_VERSION | ||
"0.14.1" | ||
CACHE STRING "thrift version") | ||
|
||
include(ExternalProject) | ||
ExternalProject_Add( | ||
thrift | ||
URL https://github.com/apache/thrift/archive/refs/tags/v${THRIFT_VERSION}.tar.gz | ||
UPDATE_COMMAND "" | ||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${STAGED_INSTALL_PREFIX} | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE | ||
-DBUILD_COMPILER=OFF | ||
-DBUILD_CPP=ON | ||
-DBUILD_LIBRARIES=ON | ||
-DBUILD_NODEJS=OFF | ||
-DBUILD_PYTHON=OFF | ||
-DBUILD_JAVASCRIPT=OFF | ||
-DBUILD_C_GLIB=OFF | ||
-DBUILD_JAVA=OFF | ||
-DBUILD_TESTING=OFF | ||
-DBUILD_TUTORIALS=OFF | ||
-DWITH_STDTHREADS=ON | ||
-DWITH_BOOSTTHREADS=OFF | ||
-DWITH_BOOST_FUNCTIONAL=OFF | ||
-DWITH_BOOST_SMART_PTR=OFF | ||
CMAKE_CACHE_ARGS -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} | ||
TEST_AFTER_INSTALL 0 | ||
DOWNLOAD_NO_PROGRESS 1 | ||
LOG_CONFIGURE 1 | ||
LOG_BUILD 0 | ||
LOG_INSTALL 1) | ||
|
||
install( | ||
DIRECTORY ${STAGED_INSTALL_PREFIX}/ | ||
DESTINATION . | ||
USE_SOURCE_PERMISSIONS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
ARG BASE_IMAGE=ubuntu:latest | ||
FROM ${BASE_IMAGE} AS thrift | ||
|
||
ARG CORES=${nproc} | ||
ARG THRIFT_VERSION=0.14.1 | ||
|
||
RUN mkdir mkdir -p /opt/third_party/thrift | ||
|
||
WORKDIR /opt/third_party/th | ||
|
||
ADD CMakeLists.txt /opt/third_party/thrift | ||
|
||
RUN mkdir build \ | ||
&& cd build \ | ||
&& cmake -DCMAKE_INSTALL_PREFIX=/opt/third_party/install \ | ||
-DTHRIFT_VERSION=${THRIFT_VERSION} /opt/third_party/thrift \ | ||
&& cmake --build . -j ${CORES} --target install | ||
|
||
FROM scratch as final | ||
|
||
COPY --from=thrift /opt/third_party/install / |
1e25d58
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.BM_BaselineBuffer/2
10639448.165893555
ns/iter2720906.7344665527
ns/iter3.91
This comment was automatically generated by workflow using github-action-benchmark.