From 621e4b1002edc9e9c4dfeab8d9cf265a05e462da Mon Sep 17 00:00:00 2001 From: Simon Merrick Date: Sun, 19 Nov 2023 23:20:12 +1300 Subject: [PATCH 1/7] Create a layer for the opentelemetrt php extension * https://github.com/open-telemetry/opentelemetry-php-instrumentation --- layers/opentelemetry/Dockerfile | 17 +++++++++++++++++ layers/opentelemetry/config.json | 7 +++++++ layers/opentelemetry/test.php | 8 ++++++++ 3 files changed, 32 insertions(+) create mode 100644 layers/opentelemetry/Dockerfile create mode 100644 layers/opentelemetry/config.json create mode 100644 layers/opentelemetry/test.php diff --git a/layers/opentelemetry/Dockerfile b/layers/opentelemetry/Dockerfile new file mode 100644 index 00000000..cb4b12c5 --- /dev/null +++ b/layers/opentelemetry/Dockerfile @@ -0,0 +1,17 @@ +# https://github.com/brefphp/extra-php-extensions/blob/master/layers/yaml/Dockerfile + +ARG PHP_VERSION +ARG BREF_VERSION +FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext + +RUN MAKEFLAGS="-j $(nproc)" && pecl install opentelemetry > /dev/null +RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so +RUN strip --strip-debug /tmp/opentelemetry.so +RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini + +# Build the final image with just the files we need +FROM scratch + +# Copy things we installed to the final image +COPY --from=ext /tmp/opentelemetry.so /opt/bref/extensions/opentelemetry.so +COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-opentelemetry.ini diff --git a/layers/opentelemetry/config.json b/layers/opentelemetry/config.json new file mode 100644 index 00000000..a5a35316 --- /dev/null +++ b/layers/opentelemetry/config.json @@ -0,0 +1,7 @@ +{ + "php": [ + "80", + "81", + "82" + ] +} diff --git a/layers/opentelemetry/test.php b/layers/opentelemetry/test.php new file mode 100644 index 00000000..f7fe507c --- /dev/null +++ b/layers/opentelemetry/test.php @@ -0,0 +1,8 @@ + Date: Mon, 20 Nov 2023 20:41:00 +1300 Subject: [PATCH 2/7] Pin opentelemetry version, tidy PR --- layers/opentelemetry/Dockerfile | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/layers/opentelemetry/Dockerfile b/layers/opentelemetry/Dockerfile index cb4b12c5..1d5fa9aa 100644 --- a/layers/opentelemetry/Dockerfile +++ b/layers/opentelemetry/Dockerfile @@ -1,10 +1,8 @@ -# https://github.com/brefphp/extra-php-extensions/blob/master/layers/yaml/Dockerfile - ARG PHP_VERSION ARG BREF_VERSION FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext -RUN MAKEFLAGS="-j $(nproc)" && pecl install opentelemetry > /dev/null +RUN MAKEFLAGS="-j $(nproc)" && pecl install opentelemetry-1.0.0 > /dev/null RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so RUN strip --strip-debug /tmp/opentelemetry.so RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini From bb6854da8ea7c74c09c41f027d78d6ec56a2de41 Mon Sep 17 00:00:00 2001 From: Simon Merrick Date: Mon, 20 Nov 2023 20:59:14 +1300 Subject: [PATCH 3/7] Fix whitespace --- layers/opentelemetry/test.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layers/opentelemetry/test.php b/layers/opentelemetry/test.php index f7fe507c..2a3e6384 100644 --- a/layers/opentelemetry/test.php +++ b/layers/opentelemetry/test.php @@ -1,7 +1,7 @@ Date: Wed, 22 Nov 2023 10:15:24 +1300 Subject: [PATCH 4/7] Drop MAKEFLAGS --- layers/opentelemetry/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layers/opentelemetry/Dockerfile b/layers/opentelemetry/Dockerfile index 1d5fa9aa..ae61d01d 100644 --- a/layers/opentelemetry/Dockerfile +++ b/layers/opentelemetry/Dockerfile @@ -2,7 +2,7 @@ ARG PHP_VERSION ARG BREF_VERSION FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext -RUN MAKEFLAGS="-j $(nproc)" && pecl install opentelemetry-1.0.0 > /dev/null +RUN pecl install opentelemetry-1.0.0 > /dev/null RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so RUN strip --strip-debug /tmp/opentelemetry.so RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini From ed8c68f286fc19ce30e002024fea33606b39093e Mon Sep 17 00:00:00 2001 From: Simon Merrick Date: Wed, 22 Nov 2023 10:33:58 +1300 Subject: [PATCH 5/7] Revert "Drop MAKEFLAGS" This reverts commit 7258cc9fca2e08487c473aa0be60d3c1d262ab6b. --- layers/opentelemetry/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layers/opentelemetry/Dockerfile b/layers/opentelemetry/Dockerfile index ae61d01d..1d5fa9aa 100644 --- a/layers/opentelemetry/Dockerfile +++ b/layers/opentelemetry/Dockerfile @@ -2,7 +2,7 @@ ARG PHP_VERSION ARG BREF_VERSION FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext -RUN pecl install opentelemetry-1.0.0 > /dev/null +RUN MAKEFLAGS="-j $(nproc)" && pecl install opentelemetry-1.0.0 > /dev/null RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so RUN strip --strip-debug /tmp/opentelemetry.so RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini From 79bd812eb3946d62ac6eb33f25dd85a80cb2d307 Mon Sep 17 00:00:00 2001 From: Simon Merrick Date: Wed, 22 Nov 2023 11:14:54 +1300 Subject: [PATCH 6/7] Drop && --- layers/opentelemetry/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layers/opentelemetry/Dockerfile b/layers/opentelemetry/Dockerfile index 1d5fa9aa..ad6f63e6 100644 --- a/layers/opentelemetry/Dockerfile +++ b/layers/opentelemetry/Dockerfile @@ -2,7 +2,7 @@ ARG PHP_VERSION ARG BREF_VERSION FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext -RUN MAKEFLAGS="-j $(nproc)" && pecl install opentelemetry-1.0.0 > /dev/null +RUN MAKEFLAGS="-j $(nproc)" pecl install opentelemetry-1.0.0 > /dev/null RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so RUN strip --strip-debug /tmp/opentelemetry.so RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini From 6ce33f4f16c0dfff8401996febeb471866b87d85 Mon Sep 17 00:00:00 2001 From: Simon Merrick Date: Wed, 22 Nov 2023 21:15:25 +1300 Subject: [PATCH 7/7] Add opentelemetry to the Readme.md --- Readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Readme.md b/Readme.md index 661e3a9a..8ca9a756 100644 --- a/Readme.md +++ b/Readme.md @@ -77,6 +77,7 @@ functions: | Newrelic | `${bref-extra:newrelic-php-81}` | | ODBC Snowflake | `${bref-extra:odbc-snowflake-php-81}` | | OpenSwoole | `${bref-extra:openswoole-php-81}` | +| OpenTelemetry | `${bref-extra:opentelemetry-php-81}` | | Oracle | `${bref-extra:oci8-php-80}` | | Pcov | `${bref-extra:pcov-php-81}` | | PostgreSQL | `${bref-extra:pgsql-php-81}` |