-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
On startup, have services print their name and version info #987
Comments
Files to add this to include (but may not be limited to) :
and especially:
|
here are some ways to get git metadata:
and possibly still useful but probably less so:
|
it may also be worth including a list of all of the installed packages/libraries and their version numbers |
we may also want to print the values of all of the environment variables, though like with command line args as listed above, this has a chance to possibly reveal passwords. |
This can be done with the simple |
Updated git log -n 1 --format=format:'%h @ %ci %d' More ideas for logging dependency environments programatically (each has its drawbacks) : # uses nonpublic submodule :(
# shell command rough equivalents:
# pip3 freeze --all
# pip3 list --include-editable --pre --format=freeze
from pip._internal.operations.freeze import freeze
for requirement in freeze():
print(requirement)
# deprecated, doesnt work past python 3.9ish? :(
import pkg_resources
dists = [str(d).replace(" ","==") for d in pkg_resources.working_set]
for i in dists:
print(i)
# not supported til python 3.10ish? :(
from importlib import metadata
for dist in metadata.distributions():
print(f"{dist.name}=={dist.version}")
# dont do this, it loads all the packages into memory
import pkgutil
for p in pkgutil.walk_packages(onerror=lambda e: print(f"WHOOPS: {e}")):
print(p.name)
import sys
for module in sys.modules.values():
if hasattr(module, "__version__"):
print(f"{module.__name__}=={module.__version__}")
else:
print(module.__name__) |
On startup/restart, have services print (log) their name and some sort of versioning info, like docker image name + build date, and git repo + branch + tag + gitref (commit id), and etc...
Also print/log the current time (obviously), as well as the command line and arguments provided (though this could be problematic where passwords are provided by command line arguments)
Docker metadata isnt included in or exposed to running containers by default, so we might need to get that by adding something to our image build process (by adding stuff to the image filesystem).
The services where this should be applied include acquisition csv processing, acquisition metadata generation, webservice/api, and pipelines. We can find many of the places to insert this by looking for references to "
__main__
" in the code (by runninggrep -rl __main__ .
-- ill put the output of the files found by this command in the first comment) but this is not necessarily exhaustive depending on how jobs are brought up (gunicorn, for example, doesnt seem to need main to start the webapp).This issue is very closely related to cmu-delphi/covidcast-indicators#1702
The text was updated successfully, but these errors were encountered: