Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ RUN set -eux; \
} > "$APACHE_CONFDIR/conf-available/mediawiki.conf"; \
a2enconf mediawiki

ARG INSTALL_PROFILING_DEPS=0
ENV MW_ENABLE_PROFILING_HEADER=${INSTALL_PROFILING_DEPS}
COPY install_profiling.sh /install_profiling.sh
RUN if [ "$INSTALL_PROFILING_DEPS" = "1" ] ; then bash /install_profiling.sh ; else echo "skipping profiling dependencies ..." ; fi

ARG INSTALL_XDEBUG=0
COPY install_xdebug.sh /install_xdebug.sh
RUN if [ "$INSTALL_XDEBUG" = "1" ] ; then bash /install_xdebug.sh ; else echo "skipping xdebug ..." ; fi
Expand Down
10 changes: 10 additions & 0 deletions dist-persist/wbstack/src/Settings/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
$wgShowExceptionDetails = true;
}

// profiling
// requires docker image to be built with dependencies
if( getenv('MW_ENABLE_PROFILING_HEADER') === '1' && isset ( $_SERVER['HTTP_X_WBSTACK_MW_PROFILING'] ) ) {
$wgProfiler['class'] = 'ProfilerXhprof';
$wgProfiler['output'] = [ 'ProfilerOutputText', 'ProfilerOutputDump' ];
$wgProfiler['outputDir'] = "/tmp/";
$wgProfiler['visible'] = true;
}


// Load Logging when not in phpunit or doing l10n rebuild
if ( !$wwIsPhpUnit && !$wwIsLocalisationRebuild ) {
$wgMWLoggerDefaultSpi = [
Expand Down
10 changes: 10 additions & 0 deletions dist/wbstack/src/Settings/LocalSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,16 @@
$wgShowExceptionDetails = true;
}

// profiling
// requires docker image to be built with dependencies
if( getenv('MW_ENABLE_PROFILING_HEADER') === '1' && isset ( $_SERVER['HTTP_X_WBSTACK_MW_PROFILING'] ) ) {
$wgProfiler['class'] = 'ProfilerXhprof';
$wgProfiler['output'] = [ 'ProfilerOutputText', 'ProfilerOutputDump' ];
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This output format really sucks though.

Ideally this could be hooked up to xhgui for the local minikube cluster maybe? Still unclear to me how to do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could still move forward with this PR and have a followup to make it more usable

$wgProfiler['outputDir'] = "/tmp/";
$wgProfiler['visible'] = true;
}


// Load Logging when not in phpunit or doing l10n rebuild
if ( !$wwIsPhpUnit && !$wwIsLocalisationRebuild ) {
$wgMWLoggerDefaultSpi = [
Expand Down
12 changes: 12 additions & 0 deletions install_profiling.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -e

cd /tmp && \
git clone "https://github.com/tideways/php-xhprof-extension.git" && \
cd php-xhprof-extension && \
phpize && \
./configure && \
make && \
make install && \
rm -rf /tmp/php-xhprof-extension && \
echo "extension=tideways_xhprof.so" >> /usr/local/etc/php/conf.d/tweaks.ini