Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
deae4e3
Add codeowners
TomRoSystems Mar 30, 2021
d385db8
Fix team names inside codeowners
TomRoSystems Mar 30, 2021
f0d50fa
Merge remote-tracking branch 'upstream/main' into main
TomRoSystems Mar 31, 2021
ea8944c
Use CODEOWNERS from otel-cpp-contrib
TomRoSystems Apr 20, 2021
abc7669
Merge remote-tracking branch 'upstream/main' into main
TomRoSystems Apr 20, 2021
fed0847
Merge remote-tracking branch 'upstream/main' into main
TomRoSystems Apr 24, 2021
7ce614d
Merge remote-tracking branch 'upstream/main' into main
TomRoSystems May 11, 2021
cede96f
Update opentelemetry-cpp dependency to revision 5278e8c
TomRoSystems May 11, 2021
03acc95
Fix tests to match how attributes are presented (it was broken by #63…
TomRoSystems May 12, 2021
d546aed
Remove commented code
TomRoSystems May 12, 2021
756f5d9
Merge pull request #3 from TomRoSystems/httpd-update-otel-cpp-20210511
TomRoSystems May 12, 2021
ea9b377
Add support for CMake build alongside with Bazel
TomRoSystems Jun 1, 2021
a11b82d
Fix style and add CI for CMake
TomRoSystems Jun 1, 2021
adac540
Add missing name to CI
TomRoSystems Jun 1, 2021
2170af8
Fix CI
TomRoSystems Jun 1, 2021
d45a9df
Merge remote-tracking branch 'upstream/main' into main
TomRoSystems Jun 1, 2021
302b5cd
Merge branch 'main' into httpd_add_cmake_build
TomRoSystems Jun 1, 2021
cc98cb9
Get rid of -fpermissive and remove some compilation warnings
TomRoSystems Jun 10, 2021
582ae4f
Use specific version of opentelemetry for CMake build
TomRoSystems Jun 10, 2021
28dc06f
Search for Apache Runtible Library and Apache Httpd include paths in …
TomRoSystems Jun 11, 2021
33d7d40
Remove ::v0:: prefix
TomRoSystems Jun 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/httpd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,32 @@ jobs:
name: ${{ matrix.os }}_mod-otel.so
path: /tmp/mod-otel.so

build_cmake:
name: Build module with CMake
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-18.04, ubuntu-20.04]
steps:
- name: Checkout Repo
uses: actions/checkout@v2
- name: Setup buildtools
run: |
sudo ./instrumentation/httpd/setup-buildtools.sh
sudo ./instrumentation/httpd/setup-environment.sh
- name: Compile prerequisites
run: |
cd instrumentation/httpd
sudo ./setup-cmake.sh
- name: Compile
run: |
cd instrumentation/httpd
mkdir -p build
cd build
cmake ..
make -j2

clang_format:
name: Check code formatting
runs-on: ubuntu-latest
Expand Down
63 changes: 63 additions & 0 deletions instrumentation/httpd/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
cmake_minimum_required(VERSION 3.12)

project(opentelemetry-httpd)

find_package(opentelemetry-cpp REQUIRED)
find_package(Threads REQUIRED)
find_package(protobuf REQUIRED)
find_package(gRPC REQUIRED)
find_package(CURL REQUIRED)
find_package(Thrift REQUIRED)

find_path(APR_INCLUDE_DIR
NAMES apr.h
PATHS /opt/homebrew/opt/apr/include/apr-1
/usr/local/include/apr-1
/usr/local/include/apr-1.0
/usr/include/apr-1
/usr/include/apr-1.0
/usr/local/apr/include/apr-1
)

IF(NOT EXISTS "${APR_INCLUDE_DIR}/apr.h")
MESSAGE(FATAL_ERROR "APR include directory ${APR_INCLUDE_DIR} is not correct.")
ENDIF()

find_path(APACHE_INCLUDE_DIR
NAMES httpd.h
PATHS /usr/include/apache2
/usr/local/include/apache2
)

IF(NOT EXISTS "${APACHE_INCLUDE_DIR}/httpd.h")
MESSAGE(FATAL_ERROR "APACHE_INCLUDE_DIR include directory ${APACHE_INCLUDE_DIR} is not correct.")
ENDIF()

add_library(otel_httpd_module SHARED
src/otel/mod_otel.cpp
src/otel/opentelemetry.cpp
)

target_compile_options(otel_httpd_module
PRIVATE -Wall -Wextra
)

install(TARGETS otel_httpd_module DESTINATION ".")

set_target_properties(otel_httpd_module PROPERTIES
PREFIX ""
)

target_include_directories(otel_httpd_module
PRIVATE
${OPENTELEMETRY_CPP_INCLUDE_DIRS}
${APACHE_INCLUDE_DIR}
${APR_INCLUDE_DIR}
)

target_link_libraries(otel_httpd_module
PRIVATE
${OPENTELEMETRY_CPP_LIBRARIES}
gRPC::grpc++
# Thrift::thrift
)
37 changes: 37 additions & 0 deletions instrumentation/httpd/Dockerfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ubuntu:18.04

#########################################
# copy setup stuff from opentelemetry-cpp
#########################################

WORKDIR /setup-ci

ADD setup-buildtools.sh /setup-ci/setup-buildtools.sh

RUN /setup-ci/setup-buildtools.sh

ADD setup-environment.sh /setup/setup-environment.sh

RUN /setup/setup-environment.sh

COPY .clang-format /root

WORKDIR /root

# build with CMake
COPY setup-cmake.sh .
# RUN ls
RUN /root/setup-cmake.sh

