Skip to content

Conversation

@aparador
Copy link
Contributor

@aparador aparador commented Jul 25, 2025

Motivation

The php-fpm request_slowlog_timeout option was not previously configured, by enabling this option

  • Slow PHP requests can be logged and traced.
  • These traces can be picked up by the php-fpm-exporter, which exposes them as Prometheus metrics.
  • This helps developers and platform engineers detect performance issues and identify problematic code paths

Changes

  • Added php-fpm.conf under images/php/ with [www] request_slowlog_timeout, slowlog as the contents.
  • Updated Dockerfile.fpm to:
    • Copy php-fpm.conf into /usr/local/etc/php-fpm.d/
    • Add ONBUILD ARG and ONBUILD ENV for BAY_PHP_FPM_REQUEST_SLOWLOG_TIMEOUT
  • Made the timeout value configurable using an environment variable.
  • Maintained default value as 10s unless overridden.

Testing

  1. Build image locally cd images/php and docker build -t test-php-fpm -f Dockerfile.fpm .

@nicksantamaria
Copy link
Contributor

I think this is looking good @aparador ! The image for this branch was built, you can see it here - https://github.com/dpc-sdp/bay/pkgs/container/bay%2Fphp-fpm/470096179?tag=pr-367

Should be OK to get the testing steps underway now 👍

@nicksantamaria
Copy link
Contributor

/build

1 similar comment
@nicksantamaria
Copy link
Contributor

/build

@nicksantamaria
Copy link
Contributor

/build

1 similar comment
@nicksantamaria
Copy link
Contributor

/build

@nicksantamaria
Copy link
Contributor

I have tested this locally by creating a php script with sleep(11); at the top. Hitting this script gives the following results:

The request is added to the slowlog.

[02-Jan-2026 11:16:55] WARNING: [pool www] child 38, script '/app/docroot/index.php' (request: "GET /index.php") executing too slow (10.078954 sec), logging
[02-Jan-2026 11:16:55] NOTICE: child 38 stopped for tracing
[02-Jan-2026 11:16:55] NOTICE: about to trace 38

php-fpm_exporter incremented its slow request metric

phpfpm_slow_requests{pool="www",scrape_uri="tcp://127.0.0.1:9000/status"} 1

I'm happy to merge this one now - thanks for your great work @aparador !

@nicksantamaria nicksantamaria merged commit 5acad8a into 6.x Jan 2, 2026
12 of 13 checks passed
@nicksantamaria nicksantamaria deleted the build/SDPPE-41 branch January 2, 2026 00:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants