rails / mission_control-jobs

Dashboard and Active Job extensions to operate and troubleshoot background jobs
MIT License
611 stars 71 forks source link

Dashboard Chart with auto update #197

Open MacLove13 opened 2 weeks ago

MacLove13 commented 2 weeks ago

I made some changes to be able to search the database, due to the control of created_at and finished_at.

The Navigation Menu will now update automatically every 5 seconds.

The Dashboard chat will update according to the time chosen in the uptime dropdown menu. By default, it is also 5 seconds.

The graph will also show the last 20 records according to the dropdown, for example, last 20 seconds.

When you enter the screen, the graph will be empty and will be filled as you watch it.

Features:

Preview:

image

https://github.com/user-attachments/assets/8910d54f-3fb7-4644-a30b-9c1984dbf94a

MacLove13 commented 1 week ago

The navigation bar ended up scrolling in some resolutions and depending on the number of records in the queues (which are displayed in the navbar)

I intend to make more visual changes that will probably improve this.

MacLove13 commented 1 week ago

I'm trying to see a way to make it work with resque... I've never worked with resque, I'm not sure how I'm going to do it.

For now I will leave it exclusive to solid_queue

MacLove13 commented 1 week ago

@rosa I removed the WIP, I'm open to suggestions on the code. From the tests I've done, everything seems to be working fine with solid_queue.

rosa commented 1 week ago

Hey @MacLove13, thanks for this! I like the idea but not that it's completely tied to Solid Queue, unlike the other pages in Mission Control. Abstractions like ActiveJob::Queue, ActiveJob::JobsRelation, etc. were created precisely for this, so that they could be used from controllers without having to reach for adapters' internals, and, could work easily with Resque, Solid Queue or other adapters. This introduces functionality that only works with Solid Queue and bypasses all of those abstractions, which right now is a no-go, I'm afraid.

MacLove13 commented 1 week ago

Hey @MacLove13, thanks for this! I like the idea but not that it's completely tied to Solid Queue, unlike the other pages in Mission Control. Abstractions like ActiveJob::Queue, ActiveJob::JobsRelation, etc. were created precisely for this, so that they could be used from controllers without having to reach for adapters' internals, and, could work easily with Resque, Solid Queue or other adapters. This introduces functionality that only works with Solid Queue and bypasses all of those abstractions, which right now is a no-go, I'm afraid.

I tried to do it using abstractions, but I couldn't do a where by dates/time in a way that doesn't impact performance. I'll try a few more things in the next few days to remove the direct use of the database and use abstractions.

Memory usage for filtering jobs becomes a major bottleneck for fast auto update