jokkedk/webgrind

Docker Webgrind ignores index.php by default and is not configurable.

Opened this issue · 2 comments

Webgrind is ignoring index.php by default because of the following default setting:

    static $hideWebgrindProfiles = true;

This means WordPress, which uses index.php to route all requests, does not show profiles for normal page loads. I wasn't able to find a way to configure this without overriding the config file itself, which isn't a future-proof solution.

In docker, xdebug isn't even installed and webgrind will never profile itself.

Could we use the /** DOCKER:ENABLE **/ flag to toggle the $hideWebgrindProfiles value?

FYI, I solved this by creating custom Docker image and modifying the $hideWebgrindProfiles variable during the image build process:

FROM jokkedk/webgrind:1.9.2

# WordPress requests goes through index.php file, while webgrind treats index.php profiles
# as its internal ones. Altering this setting solves the issue.
RUN sed -i 's/static $hideWebgrindProfiles = true;/static $hideWebgrindProfiles = false;/' config.php

It's not perfect, but works 🤷‍♂️