def _setup_final_environment()

in codeguru_profiler_agent/profiler.py [0:0]


    def _setup_final_environment(self, environment, environment_override):
        environment.update(environment_override)

        # set additional parameters if needed (costly default init or depend on other parameters)
        if environment.get('initial_sampling_interval') is None:
            environment['initial_sampling_interval'] = datetime.timedelta(
                seconds=SystemRandom().uniform(0, AgentConfiguration.get().sampling_interval.total_seconds()))
        environment['excluded_threads'] = \
            frozenset({environment['profiler_thread_name']}.union(environment['excluded_threads']))
        # TODO delay metadata lookup until we need it
        environment['agent_metadata'] = environment.get('agent_metadata') or AgentMetadata()
        environment['errors_metadata'] = environment.get('errors_metadata') or ErrorsMetadata()
        environment['collector'] = environment.get('collector') or self._select_collector(environment)
        environment["profiler_disabler"] = environment.get('profiler_disabler') or ProfilerDisabler(environment)
        return UnmodifiableDict(environment)