fluent-plugin-jfrog-send-metrics 0.1.1 → 0.1.3

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: a56117dfff21ca91b3fcf264950eb09e536be556babdaef14e65a93a5724af47
4
- data.tar.gz: 95bade9bcecc87b22b30ffebd1e6cfc3ed85f37f860d1c7d4a315cb47ed4a1b6
3
+ metadata.gz: 10a4ee75d92bb898f8398e2e8c83e30682c350bb94772d2e8a73606a48b28deb
4
+ data.tar.gz: 2a4261471690052c20d9c95acdb0c9f5bc61747b4850eba3d6e69487cb667844
5
5
  SHA512:
6
- metadata.gz: 185f8ef68b84e2a40157af27c8d045048d44cf224847a3a86bfcf3d03a037d938ad966a62ee3ffd582d4600861f277115fa47de5c018d04f4f0e094b4c71f340
7
- data.tar.gz: 298ed720dc151c04ac1cddc93f54177a8fa44a266c83192e1d1f8681f6a5fb363ab6d282614c9ed666786b590dfab4bcbde3d4fa216f4a0b766ef03a968f7b12
6
+ metadata.gz: a3d2b6f84468d2047bbe9b51c3dfafba49a32d88b6b5906713a84892f849ee565295a3d4eb718c991757d24256f4f5a4e430abe3c8a068553d4ec76b287c48d6
7
+ data.tar.gz: b68ea4050bc6613f3ee28406802359f4da2294a00b06981af21a39e67ddc409a9832be1f8184cf4bd0b3130c83ad6742708bdccd22159eb114de9b56d06b5b4e
data/Gemfile CHANGED
@@ -1,5 +1,11 @@
1
- source "https://rubygems.org"
1
+ # frozen_string_literal: true
2
2
 
3
- gem "fluent-plugin-jfrog-send-metrics"
3
+ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
+
7
+ group :test do
8
+ gem 'minitest'
9
+ gem 'minitest-reporters', '>= 0.5.0'
10
+ gem 'rest-client', '>= 2.1.0'
11
+ end
data/Gemfile.lock CHANGED
@@ -1,28 +1,30 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- fluent-plugin-jfrog-send-metrics (0.1.0)
4
+ fluent-plugin-jfrog-send-metrics (0.1.3)
5
5
  fluentd (>= 0.14.10, < 2)
6
6
  rest-client (~> 2.0)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- concurrent-ruby (1.1.9)
11
+ ansi (1.5.0)
12
+ builder (3.2.4)
13
+ concurrent-ruby (1.2.2)
12
14
  cool.io (1.7.1)
13
15
  domain_name (0.5.20190701)
14
16
  unf (>= 0.0.5, < 1.0.0)
15
- fluentd (1.14.5)
17
+ fluentd (1.16.1)
16
18
  bundler
17
19
  cool.io (>= 1.4.5, < 2.0.0)
18
20
  http_parser.rb (>= 0.5.1, < 0.9.0)
19
21
  msgpack (>= 1.3.1, < 2.0.0)
20
- serverengine (>= 2.2.5, < 3.0.0)
22
+ serverengine (>= 2.3.2, < 3.0.0)
21
23
  sigdump (~> 0.2.2)
22
24
  strptime (>= 0.2.4, < 1.0.0)
23
25
  tzinfo (>= 1.0, < 3.0)
24
26
  tzinfo-data (~> 1.0)
25
- webrick (>= 1.4.2, < 1.8.0)
27
+ webrick (~> 1.4)
26
28
  yajl-ruby (~> 1.0)
27
29
  http-accept (1.7.0)
28
30
  http-cookie (1.0.4)
@@ -31,7 +33,13 @@ GEM
31
33
  mime-types (3.4.1)
32
34
  mime-types-data (~> 3.2015)
33
35
  mime-types-data (3.2022.0105)
34
- msgpack (1.4.5)
36
+ minitest (5.14.4)
37
+ minitest-reporters (1.4.3)
38
+ ansi
39
+ builder
40
+ minitest (>= 5.0)
41
+ ruby-progressbar
42
+ msgpack (1.7.1)
35
43
  netrc (0.11.0)
36
44
  power_assert (2.0.1)
37
45
  rake (12.3.3)
@@ -40,30 +48,34 @@ GEM
40
48
  http-cookie (>= 1.0.2, < 2.0)
41
49
  mime-types (>= 1.16, < 4.0)
42
50
  netrc (~> 0.8)
43
- serverengine (2.2.5)
51
+ ruby-progressbar (1.11.0)
52
+ serverengine (2.3.2)
44
53
  sigdump (~> 0.2.2)
45
54
  sigdump (0.2.4)
46
55
  strptime (0.2.5)
