fluent-plugin-jfrog-metrics 0.2.5 → 0.2.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: b2ae50efd3530bcd0b047c79aca24ee8509c76c972fe834bd2092a55b0d9f807
4
- data.tar.gz: 5eb9ead9094b261942d23f8e7181913b41bb08326fb5ec86cc784a29dafd5328
3
+ metadata.gz: bc48b6c9f8a51df6c59f938a6283e17751649320e9e02ec811ad05f2dd58fc0e
4
+ data.tar.gz: 8996298f2223575ae661e115a9eedf695d5fb14732bedc29e4b634bc69c20fa4
5
5
  SHA512:
6
- metadata.gz: 3bde97c36506f91725cc8a13fae533929a6d6bb461822f701095e205e96c421e10df47213b94e3c7b12cc284880ff7361eb401202b84acf07bb16c781ccd42e5
7
- data.tar.gz: 8b5096c569210002908e19f416a5e605ece7d26e725037e10c2d9c57be06a28624bb0456d4dcaed8afee732c3bbd1c9bc77ebde1782bb571f3ebc577e12ae9c0
6
+ metadata.gz: eee23ebb31284a6a358f618f30a2e6a735e12fc6956c92a22b347db1f128d1b27b908f508a110b4ee93372032f017a4b397c04a98d83662643275ea0137d0915
7
+ data.tar.gz: 30837a031c859b1a3882b42e7ba20665d097531bb116ef63434315476a6141d338cc11c7d5f3373d03131d6062987ff219e73e3d7d6abe3b431fac15052ea087
@@ -3,8 +3,8 @@ $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.5'
7
- spec.authors = ['MahithaB, VasukiN, giri-vsr']
6
+ spec.version = '0.2.7'
7
+ spec.authors = ['MahithaB, BenHarosh']
8
8
  spec.email = ['cpe-support@jfrog.com']
9
9
 
10
10
  spec.summary = %q{Fluentd Plugin for converting JFrog Artifactory, Xray generated metrics (Prometheus Exposition Format) to target observability platform format (Splunk HEC, New Relic, Elastic)}
@@ -20,23 +20,17 @@ class DatadogMetricsParser < BaseMetricsParser
20
20
  points = []
21
21
  if interim_data =~ /{/ && interim_data =~ /}/
22
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
23
+ additional_dims.split("\",").each do |interim_data|
24
+ pair_data = interim_data.gsub("\"", "").gsub("{", "").gsub("}", "")
25
+ interim_data_value = pair_data.split("=", 2)[1]
26
+ interim_data_key = pair_data.split("=", 2)[0]
27
+ interim_data_tag = interim_data_key + ':' + interim_data_value
28
+ tags << interim_data_tag
35
29
  end
36
30
  if metric_val_and_time =~ / /
37
31
  metrics_hash['metric'] = prefix + separator + metric_name
38
32
  metric_timestamp = metric_val_and_time.strip.split[1]
39
- point['timestamp'] = metric_timestamp[0,10].to_i
33
+ point['timestamp'] = metric_timestamp[0,10].to_i if metric_timestamp != nil
40
34
  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
35
  points << point
42
36
  metrics_hash['points'] = points
@@ -37,7 +37,8 @@ module Fluent
37
37
  config_param :username, :string, default: ''
38
38
  config_param :apikey, :string, default: '', :secret => true
39
39
  config_param :token, :string, default: '', :secret => true
40
- config_param :interval, :time, default: 10
40
+ config_param :execution_interval, :time, default: 10
41
+ config_param :timeout_interval, :time, default: 30
41
42
  config_param :metric_prefix, :string, default: ''
42
43
  config_param :target_platform, :string, default: 'SPLUNK'
43
44
  config_param :common_jpd, :bool, default: false
@@ -55,8 +56,6 @@ module Fluent
55
56
 
56
57
  raise Fluent::ConfigError, 'Must define the apikey or token for authentication.' if @token == '' && @apikey == ''
57
58
 
58
- raise Fluent::ConfigError, 'Must define the interval to use for gathering the metrics.' if @interval == ''
59
-
60
59
  raise Fluent::ConfigError, 'Must define the metric_prefix to use for getting the metrics.' if @metric_prefix == ''
61
60
 
62
61
  raise Fluent::ConfigError, 'Must define the vendor to use for getting the metrics.' if @target_platform == ''
@@ -77,17 +76,19 @@ module Fluent
77
76
 
78
77
  def run
79
78
  puts('Preparing metrics collection, creating timer task')
80
- timer_task = Concurrent::TimerTask.new(execution_interval: @interval, timeout_interval: 30, run_now: true) do
79
+ timer_task = Concurrent::TimerTask.new(execution_interval: @execution_interval, timeout_interval: @timeout_interval, run_now: true) do
81
80
  puts('Timer task execution')
82
81
  do_execute
83
82
  end
84
83
  timer_task.execute
84
+ sleep 100
85
85
  end
86
86
 
87
87
  def do_execute
88
88
  puts('Executing metrics collection')
89
89
  metrics_helper = MetricsHelper.new(@metric_prefix, @jpd_url, @username, @apikey, @token, @common_jpd)
90
90
  platform_metrics = metrics_helper.get_metrics
91
+
91
92
  additional_metrics = metrics_helper.get_additional_metrics
92
93
  if !additional_metrics.nil? && additional_metrics != ''
93
94
  platform_metrics += additional_metrics.to_s
@@ -13,18 +13,18 @@ class NewRelicMetricsParser < BaseMetricsParser
13
13
  hash_data_array = []
14
14
  data_hash = {}
15
15
  data_array = []
16
+ puts cleaned_data
16
17
  cleaned_data.each do |interim_data|
17
18
  metrics_hash = {}
18
19
  if interim_data =~ /{/ && interim_data =~ /}/
19
20
  attributes = {}
20
21
  metric_name, additional_dims, metric_val_and_time = interim_data.match(/(.*){(.*)}(.*)/i).captures
21
- if additional_dims =~ /,/
22
- additional_dims.split(/,/).map do |interim_data|
23
- attributes[interim_data.split(/=/)[0]] = interim_data.split(/=/)[1].gsub(/"/, '') if interim_data =~ /=/
24
- end
25
- else
26
- attribute_name, attribute_value = additional_dims.split('=')
27
- attributes[attribute_name] = attribute_value.delete_prefix('"').delete_suffix('"')
22
+ additional_dims.split("\",").each do |interim_data|
23
+ puts interim_data
24
+ pair_data = interim_data.gsub("\"", "").gsub("{", "").gsub("}", "")
25
+ interim_data_value = pair_data.split("=", 2)[1]
26
+ interim_data_key = pair_data.split("=", 2)[0]
27
+ attributes[interim_data_key] = interim_data_value
28
28
  end
29
29
  if metric_val_and_time =~ / /
30
30
  metrics_hash['name'] = prefix + separator + metric_name
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.5
4
+ version: 0.2.7
5
5
  platform: ruby
6
6
  authors:
7
- - MahithaB, VasukiN, giri-vsr
7
+ - MahithaB, BenHarosh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-06-14 00:00:00.000000000 Z
11
+ date: 2024-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  requirements: []
156
- rubygems_version: 3.1.6
156
+ rubygems_version: 3.5.3
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Fluentd Plugin for converting JFrog Artifactory, Xray generated metrics (Prometheus