def collect_snapshot(self):
        """  Collects snapshot related information to this process and environment """
        try:
            if "INSTANA_SERVICE_NAME" in os.environ:
                appname = os.environ["INSTANA_SERVICE_NAME"]
            elif "FLASK_APP" in os.environ:
                appname = os.environ["FLASK_APP"]
            elif "DJANGO_SETTINGS_MODULE" in os.environ:
                appname = os.environ["DJANGO_SETTINGS_MODULE"].split('.')[0]
            elif os.path.basename(sys.argv[0]) == '' and sys.stdout.isatty():
                appname = "Interactive Console"
            else:
                if os.path.basename(sys.argv[0]) == '':
                    appname = os.path.basename(sys.executable)
                else:
                    appname = os.path.basename(sys.argv[0])

            s = Snapshot(name=appname, version=platform.version(),
                         f=platform.python_implementation(),
                         a=platform.architecture()[0],
                         djmw=self.djmw)
            s.version = sys.version
            s.versions = self.collect_modules()
        except Exception as e:
            logger.debug(e.message)
        else:
            return s
def collect_snapshot ( self ) : try : if "INSTANA_SERVICE_NAME" in os . environ : appname = os . environ [ "INSTANA_SERVICE_NAME" ] elif "FLASK_APP" in os . environ : appname = os . environ [ "FLASK_APP" ] elif "DJANGO_SETTINGS_MODULE" in os . environ : appname = os . environ [ "DJANGO_SETTINGS_MODULE" ] . split ( '.' ) [ 0 ] elif os . path . basename ( sys . argv [ 0 ] ) == '' and sys . stdout . isatty ( ) : appname = "Interactive Console" else : if os . path . basename ( sys . argv [ 0 ] ) == '' : appname = os . path . basename ( sys . executable ) else : appname = os . path . basename ( sys . argv [ 0 ] ) s = Snapshot ( name = appname , version = platform . version ( ) , f = platform . python_implementation ( ) , a = platform . architecture ( ) [ 0 ] , djmw = self . djmw ) s . version = sys . version s . versions = self . collect_modules ( ) except Exception as e : logger . debug ( e . message ) else : return s
Collects snapshot related information to this process and environment