|
TLDR: It is very ugly to try and get metrics when the system's ninja installation is used to compile. Also, the existing python ninja package does not provide an easy way to hook-in. We should fork the existing ninja package – which should be identical to the original except that it uses the new mongo-tooling-metrics library to setup metrics collection.
This needed to be done because as we were working on ninja metrics collection in SERVER-69637 we realized that the system's ninja installation does not provide a reasonable way to run logic before or after the build (without significantly mangling the build). To accommodate ninja metrics collection, we decided to fork https://github.com/scikit-build/ninja-python-distributions . The fork essentially builds ninja and puts it in the python package wheel. Whenever `ninja` is invoked from within a virtualenv, the python package's ninja installation is used instead of the system's ninja installation. The python package ninja is called from a python script, which gives us the opportunity to plug-in. https://github.com/scikit-build/ninja-python-distributions/blob/4a464e6ced4126a4718713262fb7dd72f5c06ade/src/ninja/__init__.py#L54. We should make our own ninja python package and plug-in.
|