Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install profiling dependencies conditionally #252

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

toban
Copy link
Contributor

@toban toban commented May 12, 2022

This allows profiling deps to be installed conditionally in the docker file.

It also allows for the X-WBSTACK-MW-PROFILING header to enable it.

@@ -44,6 +44,16 @@
$wgShowExceptionDetails = true;
}

// profiling
// requires docker image to be built with dependencies
if( isset ( $_SERVER['HTTP_X_WBSTACK_MW_PROFILING'] ) ) {
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 should maybe, probably be hidden behind something more.

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess we don't want users of the public service to be able to enable this with a header (even though the actual profiling code won't be baked into their docker image). We could add another environment variable and a check here.

Alternatively we could put this in a separate file and just copy it in for certain builds of the image

Copy link
Collaborator

Choose a reason for hiding this comment

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

Alternatively we could put this in a separate file and just copy it in for certain builds of the image

+1 sounds like a good approach to me!

Copy link
Contributor Author

@toban toban May 12, 2022

Choose a reason for hiding this comment

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

I'm not sure how to conditionally copy this new localsettings file into the container without having to shuffle a bunch of stuff around in the build context which seems to be the suggested way of doing that. COPY can take files that sometimes doesn't exist.

Feels however like this just makes everything more complex and fragile, I think just
setting a new value like

ENV MW_ENABLE_PROFILING_HEADER=${INSTALL_PROFILING_DEPS}

and look that this is the same expected value the install_profiling.sh script expects.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

something like f4ce15e

// requires docker image to be built with dependencies
if( 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

This allows profiling deps to be installed conditionally in the docker file.

It also allows for the X-WBSTACK-MW-PROFILING header to enable it.
@addshore
Copy link
Collaborator

addshore commented Sep 2, 2022

Just resolved a simple conflict.

looking at this (and the debug option that is already merged) again it would be nice to not need to include these layers in the docker file that is used for production deployment.
OR if they are included try to reduce the number of layers that get added.
This could for example squashing the xdebug and profiling steps together.

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.

4 participants