Skip to content

Commit

Permalink
[foreman] Change scope of tasks history
Browse files Browse the repository at this point in the history
Collect up to 14 days of dynflow data instead of one month.

Also, change granularity of the plugin option from months to days - we
are almost never interested in tasks older than one month.

Resolves: #3637

Signed-off-by: Pavel Moravec <[email protected]>
  • Loading branch information
pmoravec committed Dec 4, 2023
1 parent d53bffe commit 6fe2009
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions sos/report/plugins/foreman.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class Foreman(Plugin):
profiles = ('sysmgmt',)
packages = ('foreman',)
option_list = [
PluginOpt('months', default=1,
desc='number of months for dynflow output'),
PluginOpt('days', default=14,
desc='number of days for dynflow output'),
PluginOpt('proxyfeatures', default=False,
desc='collect features of smart proxies'),
PluginOpt('puma-gc', default=False,
Expand Down Expand Up @@ -179,9 +179,9 @@ def setup(self):
self.add_cmd_output(_cmd, suggest_filename='foreman_db_tables_sizes',
env=self.env)

months = '%s months' % self.get_option('months')
days = '%s days' % self.get_option('days')

# Construct the DB queries, using the months option to limit the range
# Construct the DB queries, using the days option to limit the range
# of entries returned

scmd = (
Expand All @@ -198,23 +198,23 @@ def setup(self):
'select dynflow_execution_plans.* from foreman_tasks_tasks join '
'dynflow_execution_plans on (foreman_tasks_tasks.external_id = '
'dynflow_execution_plans.uuid::varchar) where foreman_tasks_tasks.'
'started_at > NOW() - interval %s' % quote(months)
'started_at > NOW() - interval %s' % quote(days)
)

dactioncmd = (
'select dynflow_actions.* from foreman_tasks_tasks join '
'dynflow_actions on (foreman_tasks_tasks.external_id = '
'dynflow_actions.execution_plan_uuid::varchar) where '
'foreman_tasks_tasks.started_at > NOW() - interval %s'
% quote(months)
% quote(days)
)

dstepscmd = (
'select dynflow_steps.* from foreman_tasks_tasks join '
'dynflow_steps on (foreman_tasks_tasks.external_id = '
'dynflow_steps.execution_plan_uuid::varchar) where '
'foreman_tasks_tasks.started_at > NOW() - interval %s'
% quote(months)
% quote(days)
)

# counts of fact_names prefixes/types: much of one type suggests
Expand Down

0 comments on commit 6fe2009

Please sign in to comment.