You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: track request cpu and peak memory usage and expose in caddy replacer vars
This captures request cpu (user+system) and peak memory usage similar to FPM and Apache2 SAPIs.
To propagate this back to Go we store it in FrankenPHP context first, before retrieving it in embedder / runtime (e.g. Caddy) from context.
For better compatibility with FPM logging we expose script and script filename vars as well.
CPU usage is nanoseconds user space and system space thread runtime (only works on POSIX that supports clock_gettime(CLOCK_THREAD_CPUTIME_ID)).
Memory usage is retrieved at the end of every request. In worker mode we reset peak memory usage before every request.
Using in Caddy:
```
log_append cpu_usage_human {http.frankenphp.cpu_usage_human}
log_append cpu_usage {http.frankenphp.cpu_usage}
log_append memory_usage {http.frankenphp.memory_usage}
log_append memory_usage_human {http.frankenphp.memory_usage_human}
log_append script {http.frankenphp.script}
log_append script_filename {http.frankenphp.script_filename}
```
0 commit comments