fluent-plugin-jfrog-metrics 0.2.13 → 0.2.14
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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a5d5ad46df6caec2199b42f521c9722ce27552d988fda9950d8f5dac659e40ed
|
|
4
|
+
data.tar.gz: 4ec636b979f8cae25013c698d977d3b9021b68325b806b8c415f3fa356396593
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c0e1bc0f53fd024f6f200b27a4e0c39f98833b1412bf2fcaebbd24c743e7188dd8107c5a5f5e31c12cf8c0d9a88387ffe19bc5852e53c38afbe1b29dc18eebfa
|
|
7
|
+
data.tar.gz: f1db053da0248b953b9c023d092b101bd22dbf8a2a7a7379efacc675d6fb3ca8e161ea1dc66d43f01483da9e898057b0f373b4961781efe924a38420a585643a
|
|
@@ -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.14'
|
|
7
7
|
spec.authors = ['MahithaB, BenHarosh']
|
|
8
8
|
spec.email = ['cpe-support@jfrog.com']
|
|
9
9
|
|
|
@@ -27,15 +27,20 @@ class DatadogMetricsParser < BaseMetricsParser
|
|
|
27
27
|
interim_data_tag = interim_data_key + ':' + interim_data_value
|
|
28
28
|
tags << interim_data_tag
|
|
29
29
|
end
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
30
|
+
parts = metric_val_and_time.strip.split
|
|
31
|
+
metrics_hash['metric'] = prefix + separator + metric_name
|
|
32
|
+
if parts.length >= 2
|
|
33
|
+
# Metric WITH timestamp - use existing timestamp
|
|
34
|
+
metric_timestamp = parts[1]
|
|
35
|
+
point['timestamp'] = metric_timestamp[0,10].to_i
|
|
36
|
+
else
|
|
37
|
+
# Metric WITHOUT timestamp - use current time
|
|
38
|
+
point['timestamp'] = Time.now.to_i
|
|
38
39
|
end
|
|
40
|
+
point['value'] = parts[0].to_f
|
|
41
|
+
points << point
|
|
42
|
+
metrics_hash['points'] = points
|
|
43
|
+
metrics_hash['tags'] = tags
|
|
39
44
|
else
|
|
40
45
|
metrics_hash['metric'], metric_value, metric_timestamp = interim_data.split
|
|
41
46
|
metrics_hash['metric'] = prefix + separator + metrics_hash['metric']
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
3
|
require 'rest-client'
|
|
4
|
+
require_relative 'proxy_helper'
|
|
4
5
|
|
|
5
6
|
class MetricsHelper
|
|
6
7
|
@@obs_endpoint_exists = false
|
|
@@ -54,6 +55,9 @@ class MetricsHelper
|
|
|
54
55
|
|
|
55
56
|
def check_endpoint(url, token, verify_ssl, request_timeout)
|
|
56
57
|
@logger.debug("Checking connectivity to endpoint: #{url} started")
|
|
58
|
+
# Configure proxy with NO_PROXY support
|
|
59
|
+
ProxyHelper.configure_rest_client_proxy(url, nil, @logger)
|
|
60
|
+
|
|
57
61
|
request = RestClient::Request.new(
|
|
58
62
|
method: :get,
|
|
59
63
|
url: url,
|
|
@@ -76,6 +80,9 @@ class MetricsHelper
|
|
|
76
80
|
|
|
77
81
|
def execute_rest_call(url, user, password, token, use_token, verify_ssl, request_timeout)
|
|
78
82
|
@logger.debug("Rest call to fetch metrics started")
|
|
83
|
+
# Configure proxy with NO_PROXY support
|
|
84
|
+
ProxyHelper.configure_rest_client_proxy(url, nil, @logger)
|
|
85
|
+
|
|
79
86
|
request = if use_token == true
|
|
80
87
|
@logger.debug("Using token for authentication")
|
|
81
88
|
RestClient::Request.new(
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'uri'
|
|
4
|
+
|
|
5
|
+
module ProxyHelper
|
|
6
|
+
# Check if a host should bypass the proxy based on NO_PROXY environment variable
|
|
7
|
+
def self.should_bypass_proxy?(url, logger = nil)
|
|
8
|
+
no_proxy = ENV['NO_PROXY'] || ENV['no_proxy']
|
|
9
|
+
return false if no_proxy.nil? || no_proxy.empty?
|
|
10
|
+
|
|
11
|
+
begin
|
|
12
|
+
target_host = URI.parse(url).host
|
|
13
|
+
return false if target_host.nil?
|
|
14
|
+
|
|
15
|
+
no_proxy_hosts = no_proxy.split(',').map(&:strip)
|
|
16
|
+
|
|
17
|
+
no_proxy_hosts.each do |pattern|
|
|
18
|
+
next if pattern.empty?
|
|
19
|
+
|
|
20
|
+
# Remove leading dot if present (e.g., ".example.com" -> "example.com")
|
|
21
|
+
# Downcase both for case-insensitive matching (domain names are case-insensitive per RFC 1035)
|
|
22
|
+
pattern = pattern.sub(/^\./, '').downcase
|
|
23
|
+
target_host_lower = target_host.downcase
|
|
24
|
+
|
|
25
|
+
# Check for exact match or subdomain match
|
|
26
|
+
if target_host_lower == pattern || target_host_lower.end_with?(".#{pattern}")
|
|
27
|
+
logger&.debug("Host '#{target_host}' matches NO_PROXY pattern '#{pattern}', bypassing proxy")
|
|
28
|
+
return true
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# Check for wildcard
|
|
32
|
+
if pattern == '*'
|
|
33
|
+
logger&.debug("NO_PROXY contains '*', bypassing proxy for all hosts")
|
|
34
|
+
return true
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
rescue URI::InvalidURIError => e
|
|
38
|
+
logger&.warn("Failed to parse URL '#{url}': #{e.message}")
|
|
39
|
+
return false
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
false
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
# Get the proxy URL to use for a given target URL
|
|
46
|
+
# Returns nil if proxy should be bypassed, otherwise returns the proxy URL
|
|
47
|
+
def self.get_proxy_for_url(url, http_proxy_param = nil, logger = nil)
|
|
48
|
+
# Check if this URL should bypass proxy
|
|
49
|
+
if should_bypass_proxy?(url, logger)
|
|
50
|
+
return nil
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# Return proxy URL in order of precedence
|
|
54
|
+
if http_proxy_param && !http_proxy_param.empty?
|
|
55
|
+
logger&.debug("Using http_proxy param for request. Proxy url: #{http_proxy_param}")
|
|
56
|
+
return http_proxy_param
|
|
57
|
+
elsif ENV['HTTP_PROXY'] && !ENV['HTTP_PROXY'].empty?
|
|
58
|
+
logger&.debug("Using 'HTTP_PROXY' environment variable for request. Proxy url: #{ENV['HTTP_PROXY']}")
|
|
59
|
+
return ENV['HTTP_PROXY']
|
|
60
|
+
elsif ENV['http_proxy'] && !ENV['http_proxy'].empty?
|
|
61
|
+
logger&.debug("Using 'http_proxy' environment variable for request. Proxy url: #{ENV['http_proxy']}")
|
|
62
|
+
return ENV['http_proxy']
|
|
63
|
+
elsif ENV['HTTPS_PROXY'] && !ENV['HTTPS_PROXY'].empty?
|
|
64
|
+
logger&.debug("Using 'HTTPS_PROXY' environment variable for request. Proxy url: #{ENV['HTTPS_PROXY']}")
|
|
65
|
+
return ENV['HTTPS_PROXY']
|
|
66
|
+
elsif ENV['https_proxy'] && !ENV['https_proxy'].empty?
|
|
67
|
+
logger&.debug("Using 'https_proxy' environment variable for request. Proxy url: #{ENV['https_proxy']}")
|
|
68
|
+
return ENV['https_proxy']
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
nil
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
# Configure RestClient proxy for a given URL
|
|
75
|
+
def self.configure_rest_client_proxy(url, http_proxy_param = nil, logger = nil)
|
|
76
|
+
proxy_url = get_proxy_for_url(url, http_proxy_param, logger)
|
|
77
|
+
|
|
78
|
+
if proxy_url.nil?
|
|
79
|
+
RestClient.proxy = nil
|
|
80
|
+
logger&.debug("Proxy disabled for URL: #{url}")
|
|
81
|
+
else
|
|
82
|
+
RestClient.proxy = proxy_url
|
|
83
|
+
logger&.debug("Proxy enabled for URL: #{url}, using: #{proxy_url}")
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
|
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.14
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MahithaB, BenHarosh
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2026-01-19 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|
|
@@ -122,6 +122,7 @@ files:
|
|
|
122
122
|
- lib/fluent/plugin/in_jfrog_metrics.rb
|
|
123
123
|
- lib/fluent/plugin/metrics_helper.rb
|
|
124
124
|
- lib/fluent/plugin/newrelic_metrics_parser.rb
|
|
125
|
+
- lib/fluent/plugin/proxy_helper.rb
|
|
125
126
|
- lib/fluent/plugin/splunk_metrics_parser.rb
|
|
126
127
|
- spec/fixtures/files/creds.rb
|
|
127
128
|
- spec/fixtures/files/sample_artifactory_metrics.txt
|
|
@@ -136,7 +137,7 @@ homepage: https://github.com/jfrog/jfrog-fluentd-plugins/tree/main/fluent-plugin
|
|
|
136
137
|
licenses:
|
|
137
138
|
- Apache-2.0
|
|
138
139
|
metadata: {}
|
|
139
|
-
post_install_message:
|
|
140
|
+
post_install_message:
|
|
140
141
|
rdoc_options: []
|
|
141
142
|
require_paths:
|
|
142
143
|
- lib
|
|
@@ -151,8 +152,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
151
152
|
- !ruby/object:Gem::Version
|
|
152
153
|
version: '0'
|
|
153
154
|
requirements: []
|
|
154
|
-
rubygems_version: 3.
|
|
155
|
-
signing_key:
|
|
155
|
+
rubygems_version: 3.0.3.1
|
|
156
|
+
signing_key:
|
|
156
157
|
specification_version: 4
|
|
157
158
|
summary: Fluentd Plugin for converting JFrog Artifactory, Xray generated metrics (Prometheus
|
|
158
159
|
Exposition Format) to target observability platform format (Splunk HEC, New Relic,
|