Skip to content

Commit

Permalink
Use activity event pipline for the deadlock event
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlovb committed Aug 8, 2024
1 parent fa6a2ab commit c1071b7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions sqlserver/datadog_checks/sqlserver/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,14 +250,14 @@ def run_job(self):
@tracked_method(agent_check_getter=agent_check_getter)
def _collect_deadlocks(self):
deadlock_xmls = self._deadlocks.collect_deadlocks()
#deadlocks_event = self._create_deadlock_event(deadlock_xmls)
#payload = json.dumps(deadlocks_event, default=default_json_event_encoding)
#self._check.database_monitoring_deadlocks(payload)
deadlocks_event = self._create_deadlock_event(deadlock_xmls)
payload = json.dumps(deadlocks_event, default=default_json_event_encoding)
self._check.database_monitoring_query_activity(payload)


deadlocks_event_activity = self._create_activity_event([], [], deadlock_xmls)
payload = json.dumps(deadlocks_event_activity, default=default_json_event_encoding)
self._check.database_monitoring_query_activity(payload)
#deadlocks_event_activity = self._create_activity_event([], [], deadlock_xmls)
#payload = json.dumps(deadlocks_event_activity, default=default_json_event_encoding)
#self._check.database_monitoring_query_activity(payload)

@tracked_method(agent_check_getter=agent_check_getter)
def _get_active_connections(self, cursor):
Expand Down Expand Up @@ -420,7 +420,7 @@ def _sanitize_row(row, obfuscated_statement=None):
def _get_estimated_row_size_bytes(row):
return len(str(row))

def _create_activity_event(self, active_sessions, active_connections, deadlocks = []):
def _create_activity_event(self, active_sessions, active_connections):
event = {
"host": self._check.resolved_hostname,
"ddagentversion": datadog_agent.get_version(),
Expand All @@ -434,7 +434,6 @@ def _create_activity_event(self, active_sessions, active_connections, deadlocks
"cloud_metadata": self._config.cloud_metadata,
"sqlserver_activity": active_sessions,
"sqlserver_connections": active_connections,
"sqlserver_deadlocks": deadlocks,
}
return event

Expand Down

0 comments on commit c1071b7

Please sign in to comment.