예제 #1
0
    def setup(self,
              snapshot_path: str,
              bootstrap_path: str,
              ads_path: str,
              config_path: Optional[str],
              ambex_pid: int,
              kick: Optional[str],
              k8s=False,
              do_checks=True,
              no_envoy=False,
              reload=False,
              debug=False,
              verbose=False,
              notices=None,
              validation_retries=5,
              allow_fs_commands=False,
              local_scout=False,
              report_action_keys=False):
        self.estats = EnvoyStats()
        self.health_checks = do_checks
        self.no_envoy = no_envoy
        self.debugging = reload
        self.verbose = verbose
        self.notice_path = notices
        self.notices = Notices(self.notice_path)
        self.notices.reset()
        self.k8s = k8s
        self.validation_retries = validation_retries
        self.allow_fs_commands = allow_fs_commands
        self.local_scout = local_scout
        self.report_action_keys = report_action_keys

        # This will raise an exception and crash if you pass it a string. That's intentional.
        self.ambex_pid = int(ambex_pid)
        self.kick = kick

        # This feels like overkill.
        self.logger = logging.getLogger("ambassador.diagd")
        self.logger.setLevel(logging.INFO)

        if debug:
            self.logger.setLevel(logging.DEBUG)
            logging.getLogger('ambassador').setLevel(logging.DEBUG)

        self.config_path = config_path
        self.bootstrap_path = bootstrap_path
        self.ads_path = ads_path
        self.snapshot_path = snapshot_path

        self.ir = None
        self.stats_updater = None
        self.scout_checker = None

        self.last_request_info = {}
        self.last_request_time = None

        # self.scout = Scout(update_frequency=datetime.timedelta(seconds=10))
        self.scout = Scout(local_only=self.local_scout)
예제 #2
0
파일: diagd.py 프로젝트: jpoley/ambassador
def create_diag_app(config_dir_path,
                    bootstrap_path,
                    ads_path,
                    snapshot_path,
                    ambex_pid: int,
                    kick: Optional[str],
                    do_checks=False,
                    reload=False,
                    debug=False,
                    k8s=True,
                    verbose=False,
                    notices=None):
    app.estats = EnvoyStats()
    app.health_checks = False
    app.debugging = reload
    app.verbose = verbose
    app.k8s = k8s
    app.notice_path = notices
    app.notices = Notices(app.notice_path)
    app.notices.reset()

    # This will raise an exception and crash if you pass it a string. That's intentional.
    app.ambex_pid = int(ambex_pid)
    app.kick = kick

    # This feels like overkill.
    app.logger = logging.getLogger("ambassador.diagd")
    app.logger.setLevel(logging.INFO)

    if debug:
        app.logger.setLevel(logging.DEBUG)
        logging.getLogger('ambassador').setLevel(logging.DEBUG)

    if do_checks:
        app.health_checks = True

    app.config_dir_prefix = config_dir_path
    app.bootstrap_path = bootstrap_path
    app.ads_path = ads_path
    app.snapshot_path = snapshot_path

    app.ir = None

    return app
예제 #3
0
    def setup(self,
              snapshot_path: str,
              bootstrap_path: str,
              ads_path: str,
              config_path: Optional[str],
              ambex_pid: int,
              kick: Optional[str],
              do_checks=True,
              no_envoy=False,
              reload=False,
              debug=False,
              verbose=False,
              notices=None):
        self.estats = EnvoyStats()
        self.health_checks = do_checks
        self.no_envoy = no_envoy
        self.debugging = reload
        self.verbose = verbose
        self.notice_path = notices
        self.notices = Notices(self.notice_path)
        self.notices.reset()

        # This will raise an exception and crash if you pass it a string. That's intentional.
        self.ambex_pid = int(ambex_pid)
        self.kick = kick

        # This feels like overkill.
        self.logger = logging.getLogger("ambassador.diagd")
        self.logger.setLevel(logging.INFO)

        if debug:
            self.logger.setLevel(logging.DEBUG)
            logging.getLogger('ambassador').setLevel(logging.DEBUG)

        self.config_path = config_path
        self.bootstrap_path = bootstrap_path
        self.ads_path = ads_path
        self.snapshot_path = snapshot_path

        self.ir = None
        self.stats_updater = None

        # self.scout = Scout(update_frequency=datetime.timedelta(seconds=30))
        self.scout = Scout()
예제 #4
0
def create_diag_app(config_dir_path, do_checks=False, reload=False, debug=False, k8s=True, verbose=False, notices=None):
    app.estats = EnvoyStats()
    app.health_checks = False
    app.debugging = reload
    app.verbose = verbose
    app.k8s = k8s
    app.notice_path = notices

    # This feels like overkill.
    app.logger = logging.getLogger("ambassador.diagd")
    app.logger.setLevel(logging.INFO)

    if debug:
        app.logger.setLevel(logging.DEBUG)
        logging.getLogger('ambassador').setLevel(logging.DEBUG)

    if do_checks:
        app.health_checks = True

    app.config_dir_prefix = config_dir_path

    return app