fluent-plugin-jfrog-send-metrics 0.1.5 → 0.1.7

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: 01dd0aba88ecd2c738d0a44cd8692c61544ab76472b7e92ca7d2bded0a8cf683
4
- data.tar.gz: 246352647868467d91d88dbe8cda0ce65ed411757f3d86e2fe1bcc9053391662
3
+ metadata.gz: 156657150eee6dad8aa4df6dd50ac2e3faf3b881b9e2e21d56bb1a976b36ce67
4
+ data.tar.gz: 5d544ba0a9cd7ec28a195486a4b9c33e417b1856507e2623bbed556cf8dca305
5
5
  SHA512:
6
- metadata.gz: 8eab565fd17b0a554e12633860b0d8c87a0efdc61b423c19f8b1df80dd2d343169594f73d790efd247b3d4427ef66af293e57e4bc97b212822b77b9cd50c62b7
7
- data.tar.gz: 23a1a59d51b8bf2752770a25df3b2d4f7cf24000cfdc89a59dac1684398d49405614dc80c448ad97fcf6870c2b51991527f5b6a5779d283b8760de9117ea2243
6
+ metadata.gz: ba4a3cacd19a5e5745b7daf3f6e5d99764295f803bd6535c130e74ef78afd67934c3e40cdabf753532143d6ff595089629254947424838372942f13d08b7563e
7
+ data.tar.gz: 0b95d910ab9bee0581411d0c883ad63d6de201bbd09b45a3703a73b66b0c9806b193dd65951f5708b5b2a71c5c6ccce7f4c4b7a0d2f19a9806ba2af009b86872
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-jfrog-send-metrics (0.1.5)
4
+ fluent-plugin-jfrog-send-metrics (0.1.7)
5
5
  fluentd (>= 0.14.10, < 2)
6
6
  rest-client (~> 2.1.0)
7
7
 
data/README.md CHANGED
@@ -79,6 +79,8 @@ Obtain respective authentication credentials for log-vendors
79
79
  * **apikey**(string)(required): APIKEY is the apikey of log-vendor for authentication(LicenseKey for NewRelic)
80
80
  * **url**(string)(required): Metrics url of the mertics-vendor (Metrics URL for NewRelic or DataDog)
81
81
  * **http_proxy**(string)(optional): Proxy server URL - which will proxy http/s calls to your observability vendor (DataDog/NewRelic)
82
+ * **verify_ssl** (true / false) (optional): This flag should be set as false in order to bypass client's ssl certificate verification. When false, sets ssl_opts['verify_ssl'] to OpenSSL::SSL::VERIFY_NONE. Otherwise, sets ssl_opts['verify_ssl'] to OpenSSL::SSL::VERIFY_PEER
83
+ * Default value: true
82
84
 
83
85
  ## Copyright
84
86
 
@@ -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.5"
6
+ spec.version = "0.1.7"
7
7
  spec.authors = ["MahithaB", "BenH"]
8
8
  spec.email = ["partner_support@jfrog.com"]
9
9
 
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "> 1.14"
24
24
  spec.add_development_dependency "rake", "~> 12.0"
25
25
  spec.add_development_dependency "test-unit", "~> 3.0"
26
- spec.add_development_dependency "rest-client", "~> 2.0"
26
+ spec.add_development_dependency "rest-client", "~> 2.1.0"
27
27
  spec.add_runtime_dependency "fluentd", [">= 0.14.10", "< 2"]
28
28
  spec.add_runtime_dependency "rest-client", "~> 2.1.0"
29
29
  end
@@ -24,8 +24,8 @@ class DatadogMetrics
24
24
  return record
25
25
  end
26
26
 
27
- def send_metrics(ddtags, http_proxy, record)
28
- puts "Additional tags to be added to metrics are", ddtags
27
+ def send_metrics(ddtags, record, http_proxy, verify_ssl)
28
+ puts "Additional tags to be added to metrics are:", ddtags
29
29
  metrics_data = add_custom_data(ddtags, record)
30
30
  puts "Sending received metrics data"
31
31
 
@@ -44,23 +44,24 @@ class DatadogMetrics
44
44
  end
45
45
 
46
46
  begin
47
- response = RestClient::Request.new(
48
- method: :post,
49
- url: @url,
50
- payload: metrics_payload.to_json,
51
- headers: {params: {'Api-Key' => @apikey}}
52
- ).execute do |response, request, result|
47
+ response = RestClient::Request.new(
48
+ method: :post,
49
+ url: @url,
50
+ payload: metrics_data.to_json,
51
+ headers: {'DD-API-KEY': @apikey, content_type: :json },
52
+ verify_ssl: verify_ssl
53
+ ).execute do |response, request, result|
53
54
  case response.code
54
55
  when 202
55
56
  puts 'Metrics were successfully sent to DataDog'
56
57
  return response.body
57
58
  else
58
- puts "Cannot send metrics to DataDog. Received response code: %d" % [response&.code]
59
+ puts "Cannot send metrics to DataDog url: %s. Received response code: %d, Response body: %s" % [@url, response.code, response.body]
59
60
  end
60
61
  end
61
62
  rescue Net::HTTPClientException => e
62
63
  # Handle the HTTP client exception
63
- puts "An HTTP client error occurred when calling DataDog metrics: #{e.message}"
64
+ puts "An HTTP client error occurred when sending metrics to DataDog: #{e.message}"
64
65
  rescue StandardError => e
65
66
  # Handle any other exceptions
66
67
  puts "An error occurred when sending metrics to DataDog: #{e.message}"
@@ -8,7 +8,7 @@ class NewRelicMetrics
8
8
  @url = url
9
9
  end
10
10
 
11
- def send_metrics(metrics_data, http_proxy)
11
+ def send_metrics(metrics_data, http_proxy, verify_ssl)
12
12
  puts "Sending received metrics data"
13
13
  metrics_payload = []
14
14
  metrics_payload.push(JSON.parse(metrics_data.to_json))
@@ -32,14 +32,15 @@ class NewRelicMetrics
32
32
  method: :post,
33
33
  url: @url,
34
34
  payload: metrics_payload.to_json,
35
- headers: {params: {'Api-Key' => @apikey}}
35
+ headers: {params: {'Api-Key' => @apikey}},
36
+ verify_ssl: verify_ssl
36
37
  ).execute do |response, request, result|
37
38
  case response.code
38
39
  when 202
39
40
  puts 'Metrics were successfully sent to NewRelic'
40
41
  return response.body
41
42
  else
42
- puts "Cannot send metrics to NewRelic. Received response code: %d" % [response&.code]
43
+ puts "Cannot send metrics to NewRelic url: %s. Received response code: %d, Response body: %s" % [@url, response.code, response.body]
43
44
  end
44
45
  end
45
46
  rescue Net::HTTPClientException => e
@@ -30,6 +30,7 @@ module Fluent
30
30
  config_param :url, :string, default: 'https://metric-api.newrelic.com/metric/v1'
31
31
  config_param :ddtags, :array, default: []
32
32
  config_param :http_proxy, :string, :default => nil
33
+ config_param :verify_ssl, :bool, default: true
33
34
 
34
35
  # `configure` is called before `start`.
35
36
  # 'conf' is a `Hash` that includes the configuration parameters.
@@ -45,10 +46,10 @@ module Fluent
45
46
  es.each do |time, record|
46
47
  if @target_platform == 'NEWRELIC'
47
48
  vendor = NewRelicMetrics.new(@apikey, @url)
48
- vendor.send_metrics(record, @http_proxy)
49
+ vendor.send_metrics(record, @http_proxy, @verify_ssl)
49
50
  elsif @target_platform == 'DATADOG'
50
51
  vendor = DatadogMetrics.new(@apikey, @url)
51
- vendor.send_metrics(@ddtags, @http_proxy, record)
52
+ vendor.send_metrics(@ddtags, record, @http_proxy, @verify_ssl)
52
53
  end
53
54
  end
54
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-jfrog-send-metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - MahithaB
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-08-16 00:00:00.000000000 Z
12
+ date: 2024-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -59,14 +59,14 @@ dependencies:
59
59
  requirements:
60
60
  - - "~>"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.0'
62
+ version: 2.1.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
- version: '2.0'
69
+ version: 2.1.0
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: fluentd
72
72
  requirement: !ruby/object:Gem::Requirement