Skip to content

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.


// 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

@toban toban force-pushed the add-profiling-deps branch from f4ce15e to cf6e041 Compare May 12, 2022 14:03
@toban toban force-pushed the add-profiling-deps branch from cf6e041 to 9510cdc Compare May 20, 2022 15:48
toban added 2 commits June 30, 2022 12:16
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.
@toban toban force-pushed the add-profiling-deps branch from 9510cdc to e4bb2df Compare June 30, 2022 10:16
@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