fluent-plugin-jfrog-metrics 0.2.16 → 0.2.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 335f7170ad6eed8eb8237cfe912c0e6c547825a7b16904ebbd84c0247e51dbf6
4
- data.tar.gz: 73c094c9e41b5e163e5a6f604073a7ec84530fc9376033cc555aa15df58d21e5
3
+ metadata.gz: 87d664942597bf1b01b10d646cfd7688e86c9eefe43488d4357777e4b2e30abb
4
+ data.tar.gz: 1f622fe466d1c2490ccc3719b06fc1d43dd888a24f725fb10bb7d760e001870e
5
5
  SHA512:
6
- metadata.gz: 84d8410b8fcccefdca9b76071cbf1a2e42cba33fde5fb973e52e09939f52b08d779f533189220c982af2a131b231807dcc76b2293661c327acf323cbf6cf495b
7
- data.tar.gz: 58cb4bd996293b1ec508b35281f39788f5be88a32900da0faa941377328a9f9accd383b8673be109b3251c65176d9c7df9fde24e6084917fff96f4ca8f9d4272
6
+ metadata.gz: 7eebd867297ddb78732c1c72621e3a89064ec3273893fee443f32403dd3cccf4b0c3ecc8bed29230545561b2c5dc0ad0f3b09296a9302f03df8da11fe0f6a31f
7
+ data.tar.gz: fc09d5541762477d5e8405e712abf72df64ab94bf7f6af88eaa0bcd8bda671d5f89e94f28c2d67c9692a40eb40c17a4752b4afe71020219a4db35194308fa07d
data/CHANGELOG.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.2.17
4
+ - Fixed timestamp handling in NewRelic and Splunk metrics parsers for Prometheus metrics without timestamps ([JOBS-2118](https://jfrog-int.atlassian.net/browse/JOBS-2118))
5
+ - Metrics without timestamps (e.g., RTFS) now use current time instead of epoch 0, preventing silent rejection by New Relic Metric API
6
+
3
7
  ## v0.2.16
4
- - Added RTFS (Real-Time File Store) metrics endpoint support ([JOBS-1897](https://jfrog-int.atlassian.net/browse/JOBS-1897))
5
- - New metric_prefix `jfrog.rtfs` maps to `/artifactory/service/rtfs/api/v1/metrics`
8
+ - Added RTFS (JFrog Artifactory Federation Service) metrics endpoint support ([JOBS-1897](https://jfrog-int.atlassian.net/browse/JOBS-1897))
9
+ - New metric_prefix `jfrog.rtfs` maps to `/rtfs/api/v1/metrics`
6
10
 
7
11
  ## v0.2.13
8
12
  - Added fix to parse metrics without timestamps (JOBS-1801)
@@ -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.16'
6
+ spec.version = '0.2.17'
7
7
  spec.authors = ['MahithaB, BenHarosh']
8
8
  spec.email = ['cpe-support@jfrog.com']
9
9
 
@@ -24,19 +24,20 @@ class NewRelicMetricsParser < BaseMetricsParser
24
24
  interim_data_key = pair_data.split("=", 2)[0]
25
25
  attributes[interim_data_key] = interim_data_value
26
26
  end
27
- if metric_val_and_time =~ / /
28
- metrics_hash['name'] = prefix + separator + metric_name
29
- metrics_hash['value'] =
30
- 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
31
- metrics_hash['timestamp'] = metric_val_and_time.strip.split[1].to_i
32
- metrics_hash['attributes'] = attributes
33
- end
27
+ parts = metric_val_and_time.strip.split
28
+ metrics_hash['name'] = prefix + separator + metric_name
29
+ metrics_hash['value'] =
30
+ parts[0] =~ /^\S*\.\S*$/ ? parts[0].to_f : parts[0].to_i
31
+ parsed_ts = parts[1].to_i
32
+ metrics_hash['timestamp'] = parsed_ts > 0 ? parsed_ts : Time.now.to_i
33
+ metrics_hash['attributes'] = attributes
34
34
  else
35
- metrics_hash['name'], metrics_hash['value'], metrics_hash['timestamp'] = interim_data.split
35
+ metrics_hash['name'], metrics_hash['value'], raw_ts = interim_data.split
36
36
  metrics_hash['name'] = prefix + separator + metrics_hash['name']
37
37
  metrics_hash['value'] =
38
38
  metrics_hash['value'] =~ /^\S*\.\S*$/ ? metrics_hash['value'].to_f : metrics_hash['value'].to_i
39
- metrics_hash['timestamp'] = metrics_hash['timestamp'].to_i
39
+ parsed_ts = raw_ts.to_i
40
+ metrics_hash['timestamp'] = parsed_ts > 0 ? parsed_ts : Time.now.to_i
40
41
  end
41
42
  data_array << metrics_hash
42
43
  end
@@ -21,23 +21,24 @@ class SplunkMetricsParser < BaseMetricsParser
21
21
  metrics_hash = {}
22
22
  if data =~ /{/ && data =~ /}/
23
23
  metric_name, additional_dims, metric_val_and_time = data.match(/(.*?){(.*)}(.*)/i).captures
24
- if metric_val_and_time =~ / /
25
- metrics_hash['metric_name'] = prefix + separator + metric_name
26
- metrics_hash['value'] =
27
- 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
28
- metrics_hash['time'] = metric_val_and_time.strip.split[1].to_i
29
- if additional_dims =~ /,/
30
- additional_dims.split(/,/).map do |interim_data|
31
- metrics_hash[interim_data.split(/=/)[0]] = interim_data.split(/=/)[1].gsub(/"/, '') if interim_data =~ /=/
32
- end
24
+ parts = metric_val_and_time.strip.split
25
+ metrics_hash['metric_name'] = prefix + separator + metric_name
26
+ metrics_hash['value'] =
27
+ parts[0] =~ /^\S*\.\S*$/ ? parts[0].to_f : parts[0].to_i
28
+ parsed_ts = parts[1].to_i
29
+ metrics_hash['time'] = parsed_ts > 0 ? parsed_ts : Time.now.to_i
30
+ if additional_dims =~ /,/
31
+ additional_dims.split(/,/).map do |interim_data|
32
+ metrics_hash[interim_data.split(/=/)[0]] = interim_data.split(/=/)[1].gsub(/"/, '') if interim_data =~ /=/
33
33
  end
34
34
  end
35
35
  else
36
- metrics_hash['metric_name'], metrics_hash['value'], metrics_hash['time'] = data.split
36
+ metrics_hash['metric_name'], metrics_hash['value'], raw_ts = data.split
37
37
  metrics_hash['metric_name'] = prefix + separator + metrics_hash['metric_name']
38
38
  metrics_hash['value'] =
39
39
  metrics_hash['value'] =~ /^\S*\.\S*$/ ? metrics_hash['value'].to_f : metrics_hash['value'].to_i
40
- metrics_hash['time'] = metrics_hash['time'].to_i
40
+ parsed_ts = raw_ts.to_i
41
+ metrics_hash['time'] = parsed_ts > 0 ? parsed_ts : Time.now.to_i
41
42
  end
42
43
  metrics_hash
43
44
  end
@@ -0,0 +1,25 @@
1
+ # HELP application_ready_time_seconds Time taken for the application to be ready to service requests
2
+ # TYPE application_ready_time_seconds gauge
3
+ application_ready_time_seconds{application="Federation",main_application_class="org.jfrog.rtfs.devenv.ArtifactoryFederationServiceApplicationStartup"} 18.218
4
+ # HELP application_started_time_seconds Time taken to start the application
5
+ # TYPE application_started_time_seconds gauge
6
+ application_started_time_seconds{application="Federation",main_application_class="org.jfrog.rtfs.devenv.ArtifactoryFederationServiceApplicationStartup"} 5.931
7
+ # HELP disk_free_bytes Usable space for path
8
+ # TYPE disk_free_bytes gauge
9
+ disk_free_bytes{application="Federation",path="/var/opt/jfrog/artifactory/."} 8.57595199488E11
10
+ # HELP disk_total_bytes Total space for path
11
+ # TYPE disk_total_bytes gauge
12
+ disk_total_bytes{application="Federation",path="/var/opt/jfrog/artifactory/."} 9.77896124416E11
13
+ # HELP executor_active_threads The approximate number of threads that are actively executing tasks
14
+ # TYPE executor_active_threads gauge
15
+ executor_active_threads{application="Federation",name="binariesTaskMetricsCollectorScheduler"} 0.0
16
+ # HELP jvm_memory_used_bytes The amount of used memory
17
+ # TYPE jvm_memory_used_bytes gauge
18
+ jvm_memory_used_bytes{application="Federation",area="heap",id="G1 Eden Space"} 1.6777216E7
19
+ jvm_memory_used_bytes{application="Federation",area="heap",id="G1 Old Gen"} 7.4136896E7
20
+ # HELP process_cpu_usage The recent cpu usage for the JVM process
21
+ # TYPE process_cpu_usage gauge
22
+ process_cpu_usage{application="Federation"} 0.003
23
+ # HELP simple_metric_no_labels A metric without labels or timestamp
24
+ # TYPE simple_metric_no_labels gauge
25
+ simple_metric_no_labels 42
@@ -75,5 +75,29 @@ RSpec.describe NewRelicMetricsParser do
75
75
  serialized_data = parser.serialize_data(hash_data_array)
76
76
  expect(serialized_data.size).to be 1
77
77
  end
78
+
79
+ it 'should assign current timestamp to RTFS metrics that lack timestamps' do
80
+ platform_metrics = File.read('./spec/fixtures/files/sample_rtfs_metrics.txt')
81
+ expect(platform_metrics.size).to be > 1
82
+
83
+ parser = NewRelicMetricsParser.new('jfrog.rtfs', '', 'jfrog.metrics.rtfs')
84
+
85
+ normalized_data = parser.normalise_data(platform_metrics)
86
+ cleaned_data = parser.clean_data(normalized_data)
87
+ hash_data_array = parser.format_data(cleaned_data, 'jfrog.rtfs', '.')
88
+
89
+ expect(hash_data_array.size).to be 1
90
+ metrics = hash_data_array[0]['metrics']
91
+ expect(metrics.size).to be > 1
92
+
93
+ now = Time.now.to_i
94
+ metrics.each do |metric|
95
+ expect(metric['name']).to start_with('jfrog.rtfs.')
96
+ expect(metric['value']).to be_a(Numeric)
97
+ expect(metric['timestamp']).to be_a(Integer)
98
+ expect(metric['timestamp']).to be > 0
99
+ expect(metric['timestamp']).to be_within(5).of(now)
100
+ end
101
+ end
78
102
  end
79
103
  end
@@ -75,5 +75,27 @@ RSpec.describe SplunkMetricsParser do
75
75
  serialized_data = parser.serialize_data(hash_data_array)
76
76
  expect(serialized_data.size).to be > 1
77
77
  end
78
+
79
+ it 'should assign current timestamp to RTFS metrics that lack timestamps' do
80
+ platform_metrics = File.read('./spec/fixtures/files/sample_rtfs_metrics.txt')
81
+ expect(platform_metrics.size).to be > 1
82
+
83
+ parser = SplunkMetricsParser.new('jfrog.rtfs', '', 'jfrog.metrics.rtfs')
84
+
85
+ normalized_data = parser.normalise_data(platform_metrics)
86
+ cleaned_data = parser.clean_data(normalized_data)
87
+ hash_data_array = parser.format_data(cleaned_data, 'jfrog.rtfs', '.')
88
+
89
+ expect(hash_data_array.size).to be > 1
90
+
91
+ now = Time.now.to_i
92
+ hash_data_array.each do |metric|
93
+ expect(metric['metric_name']).to start_with('jfrog.rtfs.')
94
+ expect(metric['value']).to be_a(Numeric)
95
+ expect(metric['time']).to be_a(Integer)
96
+ expect(metric['time']).to be > 0
97
+ expect(metric['time']).to be_within(5).of(now)
98
+ end
99
+ end
78
100
  end
79
101
  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.16
4
+ version: 0.2.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - MahithaB, BenHarosh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-04-21 00:00:00.000000000 Z
11
+ date: 2026-04-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -127,6 +127,7 @@ files:
127
127
  - lib/fluent/plugin/splunk_metrics_parser.rb
128
128
  - spec/fixtures/files/creds.rb
129
129
  - spec/fixtures/files/sample_artifactory_metrics.txt
130
+ - spec/fixtures/files/sample_rtfs_metrics.txt
130
131
  - spec/fixtures/files/sample_xray_metrics.txt
131
132
  - spec/lib/datadog_metrics_parser_spec.rb
132
133
  - spec/lib/metrics_helper_spec.rb
@@ -163,6 +164,7 @@ summary: Fluentd Plugin for converting JFrog Artifactory, Xray, RTFS generated m
163
164
  test_files:
164
165
  - spec/fixtures/files/creds.rb
165
166
  - spec/fixtures/files/sample_artifactory_metrics.txt
167
+ - spec/fixtures/files/sample_rtfs_metrics.txt
166
168
  - spec/fixtures/files/sample_xray_metrics.txt
167
169
  - spec/lib/datadog_metrics_parser_spec.rb
168
170
  - spec/lib/metrics_helper_spec.rb