我通过向我的 Dockerfileapm-agent-php
添加脚本来安装
RUN apk --no-cache add curl-dev gcc g++ make autoconf && \
mkdir -p /etc/apm-agent && \
curl -L "https://github.com/elastic/apm-agent-php/archive/refs/tags/v1.2.tar.gz" > /tmp/apm-agent.tar.gz && \
tar -zxvf /tmp/apm-agent.tar.gz -C /etc/apm-agent --strip-components 1 && \
cd /etc/apm-agent/src/ext && \
phpize && \
CFLAGS="-std=gnu99" ./configure --enable-elastic_apm && \
make && \
make install && \
rm /tmp/apm-agent.tar.gz
php.ini
然后在文件中启用
extension="elastic_apm.so"
elastic_apm.bootstrap_php_part_file=/etc/apm-agent/src/bootstrap_php_part.php
elastic_apm.environment=__elastic_apm_env__
elastic_apm.enabled=__elastic_apm_enabled__
elastic_apm.server_url=__elastic_apm_server_url__
elastic_apm.service_name=__elastic_apm_service_name__
elastic_apm.secret_token=__elastic_apm_secret__
elastic_apm.transaction_sample_rate=0.1
elastic_apm.transaction_max_spans=100
elastic_apm.server_timeout=50ms
启动容器后,代理可以成功向APM服务器发送数据,但5-6次reload后,服务器崩溃错误
child 17 exited on signal 11 (SIGSEGV - core dumped) after 33.225786 seconds from start
并且无法访问该网站了。1-2分钟后,我可以再次访问该网站,但重新加载4-5次后,再次出现同样的问题。
如果elastic_apm.enabled=false
(已安装但未启用)则不会发生此问题
注意:也可以通过使用 APK 包尝试其他安装方法,但遇到同样的问题
RUN curl -L https://github.com/elastic/apm-agent-php/releases/download/v1.2/apm-agent-php_1.2_all.apk > /tmp/apm-agent-php.apk && \
apk add --allow-untrusted /tmp/apm-agent-php.apk && \
rm /tmp/apm-agent-php.apk
有没有人有这个问题的经验?