Skip to content

Commit 66f8541

Browse files
authored
Merge pull request #501 from iokiwi/opentelemetry
Create a layer for the opentelemetry php extension
2 parents 9970a46 + 6ce33f4 commit 66f8541

File tree

4 files changed

+31
-0
lines changed

4 files changed

+31
-0
lines changed

Readme.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ functions:
7777
| Newrelic | `${bref-extra:newrelic-php-81}` |
7878
| ODBC Snowflake | `${bref-extra:odbc-snowflake-php-81}` |
7979
| OpenSwoole | `${bref-extra:openswoole-php-81}` |
80+
| OpenTelemetry | `${bref-extra:opentelemetry-php-81}` |
8081
| Oracle | `${bref-extra:oci8-php-80}` |
8182
| Pcov | `${bref-extra:pcov-php-81}` |
8283
| PostgreSQL | `${bref-extra:pgsql-php-81}` |

layers/opentelemetry/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ARG PHP_VERSION
2+
ARG BREF_VERSION
3+
FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext
4+
5+
RUN MAKEFLAGS="-j $(nproc)" pecl install opentelemetry-1.0.0 > /dev/null
6+
RUN cp `php-config --extension-dir`/opentelemetry.so /tmp/opentelemetry.so
7+
RUN strip --strip-debug /tmp/opentelemetry.so
8+
RUN echo 'extension=opentelemetry.so' > /tmp/ext.ini
9+
10+
# Build the final image with just the files we need
11+
FROM scratch
12+
13+
# Copy things we installed to the final image
14+
COPY --from=ext /tmp/opentelemetry.so /opt/bref/extensions/opentelemetry.so
15+
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-opentelemetry.ini

layers/opentelemetry/config.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"php": [
3+
"80",
4+
"81",
5+
"82"
6+
]
7+
}

layers/opentelemetry/test.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
if (!function_exists($function = "OpenTelemetry\Instrumentation\hook")) {
4+
echo sprintf('FAIL: Function "%s" does not exist.', $function) . PHP_EOL;
5+
exit(1);
6+
}
7+
8+
exit(0);

0 commit comments

Comments
 (0)