From d651786206dc447f88b7072d57298835efb1bb34 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Thu, 9 Apr 2020 17:27:19 -0400 Subject: [PATCH] Collect task timing, warnings, and deprecations from job events Timing information requires ansible-runner >= 1.4.6. --- awx/main/analytics/collectors.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/awx/main/analytics/collectors.py b/awx/main/analytics/collectors.py index 17158d853f..1998925202 100644 --- a/awx/main/analytics/collectors.py +++ b/awx/main/analytics/collectors.py @@ -222,7 +222,7 @@ def query_info(since, collection_type): # Copies Job Events from db to a .csv to be shipped -@table_version('events_table.csv', '1.0') +@table_version('events_table.csv', '1.1') @table_version('unified_jobs_table.csv', '1.0') @table_version('unified_job_template_table.csv', '1.0') def copy_tables(since, full_path): @@ -248,7 +248,12 @@ def copy_tables(since, full_path): main_jobevent.role, main_jobevent.job_id, main_jobevent.host_id, - main_jobevent.host_name + main_jobevent.host_name, + CAST(main_jobevent.event_data::json->>'start' AS TIMESTAMP) AS start, + CAST(main_jobevent.event_data::json->>'end' AS TIMESTAMP) AS end, + main_jobevent.event_data::json->'duration' AS duration, + main_jobevent.event_data::json->'res'->'warnings' AS warnings, + main_jobevent.event_data::json->'res'->'deprecations' AS deprecations FROM main_jobevent WHERE main_jobevent.created > {} ORDER BY main_jobevent.id ASC) TO STDOUT WITH CSV HEADER'''.format(since.strftime("'%Y-%m-%d %H:%M:%S'"))