Skip to content

Commit

Permalink
Remove unused rake metrics
Browse files Browse the repository at this point in the history
  • Loading branch information
ngetahun committed Nov 5, 2024
1 parent c9b6ed7 commit f92b65c
Showing 1 changed file with 1 addition and 36 deletions.
37 changes: 1 addition & 36 deletions config/initializers/yabeda.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,12 @@
}

group :rails, &assign_labels
group :rake, &assign_labels

group :rails do
counter :started_requests_total,
comment: 'A counter of the total number of HTTP requests rails has started to process.',
tags: %i[controller action format method]
end

group :rake do
gauge :task_started_at,
comment: 'Time when the task started: unix time with decimals',
tags: %i[task_name]

gauge :task_exit_status,
comment: 'Task exit status. 1 means OK, 0 means failed, not present means no data',
tags: %i[task_name]

gauge :task_duration_ms,
comment: 'Time taken running the task',
tags: %i[task_name]

gauge :task_finished_at,
comment: 'Time when the task finished: unix time with decimals',
tags: %i[task_name]
end
end

# Instrument the request from the start
Expand All @@ -52,20 +33,4 @@

metric.increment(labels, by: 1)
end
end

ActiveSupport::Notifications.subscribe 'task_run.rake' do |*args|
event = ActiveSupport::Notifications::Event.new(*args)
task_name = event.payload[:task_name]

success = 1
if !!(event.payload[:exception] || event.payload[:exception_class])
success = 0
end

Yabeda.rake.task_duration_ms.set({ task_name: task_name }, event.duration)
Yabeda.rake.task_started_at.set({ task_name: task_name }, event.time / 1000.0)
Yabeda.rake.task_finished_at.set({ task_name: task_name }, event.end / 1000.0)

Yabeda.rake.task_exit_status.set({ task_name: task_name }, success)
end
end

0 comments on commit f92b65c

Please sign in to comment.