diff --git a/sap_hana/datadog_checks/sap_hana/sap_hana.py b/sap_hana/datadog_checks/sap_hana/sap_hana.py index e406671a9298e..e0cc0092ddd64 100644 --- a/sap_hana/datadog_checks/sap_hana/sap_hana.py +++ b/sap_hana/datadog_checks/sap_hana/sap_hana.py @@ -99,7 +99,7 @@ def check(self, instance): self.log.error('Error querying %s: %s', e.source(), str(e)) continue except Exception as e: - self.log.error('Unexpected error running `%s`: %s', query_method.__name__, str(e)) + self.log.exception('Unexpected error running `%s`: %s', query_method.__name__, str(e)) continue finally: if self._connection_lost: @@ -193,8 +193,9 @@ def query_licenses(self): self.gauge('license.utilized', utilized, tags=tags, hostname=host) def query_connection_overview(self): - # https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.02/en-US/20abcf1f75191014a254a82b3d0f66bf.html - db_counts = defaultdict(lambda: {'running': 0, 'idle': 0}) + # https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.05/en-US/20abcf1f75191014a254a82b3d0f66bf.html + # Documented statuses: RUNNING, IDLE, QUEUING, EMPTY + db_counts = defaultdict(lambda: defaultdict(int)) for conn in self.iter_rows(queries.GlobalSystemConnectionsStatus): db_counts[(conn['db_name'], conn['host'], conn['port'])][conn['status'].lower()] += conn['total'] @@ -206,10 +207,14 @@ def query_connection_overview(self): host = self.get_hana_hostname(host) running = counts['running'] idle = counts['idle'] + queuing = counts['queuing'] + empty = counts['empty'] self.gauge('connection.running', running, tags=tags, hostname=host) self.gauge('connection.idle', idle, tags=tags, hostname=host) self.gauge('connection.open', running + idle, tags=tags, hostname=host) + self.gauge('connection.queuing', queuing, tags=tags, hostname=host) + self.gauge('connection.empty', empty, tags=tags, hostname=host) def query_disk_usage(self): # https://help.sap.com/viewer/4fe29514fd584807ac9f2a04f6754767/2.0.02/en-US/a2aac2ee72b341699fa8eb3988d8cecb.html diff --git a/sap_hana/metadata.csv b/sap_hana/metadata.csv index e3fca24ac7eb2..5dbb94454c10d 100644 --- a/sap_hana/metadata.csv +++ b/sap_hana/metadata.csv @@ -3,6 +3,8 @@ sap_hana.backup.latest,gauge,,second,,The time elapsed since the latest database sap_hana.connection.idle,gauge,,connection,,The current number of idle connections.,0,sap_hana, sap_hana.connection.open,gauge,,connection,,The current number of connections.,0,sap_hana, sap_hana.connection.running,gauge,,connection,,The current number of running connections.,0,sap_hana, +sap_hana.connection.queuing,gauge,,connection,,The current number of queued connections.,0,sap_hana, +sap_hana.connection.empty,gauge,,connection,,Historic connections that are removed after a period of time.,0,sap_hana, sap_hana.cpu.service.utilized,gauge,,percent,,The CPU utilization of services as a percentage.,0,sap_hana, sap_hana.disk.free,gauge,,byte,,The total free size of the disk in bytes.,1,sap_hana, sap_hana.disk.size,gauge,,byte,,The total size of the disk in bytes.,0,sap_hana, diff --git a/sap_hana/tests/metrics.py b/sap_hana/tests/metrics.py index 799133aa75d9a..bdd49e1b57e08 100644 --- a/sap_hana/tests/metrics.py +++ b/sap_hana/tests/metrics.py @@ -7,6 +7,8 @@ 'sap_hana.connection.open', 'sap_hana.connection.running', 'sap_hana.cpu.service.utilized', + 'sap_hana.connection.queuing', + 'sap_hana.connection.empty', 'sap_hana.disk.free', 'sap_hana.disk.size', 'sap_hana.disk.used', diff --git a/sap_hana/tests/test_unit.py b/sap_hana/tests/test_unit.py index d30b8e73c22c3..36c1d24d20f13 100644 --- a/sap_hana/tests/test_unit.py +++ b/sap_hana/tests/test_unit.py @@ -44,7 +44,7 @@ def query_master_database(): check.query_master_database = query_master_database check.check(None) - check.log.error.assert_any_call('Unexpected error running `%s`: %s', 'query_master_database', 'test') + check.log.exception.assert_any_call('Unexpected error running `%s`: %s', 'query_master_database', 'test') def test_custom_query_configuration(instance):