stackify-api-ruby 1.2.3 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/stackify-api-ruby.rb +1 -2
- data/lib/stackify/authorization/authorization_client.rb +13 -9
- data/lib/stackify/http_client.rb +1 -0
- data/lib/stackify/logger_client.rb +9 -3
- data/lib/stackify/transport_selector.rb +1 -3
- data/lib/stackify/utils/methods.rb +11 -7
- data/lib/stackify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d6e7d47c5f5d7eba2a6326a4efdc6823d57aec456a946bc3eefd7694a29a8078
|
4
|
+
data.tar.gz: d2b022c023a0593391e7e190ca1e5784cdb56c4afacd010fa73d40fa581f9189
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5d3ac89a398d1bf3192c6ed4a4cf8ab27e0523f67839ce17ff3d2fe41243bce977fe4d46a8dd8a23d684603aaf2dc6cc0ede38877ae16456c83b4d2693ce1af6
|
7
|
+
data.tar.gz: 61f4ded1b2cef4c418333adcfe893b999b637acc7a055a08b0c3664f95637414b21510718bd9f3a86f9e037f8dec241eeb2fb9c5b8f32afb5a924aaf46dcaac4
|
data/lib/stackify-api-ruby.rb
CHANGED
@@ -123,7 +123,7 @@ module Stackify
|
|
123
123
|
|
124
124
|
def run
|
125
125
|
Stackify::Utils.is_api_enabled
|
126
|
-
Stackify.internal_log :
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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
|
data/lib/stackify/http_client.rb
CHANGED
@@ -2,9 +2,14 @@ module Stackify
|
|
2
2
|
class LoggerClient
|
3
3
|
|
4
4
|
def initialize
|
5
|
-
|
6
|
-
|
7
|
-
|
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::
|
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
|
-
|
18
|
-
if Stackify.
|
19
|
-
if
|
20
|
-
|
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
|
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
|
|
data/lib/stackify/version.rb
CHANGED
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.
|
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:
|
11
|
+
date: 2020-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|