47
56
  test-unit (3.5.3)
48
57
  power_assert
49
- tzinfo (2.0.4)
58
+ tzinfo (2.0.6)
50
59
  concurrent-ruby (~> 1.0)
51
- tzinfo-data (1.2021.5)
60
+ tzinfo-data (1.2023.3)
52
61
  tzinfo (>= 1.0.0)
53
62
  unf (0.1.4)
54
63
  unf_ext
55
64
  unf_ext (0.0.8)
56
- webrick (1.7.0)
57
- yajl-ruby (1.4.1)
65
+ webrick (1.8.1)
66
+ yajl-ruby (1.4.3)
58
67
 
59
68
  PLATFORMS
69
+ ruby
60
70
  universal-darwin-21
61
71
 
62
72
  DEPENDENCIES
63
73
  bundler (> 1.14)
64
74
  fluent-plugin-jfrog-send-metrics!
75
+ minitest
76
+ minitest-reporters (>= 0.5.0)
65
77
  rake (~> 12.0)
66
- rest-client (~> 2.0)
78
+ rest-client (>= 2.1.0)
67
79
  test-unit (~> 3.0)
68
80
 
69
81
  BUNDLED WITH
@@ -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.1"
6
+ spec.version = "0.1.3"
7
7
  spec.authors = ["MahithaB"]
8
8
  spec.email = ["60710901+MahithaB@users.noreply.github.com"]
9
9
 
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+ require 'json'
3
+ require 'rest-client'
4
+
5
+ class DatadogMetrics
6
+ def initialize(apikey, url)
7
+ @apikey = apikey
8
+ @url = url
9
+ end
10
+
11
+ def send_metrics(metrics_data)
12
+ puts "Sending received metrics data"
13
+ response = RestClient::Request.new(
14
+ method: :post,
15
+ url: @url,
16
+ payload: metrics_data.to_json,
17
+ headers: {'DD-API-KEY': @apikey, content_type: :json }
18
+ ).execute do |response, request, result|
19
+ case response.code
20
+ when 202
21
+ return response.body
22
+ else
23
+ puts 'Cannot send metrics to Datadog', response.body
24
+ end
25
+ end
26
+ end
27
+ end
28
+
@@ -9,6 +9,7 @@ class NewRelicMetrics
9
9
  end
10
10
 
11
11
  def send_metrics(metrics_data)
12
+ puts "Sending received metrics data"
12
13
  metrics_payload = []
13
14
  metrics_payload.push(JSON.parse(metrics_data.to_json))
14
15
  response = RestClient::Request.new(
@@ -15,6 +15,7 @@
15
15
 
16
16
  require "fluent/plugin/output"
17
17
  require_relative 'newrelic_metrics_sender'
18
+ require_relative 'datadog_metrics_sender'
18
19
 
19
20
  module Fluent
20
21
  module Plugin
@@ -44,6 +45,9 @@ module Fluent
44
45
  if @target_platform == 'NEWRELIC'
45
46
  vendor = NewRelicMetrics.new(@apikey, @url)
46
47
  vendor.send_metrics(record)
48
+ elsif @target_platform == 'DATADOG'
49
+ vendor = DatadogMetrics.new(@apikey, @url)
50
+ vendor.send_metrics(record)
47
51
  end
48
52
  end
49
53
  end
metadata CHANGED
@@ -1,14 +1,14 @@
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.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - MahithaB
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-12 00:00:00.000000000 Z
11
+ date: 2023-06-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,6 +114,7 @@ files:
114
114
  - README.md
115
115
  - Rakefile
116
116
  - fluent-plugin-jfrog-send-metrics.gemspec
117
+ - lib/fluent/plugin/datadog_metrics_sender.rb
117
118
  - lib/fluent/plugin/newrelic_metrics_sender.rb
118
119
  - lib/fluent/plugin/out_jfrog_send_metrics.rb
119
120
  - spec/fixtures/files/creds.rb
@@ -127,7 +128,7 @@ homepage: https://github.com/jfrog/jfrog-fluentd-plugins/tree/main/fluent-plugin
127
128
  licenses:
128
129
  - Apache-2.0
129
130
  metadata: {}
130
- post_install_message:
131
+ post_install_message:
131
132
  rdoc_options: []
132
133
  require_paths:
133
134
  - lib
@@ -142,8 +143,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
143
  - !ruby/object:Gem::Version
143
144
  version: '0'
144
145
  requirements: []
145
- rubygems_version: 3.0.3.1
146
- signing_key:
146
+ rubygems_version: 3.1.6
147
+ signing_key:
147
148
  specification_version: 4
148
149
  summary: Fluentd Plugin for sending metrics to the respective log-vendor
149
150
  test_files: