Exemplo n.º 1
0
 def __init__(self, name, init_config, instances):
     super(PostgreSql, self).__init__(name, init_config, instances)
     self.db = None
     self._resolved_hostname = None
     self._agent_hostname = None
     self._version = None
     self._is_aurora = None
     self._version_utils = VersionUtils()
     # Deprecate custom_metrics in favor of custom_queries
     if 'custom_metrics' in self.instance:
         self.warning(
             "DEPRECATION NOTICE: Please use the new custom_queries option "
             "rather than the now deprecated custom_metrics")
     self._config = PostgresConfig(self.instance)
     self.pg_settings = {}
     self._warnings_by_code = {}
     self.metrics_cache = PostgresMetricsCache(self._config)
     self.statement_metrics = PostgresStatementMetrics(
         self, self._config, shutdown_callback=self._close_db_pool)
     self.statement_samples = PostgresStatementSamples(
         self, self._config, shutdown_callback=self._close_db_pool)
     self._relations_manager = RelationsManager(self._config.relations)
     self._clean_state()
     self.check_initializations.append(
         lambda: RelationsManager.validate_relations_config(self._config.
                                                            relations))
     # map[dbname -> psycopg connection]
     self._db_pool = {}
     self._db_pool_lock = threading.Lock()
Exemplo n.º 2
0
 def __init__(self, name, init_config, instances):
     super(PostgreSql, self).__init__(name, init_config, instances)
     self.db = None
     self._version = None
     self._is_aurora = None
     # Deprecate custom_metrics in favor of custom_queries
     if 'custom_metrics' in self.instance:
         self.warning(
             "DEPRECATION NOTICE: Please use the new custom_queries option "
             "rather than the now deprecated custom_metrics")
     self.config = PostgresConfig(self.instance)
     self.metrics_cache = PostgresMetricsCache(self.config)
     self.statement_metrics = PostgresStatementMetrics(self.config)
     self._clean_state()
Exemplo n.º 3
0
 def __init__(self, name, init_config, instances):
     super(PostgreSql, self).__init__(name, init_config, instances)
     self.db = None
     self._version = None
     self._is_aurora = None
     self._version_utils = VersionUtils()
     # Deprecate custom_metrics in favor of custom_queries
     if 'custom_metrics' in self.instance:
         self.warning(
             "DEPRECATION NOTICE: Please use the new custom_queries option "
             "rather than the now deprecated custom_metrics")
     self._config = PostgresConfig(self.instance)
     self.metrics_cache = PostgresMetricsCache(self._config)
     self.statement_metrics = PostgresStatementMetrics(self, self._config)
     self.statement_samples = PostgresStatementSamples(self, self._config)
     self._relations_manager = RelationsManager(self._config.relations)
     self._clean_state()
     self.check_initializations.append(
         lambda: RelationsManager.validate_relations_config(self._config.
                                                            relations))