COPY CMakeLists.txt /root
COPY src /root/src

RUN mkdir -p build \
&& cd build \
&& cmake .. \
&& make -j2

COPY tools /root/tools
COPY create-otel-load.sh /root
COPY opentelemetry.conf /root
COPY httpd_install_otel.sh /root
31 changes: 23 additions & 8 deletions instrumentation/httpd/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@


BUILD_IMAGE=opentelemetry-httpd-mod-dev
BUILD_IMAGE_BZL=opentelemetry-httpd-mod-dev
BUILD_IMAGE_CMAKE=opentelemetry-httpd-mod-dev-cmake
CONTAINER_NAME=otel-httpd
CONTAINER_NAME_CMAKE=otel-httpd-cmake

.PHONY: help build clean devsh rmcnt rming start stop

Expand All @@ -11,22 +13,28 @@ help:
@echo Possible targets are:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'

build: ## build docker image with development tools
docker build -t $(BUILD_IMAGE) .
build-bazel: ## build docker image with development tools
docker build -t $(BUILD_IMAGE_BZL) .

start: build ## start new docker container
docker run -v "$(PWD)/src":/mnt/host --network host --privileged --name "$(CONTAINER_NAME)" -it $(BUILD_IMAGE) /bin/bash -l
build-cmake: ## build docker image with development tools (cmake version)
docker build -t $(BUILD_IMAGE_CMAKE) -f Dockerfile.cmake .

startifnotrunning:
start-bazel: build-bazel ## start new docker container
docker run -v "$(PWD)/src":/mnt/host --network host --privileged --name "$(CONTAINER_NAME)" -it $(BUILD_IMAGE_BZL) /bin/bash -l

start-cmake: build-cmake ## start new docker container (cmake version)
docker run -v "$(PWD)/src":/mnt/host --network host --privileged --name "$(CONTAINER_NAME_CMAKE)" -it $(BUILD_IMAGE_CMAKE) /bin/bash -l

# stop: ## stop docker image
start: start-bazel

rmcnt: ## remove docker container
docker container rm $(CONTAINER_NAME) || true

rmcnt-cmake: ## remove docker container (cmake version)
docker container rm $(CONTAINER_NAME_CMAKE) || true

rmimg: ## remove docker image
docker image rm $(BUILD_IMAGE)
docker image rm $(BUILD_IMAGE_BZL)

clean: rmcnt rmimg ## clean both docker container and image

Expand All @@ -36,3 +44,10 @@ devsh: ## attach to existing container with shell (developer shell)
else \
$(MAKE) start; \
fi;

devsh-cmake: ## attach to existing container with shell (developer shell, cmake)
if [ "docker container inspect (CONTAINER_NAME_CMAKE)" ]; then \
docker exec -it $(CONTAINER_NAME_CMAKE) bash; \
else \
$(MAKE) start; \
fi;
75 changes: 75 additions & 0 deletions instrumentation/httpd/setup-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#!/bin/bash

set -euxo pipefail

export DEBIAN_FRONTEND=noninteractive

apt-get update

apt-get install --no-install-recommends --no-install-suggests -y \
build-essential autoconf libtool pkg-config ca-certificates gcc g++ git libcurl4-openssl-dev libpcre3-dev gnupg2 lsb-release curl apt-transport-https software-properties-common zlib1g-dev
curl -o /etc/apt/trusted.gpg.d/kitware.asc https://apt.kitware.com/keys/kitware-archive-latest.asc \
&& apt-add-repository "deb https://apt.kitware.com/ubuntu/ `lsb_release -cs` main"

apt-get install --no-install-recommends --no-install-suggests -y \
cmake libboost-all-dev

git clone --shallow-submodules --depth 1 --recurse-submodules -b v1.36.4 \
https://github.com/grpc/grpc \
&& cd grpc \
&& mkdir -p cmake/build \
&& cd cmake/build \
&& cmake \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_BUILD_TYPE=Release \
-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 \
../.. \
&& make -j2 \
&& make install

wget https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz \
&& tar zxf libevent-2.1.12-stable.tar.gz \
&& cd libevent-2.1.12-stable \
&& mkdir -p build \
&& cd build \
&& cmake .. \
&& make -j2 \
&& make install

git clone --shallow-submodules --depth 1 --recurse-submodules -b v0.14.0 \
https://github.com/apache/thrift.git \
&& cd thrift \
&& mkdir -p cmake-build \
&& cd cmake-build \
&& cmake -DCMAKE_BUILD_TYPE=Release \
-DBUILD_TESTING=OFF \
-DBUILD_COMPILER=OFF \
-DBUILD_C_GLIB=OFF \
-DBUILD_JAVA=OFF \
-DBUILD_JAVASCRIPT=OFF \
-DBUILD_NODEJS=OFF \
-DBUILD_PYTHON=OFF \
.. \
&& make -j2 \
&& make install

git clone --shallow-submodules --depth 1 --recurse-submodules -b "v1.0.0-rc1" \
https://github.com/open-telemetry/opentelemetry-cpp.git \
&& cd opentelemetry-cpp \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_BUILD_TYPE=Release \
-DWITH_OTLP=ON \
-DWITH_JAEGER=ON \
-DBUILD_TESTING=OFF \
-DWITH_EXAMPLES=OFF \
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \
.. \
&& make -j2 \
&& make install
1 change: 0 additions & 1 deletion instrumentation/httpd/src/otel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ cc_library(
copts = [
"-I/usr/include/apache2",
"-I/usr/include/apr-1.0",
"-fpermissive",
],
deps = [
"@io_opentelemetry_cpp//api",
Expand Down
Loading