fluent-plugin-prometheus-pull 0.2.1 → 0.3.0
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/.ruby-version +1 -1
- data/Gemfile.lock +6 -2
- data/README.md +54 -18
- data/fluent-plugin-prometheus-pull.gemspec +3 -1
- data/lib/fluent/plugin/in_prometheus_pull.rb +11 -4
- metadata +22 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a0a3f5b93d2e46f80149be477104c931901251c2f5f14c1df5661986566f663
|
4
|
+
data.tar.gz: e4b68baef6a5150c8df33ae2784d67e5d6660dfe78d81678e48c01b10056802e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5589dd9e1cd671bf1d2fccec26af649715d583dafc44cb63a312805c440a76260c935004721d853fba54164ef67fee70d1593ee88f164a16e57e974577d70da3
|
7
|
+
data.tar.gz: b31a56ca58efc9bc8aab602d6f2620d16397a1e34184fd57625e27d6870160d6c9898752cc86d624fab87499e9deca13250d78bc1b837848eeadc9f112f2ced3
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.8
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
fluent-plugin-prometheus-pull (0.
|
4
|
+
fluent-plugin-prometheus-pull (0.3.0)
|
5
5
|
fluentd (>= 0.14.10, < 2)
|
6
6
|
|
7
7
|
GEM
|
@@ -27,6 +27,8 @@ GEM
|
|
27
27
|
http_parser.rb (0.8.0)
|
28
28
|
json (2.6.3)
|
29
29
|
kwalify (0.7.2)
|
30
|
+
mocha (2.4.5)
|
31
|
+
ruby2_keywords (>= 0.0.5)
|
30
32
|
msgpack (1.6.0)
|
31
33
|
parallel (1.22.1)
|
32
34
|
parser (3.2.0.0)
|
@@ -55,6 +57,7 @@ GEM
|
|
55
57
|
rubocop-rake (0.6.0)
|
56
58
|
rubocop (~> 1.0)
|
57
59
|
ruby-progressbar (1.11.0)
|
60
|
+
ruby2_keywords (0.0.5)
|
58
61
|
serverengine (2.3.1)
|
59
62
|
sigdump (~> 0.2.2)
|
60
63
|
sigdump (0.2.4)
|
@@ -77,6 +80,7 @@ DEPENDENCIES
|
|
77
80
|
bundler (~> 2.3)
|
78
81
|
byebug (~> 11.1, >= 11.1.3)
|
79
82
|
fluent-plugin-prometheus-pull!
|
83
|
+
mocha (~> 2.4, >= 2.4.5)
|
80
84
|
rake (~> 13.0.6)
|
81
85
|
reek (~> 6.1, >= 6.1.4)
|
82
86
|
rubocop (~> 1.44, >= 1.44.1)
|
@@ -84,4 +88,4 @@ DEPENDENCIES
|
|
84
88
|
test-unit (~> 3.5.3)
|
85
89
|
|
86
90
|
BUNDLED WITH
|
87
|
-
2.4.
|
91
|
+
2.4.22
|
data/README.md
CHANGED
@@ -1,40 +1,76 @@
|
|
1
1
|
# fluent-plugin-prometheus-pull
|
2
2
|
|
3
|
-
[Fluentd](https://fluentd.org/) input plugin to
|
3
|
+
[Fluentd](https://fluentd.org/) input plugin to pull prometheus http endpoint.
|
4
4
|
|
5
|
-
TODO: write description for you plugin.
|
6
5
|
|
7
|
-
##
|
6
|
+
## plugins
|
7
|
+
|
8
|
+
### input - prometheus_pull
|
9
|
+
|
10
|
+
Pull http prometheus metric endpoint.
|
11
|
+
|
12
|
+
with options:
|
8
13
|
|
9
|
-
|
14
|
+
| options | default | usage |
|
15
|
+
|---------------|---------|--------------------------------------------------|
|
16
|
+
| | | |
|
17
|
+
| event_url_key | nil | add in generated event, key to store fetched url |
|
18
|
+
| | | |
|
19
|
+
|
20
|
+
Example:
|
10
21
|
|
11
22
|
```
|
12
|
-
|
23
|
+
<source>
|
24
|
+
@type prometheus_pull
|
25
|
+
urls http://app/metrics,http://app2/metrics
|
26
|
+
interval 300s
|
27
|
+
|
28
|
+
tag metric
|
29
|
+
|
30
|
+
<parse>
|
31
|
+
@type prometheus_text
|
32
|
+
label_prefix tags_
|
33
|
+
add_type false
|
34
|
+
</parse>
|
35
|
+
</source>
|
13
36
|
```
|
14
37
|
|
15
|
-
###
|
38
|
+
### parser - prometheus_text
|
16
39
|
|
17
|
-
|
40
|
+
Take a "text" (string) of prometheus content, fetched by any mechanism you want,
|
41
|
+
then it parses it, transforming each line in 1 event.
|
18
42
|
|
19
|
-
|
20
|
-
|
21
|
-
|
43
|
+
with options:
|
44
|
+
* ...
|
45
|
+
* ...
|
22
46
|
|
23
|
-
|
47
|
+
Example:
|
24
48
|
|
25
49
|
```
|
26
|
-
|
50
|
+
<parse>
|
51
|
+
@type prometheus_text
|
52
|
+
label_prefix tags_
|
53
|
+
add_type false
|
54
|
+
</parse>
|
27
55
|
```
|
28
56
|
|
29
|
-
##
|
57
|
+
## Installation
|
58
|
+
|
59
|
+
Manual install, by executing:
|
30
60
|
|
31
|
-
|
61
|
+
$ gem install fluent-plugin-prometheus-pull
|
32
62
|
|
33
|
-
|
34
|
-
|
35
|
-
|
63
|
+
Add to Gemfile with:
|
64
|
+
|
65
|
+
$ bundle add fluent-plugin-prometheus-pull
|
66
|
+
|
67
|
+
|
68
|
+
## Compatibility
|
69
|
+
|
70
|
+
plugin will work with:
|
71
|
+
- ruby >= 2.7.7
|
72
|
+
- td-agent >= 4.0.0
|
36
73
|
|
37
|
-
You can copy and paste generated documents here.
|
38
74
|
|
39
75
|
## Copyright
|
40
76
|
|
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'fluent-plugin-prometheus-pull'
|
8
|
-
spec.version = '0.
|
8
|
+
spec.version = '0.3.0'
|
9
9
|
spec.authors = ['Thomas Tych']
|
10
10
|
spec.email = ['thomas.tych@gmail.com']
|
11
11
|
|
@@ -34,6 +34,8 @@ Gem::Specification.new do |spec|
|
|
34
34
|
spec.add_development_dependency 'rubocop', '~> 1.44', '>= 1.44.1'
|
35
35
|
spec.add_development_dependency 'rubocop-rake', '~> 0.6.0'
|
36
36
|
spec.add_development_dependency 'test-unit', '~> 3.5.3'
|
37
|
+
spec.add_development_dependency 'mocha', '~> 2.4', '>= 2.4.5'
|
38
|
+
|
37
39
|
|
38
40
|
spec.add_runtime_dependency 'fluentd', ['>= 0.14.10', '< 2']
|
39
41
|
end
|
@@ -63,12 +63,18 @@ module Fluent
|
|
63
63
|
desc 'CA file path'
|
64
64
|
config_param :ca_file, :string, default: nil
|
65
65
|
|
66
|
+
desc 'Event URL key'
|
67
|
+
config_param :event_url_key, :string, default: nil
|
68
|
+
|
66
69
|
def configure(conf)
|
67
70
|
compat_parameters_convert(conf, :parser)
|
68
71
|
|
69
72
|
parser_config = conf.elements('parse').first
|
70
73
|
# raise Fluent::ConfigError, '<parse> section is required.' unless parser_config
|
71
|
-
parser_config
|
74
|
+
unless parser_config
|
75
|
+
parser_config ||= Fluent::Config::Element.new('parse', '', { '@type' => 'prometheus_text' }, [])
|
76
|
+
conf.elements.append(parser_config)
|
77
|
+
end
|
72
78
|
|
73
79
|
super
|
74
80
|
|
@@ -78,7 +84,7 @@ module Fluent
|
|
78
84
|
def start
|
79
85
|
super
|
80
86
|
|
81
|
-
timer_execute(:
|
87
|
+
timer_execute(:in_prometheus_pull_timer, @interval, &method(:pull))
|
82
88
|
end
|
83
89
|
|
84
90
|
def pull
|
@@ -88,6 +94,7 @@ module Fluent
|
|
88
94
|
parser.parse(raw_metrics) do |time, record|
|
89
95
|
begin
|
90
96
|
time ||= pull_time
|
97
|
+
record[event_url_key] = url if event_url_key
|
91
98
|
router.emit(tag, time, record)
|
92
99
|
rescue StandardError => e
|
93
100
|
error("error #{e}, while emitting #{record}")
|
@@ -127,8 +134,8 @@ module Fluent
|
|
127
134
|
def fetch(url, redirect_limit = 5)
|
128
135
|
raise 'Max number of redirects reached' if redirect_limit <= 0
|
129
136
|
|
130
|
-
|
131
|
-
http(
|
137
|
+
fetch_uri = URI.parse(url)
|
138
|
+
http(fetch_uri) do |http, uri|
|
132
139
|
req = request(uri)
|
133
140
|
response = http.request(req)
|
134
141
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-prometheus-pull
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Tych
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bump
|
@@ -140,6 +140,26 @@ dependencies:
|
|
140
140
|
- - "~>"
|
141
141
|
- !ruby/object:Gem::Version
|
142
142
|
version: 3.5.3
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: mocha
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '2.4'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 2.4.5
|
153
|
+
type: :development
|
154
|
+
prerelease: false
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '2.4'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 2.4.5
|
143
163
|
- !ruby/object:Gem::Dependency
|
144
164
|
name: fluentd
|
145
165
|
requirement: !ruby/object:Gem::Requirement
|