stackify-api-ruby 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1f1b93729cecc706d1b21204353788ccad7cce6a4214a62a2a1b846c7bcbd02
4
- data.tar.gz: 8697a19561e8c73493dee6d8295b85959d10012a796dd4fcee00cdd9d35bf7be
3
+ metadata.gz: d6e7d47c5f5d7eba2a6326a4efdc6823d57aec456a946bc3eefd7694a29a8078
4
+ data.tar.gz: d2b022c023a0593391e7e190ca1e5784cdb56c4afacd010fa73d40fa581f9189
5
5
  SHA512:
6
- metadata.gz: e6e1329ed8486fe2e337411152bce6d1acade98c77a230100af90604d931606fe23d898a2684c1815a094e1735904917f2a053997dc0e0aa3e2d26a39d708140
7
- data.tar.gz: 3e754806858b59d863277a411e99e0c78843a2f67f91622e694776941b7b274e986112e858fe294697f69d3bc4b4fa6fded0cd4570dfccb294909f145580c4db
6
+ metadata.gz: 5d3ac89a398d1bf3192c6ed4a4cf8ab27e0523f67839ce17ff3d2fe41243bce977fe4d46a8dd8a23d684603aaf2dc6cc0ede38877ae16456c83b4d2693ce1af6
7
+ data.tar.gz: 61f4ded1b2cef4c418333adcfe893b999b637acc7a055a08b0c3664f95637414b21510718bd9f3a86f9e037f8dec241eeb2fb9c5b8f32afb5a924aaf46dcaac4
@@ -123,7 +123,7 @@ module Stackify
123
123
 
124
124
  def run
125
125
  Stackify::Utils.is_api_enabled
126
- Stackify.internal_log :debug, "Stackify.run = #{Stackify.configuration.transport}"
126
+ Stackify.internal_log :info, "Stackify.run() transportType = #{Stackify.configuration.transport} | API version: #{Stackify::VERSION}"
127
127
  if Stackify.configuration.api_enabled
128
128
  if Stackify.is_valid?
129
129
  # check transport types
@@ -141,7 +141,6 @@ module Stackify
141
141
  when MODES[:metrics]
142
142
  t3 = start_metrics
143
143
  end
144
-
145
144
  t1.join
146
145
  t3.join if t3
147
146
  else
@@ -14,16 +14,20 @@ module Stackify::Authorizable
14
14
  end
15
15
 
16
16
  def auth_task attempts
17
- properties = {
18
- limit: 1,
19
- attempts: attempts,
20
- success_condition: lambda do |result|
21
- result.try(:status) == 200
17
+ begin
18
+ properties = {
19
+ limit: 1,
20
+ attempts: attempts,
21
+ success_condition: lambda do |result|
22
+ result.try(:status) == 200
23
+ end
24
+ }
25
+ Stackify::ScheduleTask.new properties do
26
+ Stackify.internal_log :debug, '[AuthorizationClient] trying to authorize...'
27
+ send_request BASE_URI, Stackify::EnvDetails.instance.auth_info.to_json
22
28
  end
23
- }
24
- Stackify::ScheduleTask.new properties do
25
- Stackify.internal_log :debug, '[AuthorizationClient] trying to authorize...'
26
- send_request BASE_URI, Stackify::EnvDetails.instance.auth_info.to_json
29
+ rescue => exception
30
+ Stackify.log_internal_error "[AuthorizationClient]: An error occured in auth_task!"
27
31
  end
28
32
  end
29
33
  end
@@ -25,6 +25,7 @@ module Stackify
25
25
  req.headers = headers
26
26
  req.body = body
27
27
  end
28
+ return @response
28
29
  rescue => ex
29
30
  @errors << ex
30
31
  Stackify.log_internal_error('HttpClient: ' + ex.message+ ' Backtrace: '+ Stackify::Backtrace.backtrace_in_line(ex.backtrace))
@@ -2,9 +2,14 @@ module Stackify
2
2
  class LoggerClient
3
3
 
4
4
  def initialize
5
- @@errors_governor = Stackify::ErrorsGovernor.new
6
- @@transport = Stackify::TransportSelector.new(Stackify.configuration.transport).transport
7
- return if @@transport.nil?
5
+ begin
6
+ @@errors_governor = Stackify::ErrorsGovernor.new
7
+ @@transport = Stackify::TransportSelector.new(Stackify.configuration.transport).transport
8
+ Stackify.internal_log :info, "[LoggerClient] initialize: #{@@transport}"
9
+ return if @@transport.nil?
10
+ rescue => ex
11
+ Stackify.log_internal_error "[LoggerClient] initialize exception = #{ex.inspect}"
12
+ end
8
13
  end
9
14
 
10
15
  def log level, msg, call_trace
@@ -20,6 +25,7 @@ module Stackify
20
25
  end
21
26
 
22
27
  def get_transport
28
+ return if @@transport.nil?
23
29
  @@transport
24
30
  end
25
31
 
@@ -6,9 +6,7 @@ module Stackify
6
6
  def initialize type
7
7
  case type
8
8
  when Stackify::DEFAULT
9
- Stackify::Utils.do_only_if_authorized_and_mode_is_on Stackify::MODES[:logging] do
10
- @transport = Stackify::LogsSender.new
11
- end
9
+ @transport = Stackify::LogsSender.new
12
10
  when Stackify::UNIX_SOCKET, Stackify::AGENT_HTTP
13
11
  @transport = Stackify::AgentClient.new
14
12
  end
@@ -14,16 +14,20 @@ module Stackify::Utils
14
14
  end
15
15
 
16
16
  def self.do_only_if_authorized_and_mode_is_on mode, &block
17
- if Stackify.configuration.api_enabled
18
- if Stackify.authorized?
19
- if is_mode_on? mode
20
- yield
17
+ begin
18
+ if Stackify.configuration.api_enabled
19
+ if Stackify.authorized?
20
+ if is_mode_on? mode
21
+ yield
22
+ else
23
+ Stackify.internal_log :warn, "[Stackify::Utils] - #{caller[0]}: Skipped because mode - #{mode.to_s} is disabled at configuration"
24
+ end
21
25
  else
22
- Stackify.internal_log :warn, "#{caller[0]}: Skipped because mode - #{mode.to_s} is disabled at configuration"
26
+ Stackify.internal_log :warn, "[Stackify::Utils] - #{caller[0]}: Skipped due to authorization failure"
23
27
  end
24
- else
25
- Stackify.internal_log :warn, "#{caller[0]}: Skipped due to authorization failure"
26
28
  end
29
+ rescue => ex
30
+ Stackify.internal_log :warn, "[Stackify::Utils] do_only_if_authorized_and_mode_is_on ex: #{ex.inspect}"
27
31
  end
28
32
  end
29
33
 
@@ -1,3 +1,3 @@
1
1
  module Stackify
2
- VERSION = '1.2.3'
2
+ VERSION = '1.2.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stackify-api-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.3
4
+ version: 1.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stackify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-10 00:00:00.000000000 Z
11
+ date: 2020-03-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler