fluent-plugin-jfrog-send-metrics 0.1.10 → 0.1.10.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c85fc37f7c250b2960214bf2cc9a127b33df5b5e1ccdd607fc6e234546893c47
|
4
|
+
data.tar.gz: d60d4162c6d4f18d4883a9db57bf99f7f54b39ce5ebd2e6194b7b9ae236178e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98dcfb384ba3dbb9e2b29bfb469f5dedacd404a0aab5a16dbc58a003ab5c9b9990ac3e638ad27d530b815065ad4c18945852d70edae70a1a7459919ac1d6a460
|
7
|
+
data.tar.gz: 9b7e008c4c98afe1d38bc1e7b3323fc87f6b2b1ce940709d14d49e6643924c490cbe86e312f0f42f187505494ca1c55b14ea0cd92aec7b95c1fd34cb1733a11e
|
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-send-metrics"
|
6
|
-
spec.version = "0.1.10"
|
6
|
+
spec.version = "0.1.10.1"
|
7
7
|
spec.authors = ["MahithaB", "BenH"]
|
8
8
|
spec.email = ["partner_support@jfrog.com"]
|
9
9
|
|
@@ -28,22 +28,22 @@ class DatadogMetrics
|
|
28
28
|
|
29
29
|
def send_metrics(ddtags, record, http_proxy, verify_ssl, request_timeout, gzip_compression, logger)
|
30
30
|
# Get the current local timestamp
|
31
|
-
logger.info("
|
31
|
+
logger.info("Additional tags to be added to metrics are:", ddtags)
|
32
32
|
metrics_data = add_custom_data(ddtags, record)
|
33
|
-
logger.info("
|
33
|
+
logger.info("Sending received metrics data")
|
34
34
|
|
35
35
|
if http_proxy
|
36
36
|
RestClient.proxy = URI.parse(http_proxy)
|
37
|
-
logger.info("
|
37
|
+
logger.info("Using http_proxy param to set proxy for request. Proxy url: #{RestClient.proxy}")
|
38
38
|
elsif ENV['HTTP_PROXY']
|
39
39
|
RestClient.proxy = ENV['HTTP_PROXY']
|
40
|
-
logger.info("
|
40
|
+
logger.info("Using 'HTTP_PROXY' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
41
41
|
elsif ENV['http_proxy']
|
42
42
|
RestClient.proxy = ENV['http_proxy']
|
43
|
-
logger.info("
|
43
|
+
logger.info("Using 'http_proxy' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
44
44
|
elsif ENV['https_proxy']
|
45
45
|
RestClient.proxy = ENV['https_proxy']
|
46
|
-
logger.info("
|
46
|
+
logger.info("Using 'https_proxy' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
47
47
|
end
|
48
48
|
|
49
49
|
headers = {
|
@@ -53,7 +53,7 @@ class DatadogMetrics
|
|
53
53
|
|
54
54
|
payload = metrics_data.to_json
|
55
55
|
if gzip_compression
|
56
|
-
payload = Utility.compress_payload(metrics_data)
|
56
|
+
payload = Utility.compress_payload(metrics_data, logger)
|
57
57
|
headers[:'Content-Encoding'] = 'gzip'
|
58
58
|
end
|
59
59
|
|
@@ -69,10 +69,10 @@ class DatadogMetrics
|
|
69
69
|
request.execute do |response, request, result|
|
70
70
|
case response.code
|
71
71
|
when 202
|
72
|
-
logger.info("
|
72
|
+
logger.info("Metrics were successfully sent to DataDog")
|
73
73
|
return response.body
|
74
74
|
else
|
75
|
-
logger.info("
|
75
|
+
logger.info("Cannot send metrics to DataDog url: %s. Received response code: %d, Response body: %s" % [@url, response.code, response.body])
|
76
76
|
end
|
77
77
|
end
|
78
78
|
end
|
@@ -11,22 +11,22 @@ class NewRelicMetrics
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def send_metrics(metrics_data, http_proxy, verify_ssl, request_timeout, gzip_compression, logger)
|
14
|
-
logger.info("
|
14
|
+
logger.info("Sending received metrics data")
|
15
15
|
metrics_payload = []
|
16
16
|
metrics_payload.push(JSON.parse(metrics_data.to_json))
|
17
17
|
|
18
18
|
if http_proxy
|
19
19
|
RestClient.proxy = URI.parse(http_proxy)
|
20
|
-
logger.info("
|
20
|
+
logger.info("Using http_proxy param to set proxy for request. Proxy url: #{RestClient.proxy}")
|
21
21
|
elsif ENV['HTTP_PROXY']
|
22
22
|
RestClient.proxy = ENV['HTTP_PROXY']
|
23
|
-
logger.info("
|
23
|
+
logger.info("Using 'HTTP_PROXY' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
24
24
|
elsif ENV['http_proxy']
|
25
25
|
RestClient.proxy = ENV['http_proxy']
|
26
|
-
logger.info("
|
26
|
+
logger.info("Using 'http_proxy' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
27
27
|
elsif ENV['https_proxy']
|
28
28
|
RestClient.proxy = ENV['https_proxy']
|
29
|
-
logger.info("
|
29
|
+
logger.info("Using 'https_proxy' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
30
30
|
end
|
31
31
|
|
32
32
|
headers = {
|
@@ -34,7 +34,7 @@ class NewRelicMetrics
|
|
34
34
|
}
|
35
35
|
payload = metrics_payload.to_json
|
36
36
|
if gzip_compression
|
37
|
-
payload = Utility.compress_payload(metrics_payload)
|
37
|
+
payload = Utility.compress_payload(metrics_payload, logger)
|
38
38
|
headers[:'Content-Encoding'] = 'gzip'
|
39
39
|
end
|
40
40
|
|
@@ -50,10 +50,10 @@ class NewRelicMetrics
|
|
50
50
|
request.execute do |response, request, result|
|
51
51
|
case response.code
|
52
52
|
when 202
|
53
|
-
logger.info("
|
53
|
+
logger.info("Metrics were successfully sent to NewRelic")
|
54
54
|
return response.body
|
55
55
|
else
|
56
|
-
logger.info("
|
56
|
+
logger.info("Cannot send metrics to NewRelic url: %s. Received response code: %d, Response body: %s" % [@url, response.code, response.body])
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'zlib'
|
2
2
|
|
3
3
|
class Utility
|
4
|
-
def self.compress_payload(payload)
|
5
|
-
|
4
|
+
def self.compress_payload(payload, logger)
|
5
|
+
logger.info("Compressing metrics payload")
|
6
6
|
json_payload = payload.to_json
|
7
7
|
|
8
8
|
# Compress the JSON string using zlib's GzipWriter
|
@@ -18,14 +18,9 @@ class Utility
|
|
18
18
|
# convert the compressed data to a string
|
19
19
|
compressed_data = compressed_payload.string
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
logger.info("Original metrics payload size: #{json_payload.bytesize} bytes")
|
22
|
+
logger.info("Compressed metrics payload size: #{compressed_data.bytesize} bytes")
|
23
23
|
|
24
24
|
return compressed_data
|
25
25
|
end
|
26
|
-
|
27
|
-
def self.get_time()
|
28
|
-
return Time.now.strftime("%Y-%m-%d %H:%M:%S")
|
29
|
-
end
|
30
|
-
|
31
26
|
end
|