fluent-plugin-jfrog-send-metrics 0.1.0 → 0.1.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: dd62b6f383bac20cabda8fae79fce79add0502c8a5d5a0fcd2b7030ca5c20565
4
- data.tar.gz: e48147f7ea482b85fbb40dfed81b9c3b11b5f142d5b47733689cc41c26544094
3
+ metadata.gz: a56117dfff21ca91b3fcf264950eb09e536be556babdaef14e65a93a5724af47
4
+ data.tar.gz: 95bade9bcecc87b22b30ffebd1e6cfc3ed85f37f860d1c7d4a315cb47ed4a1b6
5
5
  SHA512:
6
- metadata.gz: 6f44b9765d16eb082126f928bc2ce80f10b851c1901cc2554ab5d0253c6648a8a6916beb22a41270397c39f5c1af82c019d7682a7a5e98859f3af22962c60774
7
- data.tar.gz: 1e5ab4e3b8c7d19fc14b249a668346adf28bcad16c5ddc2eadbae420eec0db1da59023464ef26d0ec5cc29853fc560781ec6cffab5d88f9167589f9560684cfa
6
+ metadata.gz: 185f8ef68b84e2a40157af27c8d045048d44cf224847a3a86bfcf3d03a037d938ad966a62ee3ffd582d4600861f277115fa47de5c018d04f4f0e094b4c71f340
7
+ data.tar.gz: 298ed720dc151c04ac1cddc93f54177a8fa44a266c83192e1d1f8681f6a5fb363ab6d282614c9ed666786b590dfab4bcbde3d4fa216f4a0b766ef03a968f7b12
data/Gemfile.lock ADDED
@@ -0,0 +1,70 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ fluent-plugin-jfrog-send-metrics (0.1.0)
5
+ fluentd (>= 0.14.10, < 2)
6
+ rest-client (~> 2.0)
7
+
8
+ GEM
9
+ remote: https://rubygems.org/
10
+ specs:
11
+ concurrent-ruby (1.1.9)
12
+ cool.io (1.7.1)
13
+ domain_name (0.5.20190701)
14
+ unf (>= 0.0.5, < 1.0.0)
15
+ fluentd (1.14.5)
16
+ bundler
17
+ cool.io (>= 1.4.5, < 2.0.0)
18
+ http_parser.rb (>= 0.5.1, < 0.9.0)
19
+ msgpack (>= 1.3.1, < 2.0.0)
20
+ serverengine (>= 2.2.5, < 3.0.0)
21
+ sigdump (~> 0.2.2)
22
+ strptime (>= 0.2.4, < 1.0.0)
23
+ tzinfo (>= 1.0, < 3.0)
24
+ tzinfo-data (~> 1.0)
25
+ webrick (>= 1.4.2, < 1.8.0)
26
+ yajl-ruby (~> 1.0)
27
+ http-accept (1.7.0)
28
+ http-cookie (1.0.4)
29
+ domain_name (~> 0.5)
30
+ http_parser.rb (0.8.0)
31
+ mime-types (3.4.1)
32
+ mime-types-data (~> 3.2015)
33
+ mime-types-data (3.2022.0105)
34
+ msgpack (1.4.5)
35
+ netrc (0.11.0)
36
+ power_assert (2.0.1)
37
+ rake (12.3.3)
38
+ rest-client (2.1.0)
39
+ http-accept (>= 1.7.0, < 2.0)
40
+ http-cookie (>= 1.0.2, < 2.0)
41
+ mime-types (>= 1.16, < 4.0)
42
+ netrc (~> 0.8)
43
+ serverengine (2.2.5)
44
+ sigdump (~> 0.2.2)
45
+ sigdump (0.2.4)
46
+ strptime (0.2.5)
47
+ test-unit (3.5.3)
48
+ power_assert
49
+ tzinfo (2.0.4)
50
+ concurrent-ruby (~> 1.0)
51
+ tzinfo-data (1.2021.5)
52
+ tzinfo (>= 1.0.0)
53
+ unf (0.1.4)
54
+ unf_ext
55
+ unf_ext (0.0.8)
56
+ webrick (1.7.0)
57
+ yajl-ruby (1.4.1)
58
+
59
+ PLATFORMS
60
+ universal-darwin-21
61
+
62
+ DEPENDENCIES
63
+ bundler (> 1.14)
64
+ fluent-plugin-jfrog-send-metrics!
65
+ rake (~> 12.0)
66
+ rest-client (~> 2.0)
67
+ test-unit (~> 3.0)
68
+
69
+ BUNDLED WITH
70
+ 2.3.8
@@ -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.0"
6
+ spec.version = "0.1.1"
7
7
  spec.authors = ["MahithaB"]
