class JoobQ::Metrics
- JoobQ::Metrics
- Reference
- Object
Defined in:
joobq/metrics.crInstance Method Summary
- #add_job_execution_time(execution_time : Time::Span)
- #add_job_wait_time(wait_time : Time::Span)
-
#average_jobs_in_flight : Float64
Calculate the average number of jobs in flight in the queue This is used to determine the average number of jobs that are being processed concurrently in the queue
- #busy : Atomic(Int64)
- #completed : Atomic(Int64)
- #dead : Atomic(Int64)
- #decrement_busy
-
#elapsed_time : Time::Span
Calculate elapsed time since the start of the queue This is used to calculate rates per second for metrics
-
#error_rate_trend : Float64
Calculate the error rate trend for the queue This is used to determine the trend of errors in the queue over time The error rate trend is calculated as the percentage of retried jobs compared to the total number of attempted jobs
-
#errors_per_second : Float64
Calculate the rate at which jobs are being enqueued per second for the queue This is used to calculate the rate at which the queue is being reduced in size
-
#failed_job_rate : Float64
Calculate the rate of failed jobs in the queue This is used to determine the rate of jobs that have failed to be processed in the queue The failed job rate is calculated as the percentage of dead jobs compared to the total number of processed jobs
- #increment_busy
-
#increment_completed
Provides thread-safe methods to update metrics
- #increment_dead
- #increment_retried
- #job_execution_time : Float64
- #job_wait_time : Float64
-
#jobs_completed_per_second : Float64
Metric calculations
- #last_queue_size : Int64
- #last_queue_size=(last_queue_size : Int64)
- #last_queue_time : Time::Span
- #last_queue_time=(last_queue_time : Time::Span)
-
#queue_reduction_rate(current_queue_size : Int64) : Float64
Calculate the rate at which the queue is being reduced in size per second
- #retried : Atomic(Int64)
- #start_time : Time::Span
- #start_time=(start_time : Time::Span)
- #total_job_execution_time : Time::Span
- #total_job_execution_time=(total_job_execution_time : Time::Span)
- #total_job_wait_time : Time::Span
- #total_job_wait_time=(total_job_wait_time : Time::Span)
-
#worker_utilization(total_workers : Int32) : Float64
Calculate the utilization of workers in the queue based on the total time spent processing jobs TWorker Utilization measures how effectively your workers are being used over time.
Instance Method Detail
Calculate the average number of jobs in flight in the queue This is used to determine the average number of jobs that are being processed concurrently in the queue
Calculate elapsed time since the start of the queue This is used to calculate rates per second for metrics
Calculate the error rate trend for the queue This is used to determine the trend of errors in the queue over time The error rate trend is calculated as the percentage of retried jobs compared to the total number of attempted jobs
Calculate the rate at which jobs are being enqueued per second for the queue This is used to calculate the rate at which the queue is being reduced in size
Calculate the rate of failed jobs in the queue This is used to determine the rate of jobs that have failed to be processed in the queue The failed job rate is calculated as the percentage of dead jobs compared to the total number of processed jobs
Calculate the rate at which the queue is being reduced in size per second
Understanding the queue_reduction_rate Method
Definition: The rate at which the queue size is decreasing over time. Purpose: To measure how quickly jobs are being processed and removed from the queue.
Positive Reduction Rate: Indicates the queue size is decreasing. Negative Reduction Rate: Indicates the queue size is increasing.
Calculate the utilization of workers in the queue based on the total time spent processing jobs TWorker Utilization measures how effectively your workers are being used over time. In your system, it's calculated as
Total Job Execution Time: The cumulative time all workers have spent executing jobs. Total Worker Time: The total time all workers have been available to process jobs
E.g. A worker utilization of 0.14% indicates that your workers are idle 99.86% of the time.
Possible Reasons for Low Worker Utilization