From 1676c0261152b1f98edae6da105cccf66f4020f5 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Mon, 18 Apr 2022 11:42:19 -0400 Subject: [PATCH 1/2] Ship the resolved_role event data to analytics --- awx/main/analytics/collectors.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/awx/main/analytics/collectors.py b/awx/main/analytics/collectors.py index ee52dece89..e4ad01f5ec 100644 --- a/awx/main/analytics/collectors.py +++ b/awx/main/analytics/collectors.py @@ -338,6 +338,7 @@ def _events_table(since, full_path, until, tbl, where_column, project_job_create {tbl}.event, task_action, resolved_action, + resolved_role, -- '-' operator listed here: -- https://www.postgresql.org/docs/12/functions-json.html -- note that operator is only supported by jsonb objects @@ -357,7 +358,7 @@ def _events_table(since, full_path, until, tbl, where_column, project_job_create x.duration AS duration, x.res->'warnings' AS warnings, x.res->'deprecations' AS deprecations - FROM {tbl}, jsonb_to_record({event_data}) AS x("res" json, "duration" text, "task_action" text, "resolved_action" text, "start" text, "end" text) + FROM {tbl}, jsonb_to_record({event_data}) AS x("res" json, "duration" text, "task_action" text, "resolved_action" text, "resolved_role" text, "start" text, "end" text) WHERE ({tbl}.{where_column} > '{since.isoformat()}' AND {tbl}.{where_column} <= '{until.isoformat()}')) TO STDOUT WITH CSV HEADER''' return query From 2530ada9d7a3fb536fd42830cb0ef0a969a96e10 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Mon, 18 Apr 2022 16:49:53 -0400 Subject: [PATCH 2/2] Bump analytics event_table version --- awx/main/analytics/collectors.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/main/analytics/collectors.py b/awx/main/analytics/collectors.py index e4ad01f5ec..cc13b913e8 100644 --- a/awx/main/analytics/collectors.py +++ b/awx/main/analytics/collectors.py @@ -368,12 +368,12 @@ def _events_table(since, full_path, until, tbl, where_column, project_job_create return _copy_table(table='events', query=query(f"replace({tbl}.event_data::text, '\\u0000', '')::jsonb"), path=full_path) -@register('events_table', '1.4', format='csv', description=_('Automation task records'), expensive=four_hour_slicing) +@register('events_table', '1.5', format='csv', description=_('Automation task records'), expensive=four_hour_slicing) def events_table_unpartitioned(since, full_path, until, **kwargs): return _events_table(since, full_path, until, '_unpartitioned_main_jobevent', 'created', **kwargs) -@register('events_table', '1.4', format='csv', description=_('Automation task records'), expensive=four_hour_slicing) +@register('events_table', '1.5', format='csv', description=_('Automation task records'), expensive=four_hour_slicing) def events_table_partitioned_modified(since, full_path, until, **kwargs): return _events_table(since, full_path, until, 'main_jobevent', 'modified', project_job_created=True, **kwargs)