fluent-plugin-jfrog-metrics 0.2.12.2 → 0.2.12.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/fluent-plugin-jfrog-metrics.gemspec +1 -1
- data/lib/fluent/plugin/in_jfrog_metrics.rb +4 -0
- data/lib/fluent/plugin/metrics_helper.rb +6 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b4d1c7705dae2a6fb816d3aef9e5372648b533a809b9a967bf1f94c024b20e8
|
4
|
+
data.tar.gz: 6a84d71c12bd89350b51608c738aa30d9f9e86e430213d8f8486ba51c9f12a63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f4ddb5c65a5760460f48ca17e32fe6ae07a8190ea5020bd5e82ba408902d21d1e0d46728ebdadbe2f26140ab36309e20e6d06f2c47c7b174bd0a105e20ceaa36
|
7
|
+
data.tar.gz: 3ca8608a7f5e675b435cf650998e6907f733ce77b14154a9ac5cc1764a316a22ff0ed6ec52a6ceb5951e362467bc4f004d45b0dd851730d0af2c3b04c5b1fa9a
|
data/Gemfile.lock
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |spec|
|
5
5
|
spec.name = 'fluent-plugin-jfrog-metrics'
|
6
|
-
spec.version = '0.2.12.
|
6
|
+
spec.version = '0.2.12.3'
|
7
7
|
spec.authors = ['MahithaB, BenHarosh']
|
8
8
|
spec.email = ['cpe-support@jfrog.com']
|
9
9
|
|
@@ -108,6 +108,10 @@ module Fluent
|
|
108
108
|
metrics_helper = MetricsHelper.new($logger, @metric_prefix, @jpd_url, @username, @apikey, @token, @common_jpd, @verify_ssl, @request_timeout)
|
109
109
|
platform_metrics = metrics_helper.get_metrics
|
110
110
|
|
111
|
+
if platform_metrics.nil?
|
112
|
+
raise "Error while fetching platform metrics. Metrics response was null"
|
113
|
+
end
|
114
|
+
|
111
115
|
additional_metrics = metrics_helper.get_additional_metrics
|
112
116
|
if !additional_metrics.nil? && additional_metrics != ''
|
113
117
|
platform_metrics += additional_metrics.to_s
|
@@ -30,12 +30,14 @@ class MetricsHelper
|
|
30
30
|
end
|
31
31
|
|
32
32
|
@logger.info("Executing #{@metric_prefix} metrics collection from: #{url}")
|
33
|
+
metrics = nil
|
33
34
|
if !@token.nil? && @token != ''
|
34
|
-
execute_rest_call(url, @username, nil, @token, true, @verify_ssl, @request_timeout)
|
35
|
+
metrics = execute_rest_call(url, @username, nil, @token, true, @verify_ssl, @request_timeout)
|
35
36
|
elsif !@apikey.nil? && @apikey != ''
|
36
|
-
execute_rest_call(url, @username, @apikey, nil, false, @verify_ssl, @request_timeout)
|
37
|
+
metrics = execute_rest_call(url, @username, @apikey, nil, false, @verify_ssl, @request_timeout)
|
37
38
|
end
|
38
39
|
@logger.debug("Get metrics finished")
|
40
|
+
return metrics
|
39
41
|
end
|
40
42
|
|
41
43
|
def get_additional_metrics
|
@@ -44,9 +46,10 @@ class MetricsHelper
|
|
44
46
|
url = "#{@jpd_url}/observability/api/v1/metrics"
|
45
47
|
@logger.info("Collecting additional metrics from: #{url}")
|
46
48
|
check_endpoint(url, @token, @verify_ssl, @request_timeout) if @@obs_endpoint_exists == nil? || !@@obs_endpoint_exists
|
47
|
-
execute_rest_call(url, @username, nil, @token, true, @verify_ssl, @request_timeout) if @@obs_endpoint_exists
|
49
|
+
additional_metrics = execute_rest_call(url, @username, nil, @token, true, @verify_ssl, @request_timeout) if @@obs_endpoint_exists
|
48
50
|
end
|
49
51
|
@logger.info("Aadditional metrics collection finished")
|
52
|
+
return additional_metrics
|
50
53
|
end
|
51
54
|
|
52
55
|
def check_endpoint(url, token, verify_ssl, request_timeout)
|