40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# File 'lib/logstash/outputs/application_insights/shutdown.rb', line 40
def submit
display_msg( "start graceful shutdown, flush all events" )
start_bytes_in_memory = @state.bytes_in_memory
bytes_in_memory = start_bytes_in_memory
while bytes_in_memory > 0 do
sleep( 1 )
bytes_in_memory = @state.bytes_in_memory
percent = 100 * (1 - ( bytes_in_memory.to_f / start_bytes_in_memory ) )
display_msg( "#{percent.to_i}% events were uploaded to Azure storage" ) if percent < 100.0
end
display_msg( "all events were uploaded to Azure storage" )
Blob.close
@channels.close
start_pending_commits = @state.pending_commits
pending_commits = start_pending_commits
while pending_commits > 0 do
sleep( 1 )
pending_commits = @state.pending_commits
percent = 100 * (1 - ( pending_commits.to_f / start_pending_commits ) )
display_msg( "#{percent.to_i}% events were commited to Azure storage" ) if percent < 100.0
end
display_msg( "all events were commited to Azure storage" )
start_pending_notifications = @state.pending_notifications
pending_notifications = start_pending_notifications
while pending_notifications > 0 do
sleep( 1 )
pending_notifications = @state.pending_notifications
percent = 100 * (1 - ( pending_notifications.to_f / start_pending_notifications ) )
display_msg( "#{percent.to_i}% events were notified to Application Insights Analytics" ) if percent < 100.0
end
display_msg( "all events were notified to Application Insights Analytics" )
end
|