From eef42d5f26c2438e2b58e715beb18e40a4468a6b Mon Sep 17 00:00:00 2001 From: Peter Giacomo Lombardo Date: Sat, 21 Dec 2019 12:53:20 +0000 Subject: [PATCH] If setproctitle not installed - use fallback --- instana/meter.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/instana/meter.py b/instana/meter.py index cbb5ff3b..d8c064a5 100644 --- a/instana/meter.py +++ b/instana/meter.py @@ -259,12 +259,13 @@ def get_application_name(self): basename = os.path.basename(sys.argv[0]) if basename == "gunicorn": - # gunicorn renames their processes to pretty things - we use those by default - # gunicorn: master [djface.wsgi] - # gunicorn: worker [djface.wsgi] - app_name = get_proc_cmdline(as_string=True) - - if app_name is None: + if 'setproctitle' in sys.modules: + # With the setproctitle package, gunicorn renames their processes + # to pretty things - we use those by default + # gunicorn: master [djface.wsgi] + # gunicorn: worker [djface.wsgi] + app_name = get_proc_cmdline(as_string=True) + else: app_name = basename elif "FLASK_APP" in os.environ: app_name = os.environ["FLASK_APP"]