gruf-prometheus 1.1.0 → 1.2.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/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/gruf/prometheus/collector.rb +0 -4
- data/lib/gruf/prometheus/configuration.rb +3 -1
- data/lib/gruf/prometheus/hook.rb +21 -0
- data/lib/gruf/prometheus/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: df1faaee21e1065478281be50074bd940e032f504dec8d6a96c6782924333351
|
4
|
+
data.tar.gz: '08156327334040cfbcc2edde0f54ad8b99a9832922facdee4edf7ec8940d821e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d5b9b609394f12d2f2380088bd61c1fcba5ae6fcc6ff638c9d8f059deec9994e1f8776b8adf642604a74c03a71312a76959cbf3bbb2f0814f9403a1d3dd80b41
|
7
|
+
data.tar.gz: e502778428e5e923180a8de75d252d7e9a470c38fe37fff65e26a9d9e183910de4209271a6ec2de2e441b892c52e70a1912a413d042872efd7fe768f62580732
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -33,6 +33,8 @@ You can further configure via bc-prometheus-ruby with:
|
|
33
33
|
| process_label | The label to use for metric prefixing | grpc |
|
34
34
|
| process_name | Label to use for process name in logging | grpc |
|
35
35
|
| collection_frequency | The period in seconds in which to collect metrics | 30 |
|
36
|
+
| collectors | Any collectors you would like to start with the server. Passed as a hash of collector class => options | {} |
|
37
|
+
| type_collectors | Any type collectors you would like to start with the server. Passed as an array of collector objects | [] |
|
36
38
|
|
37
39
|
## License
|
38
40
|
|
data/lib/gruf/prometheus/hook.rb
CHANGED
@@ -30,6 +30,9 @@ module Gruf
|
|
30
30
|
logger.info "[gruf-prometheus][#{::Gruf::Prometheus.process_name}] Starting #{server.class}"
|
31
31
|
prometheus_server.add_type_collector(::Gruf::Prometheus::TypeCollector.new)
|
32
32
|
prometheus_server.add_type_collector(::PrometheusExporter::Server::ActiveRecordCollector.new)
|
33
|
+
custom_type_collectors.each do |tc|
|
34
|
+
prometheus_server.add_type_collector(tc)
|
35
|
+
end
|
33
36
|
prometheus_server.start
|
34
37
|
sleep 2 unless ENV['RACK_ENV'] == 'test' # wait for server to come online
|
35
38
|
start_collectors(server: server)
|
@@ -62,9 +65,13 @@ module Gruf
|
|
62
65
|
options: {
|
63
66
|
server: server
|
64
67
|
},
|
68
|
+
type: 'grpc',
|
65
69
|
client: ::Bigcommerce::Prometheus.client,
|
66
70
|
frequency: ::Gruf::Prometheus.collection_frequency
|
67
71
|
)
|
72
|
+
custom_collectors.each do |collector, arguments|
|
73
|
+
collector.start(arguments)
|
74
|
+
end
|
68
75
|
end
|
69
76
|
|
70
77
|
##
|
@@ -87,6 +94,20 @@ module Gruf
|
|
87
94
|
logger: logger
|
88
95
|
)
|
89
96
|
end
|
97
|
+
|
98
|
+
##
|
99
|
+
# @return [Array<Bigcommerce::Prometheus::TypeCollectors::Base>]
|
100
|
+
#
|
101
|
+
def custom_type_collectors
|
102
|
+
@options.fetch(:type_collectors, [])
|
103
|
+
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# @return [Array<Bigcommerce::Prometheus::Collectors::Base>]
|
107
|
+
#
|
108
|
+
def custom_collectors
|
109
|
+
@options.fetch(:collectors, [])
|
110
|
+
end
|
90
111
|
end
|
91
112
|
end
|
92
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gruf-prometheus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shaun McCormick
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|