diff --git a/postgres/datadog_checks/postgres/statement_samples.py b/postgres/datadog_checks/postgres/statement_samples.py index 9db4de149bc73..61f9b4b341969 100644 --- a/postgres/datadog_checks/postgres/statement_samples.py +++ b/postgres/datadog_checks/postgres/statement_samples.py @@ -481,6 +481,13 @@ def _collect_statement_samples(self): tags=self.tags, raw=True, ) + datadog_agent.emit_agent_telemetry( + "postgres", + "collect_activity_snapshot_ms", + (time.time() - start_time) * 1000, + "histogram", + ) + elapsed_ms = (time.time() - start_time) * 1000 self._check.histogram( "dd.postgres.collect_statement_samples.time", @@ -517,6 +524,18 @@ def _collect_statement_samples(self): hostname=self._check.resolved_hostname, raw=True, ) + datadog_agent.emit_agent_telemetry( + "postgres", + "collect_statement_samples_ms", + elapsed_ms, + "histogram", + ) + datadog_agent.emit_agent_telemetry( + "postgres", + "collect_statement_samples_count", + submitted_count, + "gauge", + ) @staticmethod def _to_active_session(row, track_activity_query_size):