fluent-plugin-jfrog-metrics 0.2.3 → 0.2.5
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: b2ae50efd3530bcd0b047c79aca24ee8509c76c972fe834bd2092a55b0d9f807
|
4
|
+
data.tar.gz: 5eb9ead9094b261942d23f8e7181913b41bb08326fb5ec86cc784a29dafd5328
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bde97c36506f91725cc8a13fae533929a6d6bb461822f701095e205e96c421e10df47213b94e3c7b12cc284880ff7361eb401202b84acf07bb16c781ccd42e5
|
7
|
+
data.tar.gz: 8b5096c569210002908e19f416a5e605ece7d26e725037e10c2d9c57be06a28624bb0456d4dcaed8afee732c3bbd1c9bc77ebde1782bb571f3ebc577e12ae9c0
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-jfrog-metrics (0.2.
|
4
|
+
fluent-plugin-jfrog-metrics (0.2.5)
|
5
5
|
fluentd (>= 0.14.10, < 2)
|
6
6
|
rest-client (~> 2.0)
|
7
7
|
|
@@ -10,21 +10,21 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
ansi (1.5.0)
|
12
12
|
builder (3.2.4)
|
13
|
-
concurrent-ruby (1.
|
13
|
+
concurrent-ruby (1.2.2)
|
14
14
|
cool.io (1.7.1)
|
15
15
|
domain_name (0.5.20190701)
|
16
16
|
unf (>= 0.0.5, < 1.0.0)
|
17
|
-
fluentd (1.
|
17
|
+
fluentd (1.16.1)
|
18
18
|
bundler
|
19
19
|
cool.io (>= 1.4.5, < 2.0.0)
|
20
20
|
http_parser.rb (>= 0.5.1, < 0.9.0)
|
21
21
|
msgpack (>= 1.3.1, < 2.0.0)
|
22
|
-
serverengine (>= 2.2
|
22
|
+
serverengine (>= 2.3.2, < 3.0.0)
|
23
23
|
sigdump (~> 0.2.2)
|
24
24
|
strptime (>= 0.2.4, < 1.0.0)
|
25
25
|
tzinfo (>= 1.0, < 3.0)
|
26
26
|
tzinfo-data (~> 1.0)
|
27
|
-
webrick (
|
27
|
+
webrick (~> 1.4)
|
28
28
|
yajl-ruby (~> 1.0)
|
29
29
|
http-accept (1.7.0)
|
30
30
|
http-cookie (1.0.4)
|
@@ -39,7 +39,7 @@ GEM
|
|
39
39
|
builder
|
40
40
|
minitest (>= 5.0)
|
41
41
|
ruby-progressbar
|
42
|
-
msgpack (1.
|
42
|
+
msgpack (1.7.1)
|
43
43
|
netrc (0.11.0)
|
44
44
|
power_assert (2.0.1)
|
45
45
|
rake (12.3.3)
|
@@ -49,21 +49,21 @@ GEM
|
|
49
49
|
mime-types (>= 1.16, < 4.0)
|
50
50
|
netrc (~> 0.8)
|
51
51
|
ruby-progressbar (1.11.0)
|
52
|
-
serverengine (2.2
|
52
|
+
serverengine (2.3.2)
|
53
53
|
sigdump (~> 0.2.2)
|
54
54
|
sigdump (0.2.4)
|
55
55
|
strptime (0.2.5)
|
56
56
|
test-unit (3.5.0)
|
57
57
|
power_assert
|
58
|
-
tzinfo (2.0.
|
58
|
+
tzinfo (2.0.6)
|
59
59
|
concurrent-ruby (~> 1.0)
|
60
|
-
tzinfo-data (1.
|
60
|
+
tzinfo-data (1.2023.3)
|
61
61
|
tzinfo (>= 1.0.0)
|
62
62
|
unf (0.1.4)
|
63
63
|
unf_ext
|
64
64
|
unf_ext (0.0.8)
|
65
|
-
webrick (1.
|
66
|
-
yajl-ruby (1.4.
|
65
|
+
webrick (1.8.1)
|
66
|
+
yajl-ruby (1.4.3)
|
67
67
|
|
68
68
|
PLATFORMS
|
69
69
|
ruby
|
@@ -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-metrics'
|
6
|
-
spec.version = '0.2.
|
6
|
+
spec.version = '0.2.5'
|
7
7
|
spec.authors = ['MahithaB, VasukiN, giri-vsr']
|
8
8
|
spec.email = ['cpe-support@jfrog.com']
|
9
9
|
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'json'
|
3
|
+
require_relative 'base_metrics_parser'
|
4
|
+
|
5
|
+
class DatadogMetricsParser < BaseMetricsParser
|
6
|
+
def initialize(metric_prefix, router, tag)
|
7
|
+
@metric_prefix = metric_prefix
|
8
|
+
@router = router
|
9
|
+
@tag = tag
|
10
|
+
end
|
11
|
+
|
12
|
+
def format_data(cleaned_data = [], prefix = '', separator = '')
|
13
|
+
hash_data_array = []
|
14
|
+
data_hash = {}
|
15
|
+
data_array = []
|
16
|
+
cleaned_data.each do |interim_data|
|
17
|
+
metrics_hash = {}
|
18
|
+
tags = []
|
19
|
+
point = {}
|
20
|
+
points = []
|
21
|
+
if interim_data =~ /{/ && interim_data =~ /}/
|
22
|
+
metric_name, additional_dims, metric_val_and_time = interim_data.match(/(.*){(.*)}(.*)/i).captures
|
23
|
+
if additional_dims =~ /,/
|
24
|
+
additional_dims.split(/,/).map do |interim_data|
|
25
|
+
interim_data_value = interim_data.split(/=/)[1].gsub(/"/, '') if interim_data =~ /=/
|
26
|
+
interim_data_key = interim_data.split(/=/)[0]
|
27
|
+
interim_data_tag = interim_data_key + ':' + interim_data_value
|
28
|
+
tags << interim_data_tag
|
29
|
+
end
|
30
|
+
else
|
31
|
+
attribute_name, attribute_value = additional_dims.split('=')
|
32
|
+
attribute_value = attribute_value.delete_prefix('"').delete_suffix('"')
|
33
|
+
attribute_tag = attribute_name + ':' + attribute_value
|
34
|
+
tags << attribute_tag
|
35
|
+
end
|
36
|
+
if metric_val_and_time =~ / /
|
37
|
+
metrics_hash['metric'] = prefix + separator + metric_name
|
38
|
+
metric_timestamp = metric_val_and_time.strip.split[1]
|
39
|
+
point['timestamp'] = metric_timestamp[0,10].to_i
|
40
|
+
point['value'] = metric_val_and_time.strip.split[0] =~ /^\S*\.\S*$/ ? metric_val_and_time.strip.split[0].to_f : metric_val_and_time.strip.split[0].to_i
|
41
|
+
points << point
|
42
|
+
metrics_hash['points'] = points
|
43
|
+
metrics_hash['tags'] = tags
|
44
|
+
end
|
45
|
+
else
|
46
|
+
metrics_hash['metric'], metric_value, metric_timestamp = interim_data.split
|
47
|
+
metrics_hash['metric'] = prefix + separator + metrics_hash['metric']
|
48
|
+
point['value'] = metric_value =~ /^\S*\.\S*$/ ? metric_value.to_f : metric_value.to_i
|
49
|
+
point['timestamp'] = metric_timestamp[0,10].to_i
|
50
|
+
points << point
|
51
|
+
metrics_hash['points'] = points
|
52
|
+
end
|
53
|
+
metrics_hash['type'] = 3
|
54
|
+
data_array << metrics_hash
|
55
|
+
end
|
56
|
+
data_hash["series"] = data_array
|
57
|
+
hash_data_array.push(data_hash)
|
58
|
+
hash_data_array
|
59
|
+
end
|
60
|
+
|
61
|
+
end
|
@@ -20,12 +20,11 @@ class ElasticMetricsParser < BaseMetricsParser
|
|
20
20
|
additional_dims.split(/,/).map do |interim_dim_data|
|
21
21
|
hash_data_with_dim_fields[prefix + separator + "label" + separator + interim_dim_data.split(/=/)[0]] = interim_dim_data.split(/=/)[1].gsub(/"/, '') if interim_dim_data =~ /=/
|
22
22
|
end
|
23
|
-
hash_data_with_dim_fields[prefix + separator + metric_name] = metric_val_and_time.strip.split[0]
|
23
|
+
hash_data_with_dim_fields[prefix + separator + metric_name] = metric_val_and_time.strip.split[0].to_f
|
24
24
|
hash_data_with_labels << hash_data_with_dim_fields
|
25
25
|
else
|
26
26
|
metric_name, value, = interim_data.split
|
27
|
-
hash_data[prefix + separator + metric_name] =
|
28
|
-
value =~ /^\S*\.\S*$/ ? value.to_f : value.to_i
|
27
|
+
hash_data[prefix + separator + metric_name] = value.to_f
|
29
28
|
end
|
30
29
|
end
|
31
30
|
hash_data_array << hash_data
|
@@ -22,6 +22,7 @@ require_relative 'metrics_helper'
|
|
22
22
|
require_relative 'newrelic_metrics_parser'
|
23
23
|
require_relative 'splunk_metrics_parser'
|
24
24
|
require_relative 'elastic_metrics_parser'
|
25
|
+
require_relative 'datadog_metrics_parser'
|
25
26
|
|
26
27
|
module Fluent
|
27
28
|
module Plugin
|
@@ -97,6 +98,8 @@ module Fluent
|
|
97
98
|
parser = ElasticMetricsParser.new(@metric_prefix, router, @tag)
|
98
99
|
elsif @target_platform == 'NEWRELIC'
|
99
100
|
parser = NewRelicMetricsParser.new(@metric_prefix, router, @tag)
|
101
|
+
elsif @target_platform == 'DATADOG'
|
102
|
+
parser = DatadogMetricsParser.new(@metric_prefix, router, @tag)
|
100
103
|
else
|
101
104
|
raise 'Parser Type is not valid.Should be SPLUNK or ELASTIC or NEWRELIC'
|
102
105
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-jfrog-metrics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- MahithaB, VasukiN, giri-vsr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- Rakefile
|
119
119
|
- fluent-plugin-jfrog-metrics.gemspec
|
120
120
|
- lib/fluent/plugin/base_metrics_parser.rb
|
121
|
+
- lib/fluent/plugin/datadog_metrics_parser.rb
|
121
122
|
- lib/fluent/plugin/elastic_metrics_parser.rb
|
122
123
|
- lib/fluent/plugin/in_jfrog_metrics.rb
|
123
124
|
- lib/fluent/plugin/metrics_helper.rb
|