1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Update footer UTC time in pooling dashboard refresh (#3457)

This commit is contained in:
Rafael Fidelis 2017-05-04 11:20:05 -03:00 committed by Mike Perham
parent 11598fc2d1
commit 0d314b145c
5 changed files with 16 additions and 3 deletions

View file

@ -234,7 +234,6 @@ module Sidekiq
get '/stats' do
sidekiq_stats = Sidekiq::Stats.new
redis_stats = redis_info.select { |k, v| REDIS_KEYS.include? k }
json(
sidekiq: {
processed: sidekiq_stats.processed,
@ -247,7 +246,8 @@ module Sidekiq
dead: sidekiq_stats.dead_size,
default_latency: sidekiq_stats.default_queue_latency
},
redis: redis_stats
redis: redis_stats,
server_utc_time: server_utc_time
)
end

View file

@ -279,6 +279,10 @@ module Sidekiq
"Sidekiq v#{Sidekiq::VERSION}"
end
def server_utc_time
Time.now.utc.strftime('%H:%M:%S UTC')
end
def redis_connection_and_namespace
@redis_connection_and_namespace ||= begin
namespace_suffix = namespace == nil ? '' : "##{namespace}"

View file

@ -480,6 +480,7 @@ class TestWeb < Sidekiq::Test
it 'works' do
get '/stats'
@response = Sidekiq.load_json(last_response.body)
assert_equal 200, last_response.status
assert_includes @response.keys, "sidekiq"
assert_equal 5, @response["sidekiq"]["processed"]
@ -495,6 +496,7 @@ class TestWeb < Sidekiq::Test
assert_includes @response["redis"].keys, "connected_clients"
assert_includes @response["redis"].keys, "used_memory_human"
assert_includes @response["redis"].keys, "used_memory_peak_human"
assert_includes @response.keys, "server_utc_time"
end
end

View file

@ -111,8 +111,11 @@ var realtimeGraph = function(updatePath) {
updateStatsSummary(data.sidekiq);
updateRedisStats(data.redis);
updateFooterUTCTime(data.server_utc_time)
pulseBeacon();
});
i++;
}, timeInterval);
}
@ -224,6 +227,10 @@ var updateRedisStats = function(data) {
$('.stat h3.used_memory_peak_human').html(data.used_memory_peak_human)
}
var updateFooterUTCTime = function(time) {
$('.navbar-fixed-bottom .navbar-inner .server-utc-time').html(time)
}
var pulseBeacon = function(){
$('.beacon').addClass('pulse').delay(1000).queue(function(){
$(this).removeClass('pulse').dequeue();

View file

@ -9,7 +9,7 @@
<p class="navbar-text redis-url" title="<%= redis_connection_and_namespace %>"><%= redis_connection_and_namespace %></p>
</li>
<li>
<p class="navbar-text"><%= Time.now.utc.strftime('%H:%M:%S UTC') %></p>
<p class="navbar-text server-utc-time"><%= server_utc_time %></p>
</li>
</ul>
</div>