8
8
  spec.email = ["60710901+MahithaB@users.noreply.github.com"]
9
9
 
@@ -1,9 +1,11 @@
1
1
  # frozen_string_literal: true
2
2
  require 'json'
3
+ require 'rest-client'
3
4
 
4
5
  class NewRelicMetrics
5
- def initialize(apikey)
6
+ def initialize(apikey, url)
6
7
  @apikey = apikey
8
+ @url = url
7
9
  end
8
10
 
9
11
  def send_metrics(metrics_data)
@@ -11,7 +13,7 @@ class NewRelicMetrics
11
13
  metrics_payload.push(JSON.parse(metrics_data.to_json))
12
14
  response = RestClient::Request.new(
13
15
  method: :post,
14
- url: "https://metric-api.newrelic.com/metric/v1",
16
+ url: @url,
15
17
  payload: metrics_payload.to_json,
16
18
  headers: {params: {'Api-Key' => @apikey}}
17
19
  ).execute do |response, request, result|
@@ -26,6 +26,7 @@ module Fluent
26
26
  # `:default` means that the parameter is optional.
27
27
  config_param :target_platform, :string, default: ''
28
28
  config_param :apikey, :string, default: ''
29
+ config_param :url, :string, default: 'https://metric-api.newrelic.com/metric/v1'
29
30
 
30
31
  # `configure` is called before `start`.
31
32
  # 'conf' is a `Hash` that includes the configuration parameters.
@@ -41,7 +42,7 @@ module Fluent
41
42
  def process(tag, es)
42
43
  es.each do |time, record|
43
44
  if @target_platform == 'NEWRELIC'
44
- vendor = NewRelicMetrics.new(@apikey)
45
+ vendor = NewRelicMetrics.new(@apikey, @url)
45
46
  vendor.send_metrics(record)
46
47
  end
47
48
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  $newrelic_apikey = ''
3
+ $url = 'https://metric-api.newrelic.com/metric/v1'
3
4
 
4
5
  def get_newrelic_credentials
5
- $newrelic_apikey;;
6
+ [$newrelic_apikey, $url]
6
7
  end
@@ -15,16 +15,15 @@ require './spec/fixtures/files/creds'
15
15
 
16
16
 
17
17
  RSpec.describe NewRelicMetrics do
18
- newrelic_apikey = get_newrelic_credentials
18
+ newrelic_apikey, url = get_newrelic_credentials
19
19
  describe "#emit_parsed_metrics" do
20
20
  it 'should read sample Artifactory metrics data and verify the size of parsed data > 1' do
21
21
  platform_metrics = File.read('./spec/fixtures/files/sample_artifactory_newrelic_metrics.txt')
22
- puts platform_metrics.class
23
22
  expect(platform_metrics.size).to be > 1
24
23
 
25
24
  response = RestClient::Request.new(
26
25
  method: :post,
27
- url: "https://metric-api.newrelic.com/metric/v1",
26
+ url: url,
28
27
  payload: platform_metrics,
29
28
  headers: {params: {'Api-Key' => newrelic_apikey, "Content-Type" => "application/json"}}
30
29
  ).execute do |response, request, result|
@@ -40,7 +39,7 @@ RSpec.describe NewRelicMetrics do
40
39
 
41
40
  response = RestClient::Request.new(
42
41
  method: :post,
43
- url: "https://metric-api.newrelic.com/metric/v1",
42
+ url: url,
44
43
  payload: platform_metrics,
45
44
  headers: {params: {'Api-Key' => newrelic_apikey, "Content-Type" => "application/json"}}
46
45
  ).execute do |response, request, result|
@@ -16,6 +16,7 @@ class JfrogSendMetricsOutputTest < Test::Unit::TestCase
16
16
  CONFIG = %(
17
17
  target_platform "NEWRELIC"
18
18
  apikey ""
19
+ url "https://metric-api.newrelic.com/metric/v1"
19
20
  )
20
21
 
21
22
  def create_driver(conf)
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.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - MahithaB
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-03-03 00:00:00.000000000 Z
11
+ date: 2022-10-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -109,6 +109,7 @@ extra_rdoc_files: []
109
109
  files:
110
110
  - ".rspec"
111
111
  - Gemfile
112
+ - Gemfile.lock
112
113
  - LICENSE
113
114
  - README.md
114
115
  - Rakefile