fluent-plugin-jfrog-send-metrics 0.1.10.3 → 0.1.12
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 +4 -4
- data/Gemfile.lock +1 -1
- data/fluent-plugin-jfrog-send-metrics.gemspec +1 -1
- data/lib/fluent/plugin/datadog_metrics_sender.rb +3 -13
- data/lib/fluent/plugin/proxy_helper.rb +88 -0
- metadata +7 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7c58cdb0b0674251139235aeb19c523ce8468e6f4cd64cd8aad4134116e6c177
|
|
4
|
+
data.tar.gz: ba01496c54f9034c4c3262154ba063f0304b2d41b115bd9d91581802c68c8d01
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 825b37a695681175f8aab44d3efa00bbdc3fe42913a846ec7ad6f99c6ed6ce1e5279a49520158d1cb2509ce26b07e50e0e76c6226524b5cf232844353f6017ba
|
|
7
|
+
data.tar.gz: 0a108a192d22a7467c42421659af7bc9b4256f6de6253a2333485e958dd9917363b8266e47f951f01d802133d9b7126b4cb6aa9ebdd9459660e5da8c0f687ef6
|
data/Gemfile.lock
CHANGED
|
@@ -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.12"
|
|
7
7
|
spec.authors = ["MahithaB", "BenH"]
|
|
8
8
|
spec.email = ["partner_support@jfrog.com"]
|
|
9
9
|
|
|
@@ -4,6 +4,7 @@ require 'rest-client'
|
|
|
4
4
|
require 'uri'
|
|
5
5
|
require 'stringio'
|
|
6
6
|
require_relative 'utility'
|
|
7
|
+
require_relative 'proxy_helper'
|
|
7
8
|
|
|
8
9
|
class DatadogMetrics
|
|
9
10
|
def initialize(apikey, url)
|
|
@@ -32,19 +33,8 @@ class DatadogMetrics
|
|
|
32
33
|
metrics_data = add_custom_data(ddtags, record)
|
|
33
34
|
logger.info("Sending received metrics data")
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
logger.info("Using http_proxy param to set proxy for request. Proxy url: #{RestClient.proxy}")
|
|
38
|
-
elsif ENV['HTTP_PROXY']
|
|
39
|
-
RestClient.proxy = ENV['HTTP_PROXY']
|
|
40
|
-
logger.info("Using 'HTTP_PROXY' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
|
41
|
-
elsif ENV['http_proxy']
|
|
42
|
-
RestClient.proxy = ENV['http_proxy']
|
|
43
|
-
logger.info("Using 'http_proxy' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
|
44
|
-
elsif ENV['https_proxy']
|
|
45
|
-
RestClient.proxy = ENV['https_proxy']
|
|
46
|
-
logger.info("Using 'https_proxy' environment variable to set proxy for request. Proxy url: #{RestClient.proxy}")
|
|
47
|
-
end
|
|
36
|
+
# Configure proxy with NO_PROXY support
|
|
37
|
+
ProxyHelper.configure_rest_client_proxy(@url, http_proxy, logger)
|
|
48
38
|
|
|
49
39
|
headers = {
|
|
50
40
|
'DD-API-KEY': @apikey,
|
|
@@ -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,15 +1,15 @@
|
|
|
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.12
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- MahithaB
|
|
8
8
|
- BenH
|
|
9
|
-
autorequire:
|
|
9
|
+
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2026-01-19 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: bundler
|
|
@@ -118,6 +118,7 @@ files:
|
|
|
118
118
|
- lib/fluent/plugin/datadog_metrics_sender.rb
|
|
119
119
|
- lib/fluent/plugin/newrelic_metrics_sender.rb
|
|
120
120
|
- lib/fluent/plugin/out_jfrog_send_metrics.rb
|
|
121
|
+
- lib/fluent/plugin/proxy_helper.rb
|
|
121
122
|
- lib/fluent/plugin/utility.rb
|
|
122
123
|
- spec/fixtures/files/creds.rb
|
|
123
124
|
- spec/fixtures/files/sample_artifactory_newrelic_metrics.txt
|
|
@@ -130,7 +131,7 @@ homepage: https://github.com/jfrog/jfrog-fluentd-plugins/tree/main/fluent-plugin
|
|
|
130
131
|
licenses:
|
|
131
132
|
- Apache-2.0
|
|
132
133
|
metadata: {}
|
|
133
|
-
post_install_message:
|
|
134
|
+
post_install_message:
|
|
134
135
|
rdoc_options: []
|
|
135
136
|
require_paths:
|
|
136
137
|
- lib
|
|
@@ -145,8 +146,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
145
146
|
- !ruby/object:Gem::Version
|
|
146
147
|
version: '0'
|
|
147
148
|
requirements: []
|
|
148
|
-
rubygems_version: 3.
|
|
149
|
-
signing_key:
|
|
149
|
+
rubygems_version: 3.0.3.1
|
|
150
|
+
signing_key:
|
|
150
151
|
specification_version: 4
|
|
151
152
|
summary: Fluentd Plugin for sending metrics to the respective log-vendor
|
|
152
153
|
test_files:
|