From deae4e3c06ef6c1f90096debd5f144ce3540b1c3 Mon Sep 17 00:00:00 2001 From: Tomasz Rojek Date: Tue, 30 Mar 2021 13:41:40 +0200 Subject: [PATCH 1/4] Add codeowners Fixes #9 --- CODEOWNERS | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS new file mode 100644 index 000000000..3a3f62a75 --- /dev/null +++ b/CODEOWNERS @@ -0,0 +1,18 @@ +##################################################### +# +# List of approvers for this repository +# +##################################################### +# +# Learn about membership in OpenTelemetry community: +# https://github.com/open-telemetry/community/blob/main/community-membership.md +# +# Learn about CODEOWNERS file format: +# https://help.github.com/en/articles/about-code-owners + +instrumentation/httpd/ @TomRoSystems +instrumentation/nginx/ @seemk + +* cpp-approvers + +CODEOWNERS cpp-maintainers From d385db853760e300e600825151c1bc4e8bec3ed8 Mon Sep 17 00:00:00 2001 From: Tomasz Rojek Date: Tue, 30 Mar 2021 15:54:37 +0200 Subject: [PATCH 2/4] Fix team names inside codeowners --- CODEOWNERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CODEOWNERS b/CODEOWNERS index 3a3f62a75..eac737aa7 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -13,6 +13,6 @@ instrumentation/httpd/ @TomRoSystems instrumentation/nginx/ @seemk -* cpp-approvers +* @open-telemetry/cpp-approvers -CODEOWNERS cpp-maintainers +CODEOWNERS @open-telemetry/cpp-maintainers From ea8944c0307fe6300f71e946522c6e30718f23db Mon Sep 17 00:00:00 2001 From: Tomasz Rojek Date: Tue, 20 Apr 2021 12:45:11 +0200 Subject: [PATCH 3/4] Use CODEOWNERS from otel-cpp-contrib --- CODEOWNERS | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 CODEOWNERS diff --git a/CODEOWNERS b/CODEOWNERS deleted file mode 100644 index eac737aa7..000000000 --- a/CODEOWNERS +++ /dev/null @@ -1,18 +0,0 @@ -##################################################### -# -# List of approvers for this repository -# -##################################################### -# -# Learn about membership in OpenTelemetry community: -# https://github.com/open-telemetry/community/blob/main/community-membership.md -# -# Learn about CODEOWNERS file format: -# https://help.github.com/en/articles/about-code-owners - -instrumentation/httpd/ @TomRoSystems -instrumentation/nginx/ @seemk - -* @open-telemetry/cpp-approvers - -CODEOWNERS @open-telemetry/cpp-maintainers From f0eb353f55b272f7c53e346f8240d87e03d4a882 Mon Sep 17 00:00:00 2001 From: Tomasz Rojek Date: Tue, 11 May 2021 14:12:20 +0200 Subject: [PATCH 4/4] Update README --- instrumentation/httpd/README.md | 84 ++++++++++++++++++++++++--------- 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/instrumentation/httpd/README.md b/instrumentation/httpd/README.md index 59640b15e..c790ca5db 100644 --- a/instrumentation/httpd/README.md +++ b/instrumentation/httpd/README.md @@ -8,19 +8,73 @@ ## Requirements +- httpd (Apache) ver. 2.4.x on Linux (Current release tested only with Ubuntu LTS 18.04 & 20.04) + +### Usage + +For manual build please check below. Otherwise please use one of the [released versions](/../releases). + +### Installation + +Mod_otel works as a module which is loaded when Apache starts. It is written in C++ therefore standard library has to be included as well. Below is an example of lines which should be added to your configuration file (usually `/etc/httpd/conf.d` or equivalent): + +``` +LoadFile /usr/lib/x86_64-linux-gnu/libstdc++.so.6 +LoadModule otel_module $SCRIPT_DIR/bazel-out/k8-opt/bin/otel.so +``` + +Please check that module is loaded correctly with command `apache2ctl configtest` + +### Configuration + +Below is the list of possible OpenTelemetry directives. + +__OpenTelemetryExporter__ +Configures exporter to be used. At the moment only one global exporter is allowed for entire daemon. Possible values for this setting are: +- `file` - to export to a file +- `otlp` - to export using the OpenTelemetry Protocol + +__OpenTelemetryPath__ +This option specifies file to which to export when `file` exporter is used. If no `OpenTelemetryPath` is specified then spans goes to standard error output which is apache error log. + +__OpenTelemetryEndpoint__ +OpenTelemetryEndpoint specifies where to export spans when OTLP is used. Put hostname and then port. Example value: `host.docker.internal:55680` + +__OpenTelemetryBatch__ +This directive takes 3 numerical arguments for batch processing: +- Max Queue Size +- Delay (in milliseconds, 1000 = 1s) +- Max Export Batch Size +- +For example `OpenTelemetryBatch 10 5000 5` + +__OpenTelemetryPropagators__ +OpenTelemetryPropagators sets which context propagator should be used (defaults to none). Currently supported values are: +- `trace-context` +- `b3` +- `b3-multiheader` + +__OpenTelemetryIgnoreInbound__ + OpenTelemetryIgnoreInbound indicates that we don't trust incoming context. This is a safe default when httpd is an edge server with traffic from Internet. Set it to false only if you run httpd in safe/trusted environment. Possbile values are `on` and `off` (defaults to on). + + __OpenTelemetrySetAttribute__ +Allows to add extra attribute for each span. It takes two text arguments. For example `OpenTelemetrySetAttribute foo bar` + +List of configuration options can be found in [provided configuration file](./opentelemetry.conf) + +## Development + +### Requirements + - C++11 - [OpenTelemetry-Cpp](https://github.com/open-telemetry/opentelemetry-cpp) -- httpd (Apache) ver. 2.4.x on Linux (Current release tested only with Ubuntu LTS 18.04) - Bazel 3.7.x -## Build + development - +### Build Build can be done within docker or alternatively check Development section for Ubuntu below. Execute: `make build` to start build process. After build is successful enable module for httpd (Apache) the `httpd_install_otel.sh` (prepared for Docker Image) script can be used for this. -### Development - For development purposes (to get inside docker) execute `make start` and `make devsh` for each extra terminal. Build is done with Bazel. Execute: `./build.sh` and it should create file `otel.so` inside `bazel-out/k8-opt/bin` directory. @@ -35,7 +89,7 @@ ln -s /mnt/host src When local changes are made, you need to restart the `httpd` server to load new version of library, to do that: `apachectl stop; ./build.sh && apachectl start` -### Development (Ubuntu) +### Prerequisites (Ubuntu) On Ubuntu you need packages listed here: [setup_environment.sh](./setup_environment.sh) which are prerequisites to compile opentelemetry-cpp and here: [setup-buildtools.sh](./setup-buildtools.sh) for apache development stuff. Then just execute [bulid.sh](./build.sh). @@ -47,23 +101,9 @@ Please make sure that code is well formatted with this command: ./tools/check-formatting.sh ``` +when contributing. + ### Testing Integration tests exists in `tests` directory. Please run `run-all.sh` to check functionality. -## Configuration - -At the moment only one global exporter is allowed for entire daemon. Include it following way: - -``` - -OpenTelemetryExporter file -OpenTelemetryPath /tmp/spans - -``` - -in a master configuration which usually is in `/etc/apache2` directory. - -If no `OpenTelemetryPath` is specified then spans goes to standard error output which is apache error log. - -More detailed information about configuration options can be found in [provided configuration file](./opentelemetry.conf)