prometheus_exporter 0.1.11 → 0.1.12
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b09dff4a49846230b74243135fcacc1d88b440b04b69e76cf4dce76bd3eaa90
|
4
|
+
data.tar.gz: fb48d9cecb4d0ed600c00c8c8265ec88f4ab8b0e81369adf08eaee478895c337
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777e3913f7fd24cd455af42e6ac1d73b98ef6a803189c43443f2d3d517bf4aa540b3be994d99afbb5060bc83ff83ed42be2037217b14522d848918891d64cb1c
|
7
|
+
data.tar.gz: bcbde54a95042c01a80e297ca6096444574d9e8c1d17027759469e51f4ff36b8b23cf574f6111034233805546e7f7a73e8cc8922b96f787191b4bdb345e8dbfa
|
data/README.md
CHANGED
@@ -155,6 +155,50 @@ Ensure you run the exporter in a monitored background process via
|
|
155
155
|
% bundle exec prometheus_exporter
|
156
156
|
```
|
157
157
|
|
158
|
+
### Custom type collectors
|
159
|
+
|
160
|
+
In some cases you may have custom metrics you want to ship the collector in a batch, in this case you may still be interested in the base collector behavior but would like to add your own special messages.
|
161
|
+
|
162
|
+
```ruby
|
163
|
+
# person_collector.rb
|
164
|
+
class PersonCollector < PrometheusExporter::Server::TypeCollector
|
165
|
+
def initialize
|
166
|
+
@oldies = PrometheusExporter::Metric::Counter.new("oldies", "old people")
|
167
|
+
@youngies = PrometheusExporter::Metric::Counter.new("youngies", "young people")
|
168
|
+
end
|
169
|
+
|
170
|
+
def type
|
171
|
+
"person"
|
172
|
+
end
|
173
|
+
|
174
|
+
def collect(obj)
|
175
|
+
if obj["age"] > 21
|
176
|
+
@oldies.observe(1)
|
177
|
+
else
|
178
|
+
@youngies.observe(1)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
def metrics
|
183
|
+
[@oldies, @youngies]
|
184
|
+
end
|
185
|
+
end
|
186
|
+
```
|
187
|
+
|
188
|
+
Shipping metrics then is done via:
|
189
|
+
|
190
|
+
```
|
191
|
+
PrometheusExporter::Client.default.send_json(type: "person", age: 40)
|
192
|
+
```
|
193
|
+
|
194
|
+
To load the custom collector run:
|
195
|
+
|
196
|
+
|
197
|
+
```
|
198
|
+
bundle exec prometheus_exporter -a person_collector.rb
|
199
|
+
|
200
|
+
```
|
201
|
+
|
158
202
|
### Multi process mode with custom collector
|
159
203
|
|
160
204
|
You can opt for custom collector logic in a multi process environment.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prometheus_exporter
|
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
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-01
|
11
|
+
date: 2018-02-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|