Skip to content

Commit

Permalink
Add async.task.finished metric.
Browse files Browse the repository at this point in the history
  • Loading branch information
ioquatix committed Feb 7, 2025
1 parent 542c739 commit b324230
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/metrics/provider/async/task.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@

Metrics::Provider(Async::Task) do
ASYNC_TASK_SCHEDULED = Metrics.metric("async.task.scheduled", :counter, description: "The number of tasks scheduled.")
ASYNC_TASK_FINISHED = Metrics.metric("async.task.finished", :counter, description: "The number of tasks finished.")

def schedule(&block)
ASYNC_TASK_SCHEDULED.emit(1)

super(&block)
rescue => error
raise
ensure
ASYNC_TASK_FINISHED.emit(1)
end
end

0 comments on commit b324230

Please sign in to comment.