Class: Tasker::Functions::FunctionBasedSlowestSteps
- Inherits:
-
FunctionWrapper
- Object
- FunctionWrapper
- Tasker::Functions::FunctionBasedSlowestSteps
- Defined in:
- lib/tasker/functions/function_based_slowest_steps.rb
Overview
Wrapper for the get_slowest_steps_v01 SQL function
This function returns the slowest workflow steps within a specified time period with duration metrics and optional filtering by namespace, task name, and version.
Defined Under Namespace
Classes: SlowestStep
Class Method Summary collapse
-
.call(since_timestamp: nil, limit_count: 10, namespace_filter: nil, task_name_filter: nil, version_filter: nil) ⇒ Array<SlowestStep>
Call the get_slowest_steps_v01 SQL function.
Methods inherited from FunctionWrapper
connection, convert_array_bind, from_sql_function, #readonly?, single_from_sql_function
Class Method Details
.call(since_timestamp: nil, limit_count: 10, namespace_filter: nil, task_name_filter: nil, version_filter: nil) ⇒ Array<SlowestStep>
Call the get_slowest_steps_v01 SQL function
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/tasker/functions/function_based_slowest_steps.rb', line 51 def self.call(since_timestamp: nil, limit_count: 10, namespace_filter: nil, task_name_filter: nil, version_filter: nil) # Build SQL with proper parameter binding sql = 'SELECT * FROM get_slowest_steps_v01($1, $2, $3, $4, $5)' binds = [ , limit_count, namespace_filter, task_name_filter, version_filter ] result = connection.select_all(sql, 'SlowestSteps Load', binds) result.map do |row| SlowestStep.new( workflow_step_id: row['workflow_step_id'].to_i, task_id: row['task_id'].to_i, step_name: row['step_name'].to_s, task_name: row['task_name'].to_s, namespace_name: row['namespace_name'].to_s, version: row['version'].to_s, duration_seconds: row['duration_seconds'].to_f, attempts: row['attempts'].to_i, created_at: Time.zone.parse(row['created_at'].to_s), completed_at: Time.zone.parse(row['completed_at'].to_s), retryable: ['t', true].include?(row['retryable']), step_status: row['step_status'].to_s ) end end |