fluent-plugin-jfrog-send-metrics 0.1.0 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +70 -0
- data/fluent-plugin-jfrog-send-metrics.gemspec +1 -1
- data/lib/fluent/plugin/newrelic_metrics_sender.rb +5 -2
- data/lib/fluent/plugin/out_jfrog_send_metrics.rb +2 -1
- data/spec/fixtures/files/creds.rb +2 -1
- data/spec/lib/newrelic_metrics_sender_spec.rb +3 -4
- data/test/plugin/test_out_jfrog_send_metrics.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2571e34374cc85955b38ac32b9c2388f3e9e26b1f51e51c026885976469862fe
|
4
|
+
data.tar.gz: 7d61b0bc3bae04f3eed3c4f8faef5b72cfab7c0359e72f18ef8fd467ad18702d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eea10d117f22f21dd356ceed2b3c7561a88a8cb38c44ccb06553ec600545b637cb6af0da448327397bece894b5d9ae079d794f44974eb636f71f9eee3a5b15db
|
7
|
+
data.tar.gz: 72804f2cfe82dd8c1adf0b5e83ffaee7be1f82ec2004058cfbe4b7aac668e808091c9fde78003912cf897c4771f6d4b09d1e86b229c9eb769522a9f7c3388702
|
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.
|
6
|
+
spec.version = "0.1.2"
|
7
7
|
spec.authors = ["MahithaB"]
|
8
8
|
spec.email = ["60710901+MahithaB@users.noreply.github.com"]
|
9
9
|
|
@@ -1,17 +1,20 @@
|
|
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)
|
12
|
+
puts "Sending received metrics data"
|
10
13
|
metrics_payload = []
|
11
14
|
metrics_payload.push(JSON.parse(metrics_data.to_json))
|
12
15
|
response = RestClient::Request.new(
|
13
16
|
method: :post,
|
14
|
-
url:
|
17
|
+
url: @url,
|
15
18
|
payload: metrics_payload.to_json,
|
16
19
|
headers: {params: {'Api-Key' => @apikey}}
|
17
20
|
).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
|
@@ -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:
|
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:
|
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|
|
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.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MahithaB
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-14 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
|