when I install the elastic apm php agent to my project in laravel my dockerfile it raises the response time of my endpoints whether I configure my php.ini or not.
dockerfile
this is my docker configuration which if I install the apm php agent it makes the endpoint response times go up
FROM php:8.1.12-apache
COPY php/php.ini "$PHP_INI_DIR/conf.d/php.ini"
COPY apache/conf-available/*.conf /etc/apache2/conf-available/
COPY apache/default.conf /etc/apache2/sites-enabled/000-default.conf
COPY apache/apache2.conf /etc/apache2/apache2.conf
COPY apache/error/*.html /usr/share/apache2/error/
COPY --from=mlocati/php-extension-installer:2.1.22 /usr/bin/install-php-extensions /usr/local/bin/
RUN apt update && apt install -y \
libcurl4-openssl-dev \
libssl-dev \
libzip-dev \
libpq-dev \
libmagickwand-dev \
supervisor && \
/usr/local/bin/install-php-extensions imagick mongodb redis gd opcache mysqli pdo pdo_mysql zip xml curl
ADD https://github.com/elastic/apm-agent-php/releases/download/v1.8.4/apm-agent-php_1.8.4_all.deb /srv/apm-agent-php_1.8.4_all.deb
RUN dpkg -i /srv/apm-agent-php_1.8.4_all.deb
ADD https://github.com/elastic/apm-agent-php/archive/refs/tags/v1.8.4.tar.gz /srv/apm.tar.gz
RUN mkdir -p /usr/src/php/ext \
&& cd /srv/ && tar zxf /srv/apm.tar.gz \
&& mv /srv/apm-agent-php-1.8.4/src/ext /usr/src/php/ext/apm-agent \
&& docker-php-ext-install apm-agent \
&& docker-php-ext-enable elastic_apm
RUN a2enmod rewrite
COPY php/policy.xml /etc/ImageMagick-6/policy.xml
COPY supervisor/capture-worker.conf /etc/supervisor/conf.d/
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
COPY conect /conect
COPY --chown=www-data:www-data src .
RUN service supervisor start && supervisorctl reread && supervisorctl update && \
composer install --optimize-autoloader --no-dev --ignore-platform-reqs
CMD bash -c "php /var/www/html/artisan optimize && service supervisor start && chown -R www-data:www-data . && apache2-foreground"
php.ini
now if in my php.ini I configure apm or not it is still delayed with the installation of the apm agent in my project.
extension=elastic_apm.so
elastic_apm.bootstrap_php_part_file=/srv/apm-agent-php-1.8.4/src/bootstrap_php_part.php
elastic_apm.server_url="https://server.server.co:8200"
elastic.apm.secret_token=""
elastic_apm.environment=${APP_ENV}
elastic_apm.breakdown_metrics=true
elastic_apm.service_name="server_Backend"
elastic_apm.hostname="server_Backend_Container"
elastic_apm.enabled=true
elastic_apm.log_level=ERROR
elastic_apm.log_level_stderr=ERROR
elastic_apm.log_level_syslog=ERROR