yabeda-prometheus 0.7.0 → 0.8.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c36a4a73e4e698126e81bf8cb5069de6521ac396742a59dc13a906b2e6470f12
4
- data.tar.gz: 67b7b8d5d56cff197c47bbac7b27d9a3eefe3cbbc1f63a01d8d35d2d4cd97305
3
+ metadata.gz: 03ed652a9c06383f38442a04db2ed423b0bf5c2bad99a0e34da5d965ed988ced
4
+ data.tar.gz: ec9f84a17b4f8b773a57985fe61cc4f6a0a4a67e4216f36683a0b8d5e6f95671
5
5
  SHA512:
6
- metadata.gz: 25eae376eda44fd094891a717efaf877bd629b7ae9fcb0867ecf146fd0ea70e1afc7df3d24f8e615c4be11081004719de67bbfd89cacdeb011e51d74a331f1b4
7
- data.tar.gz: 7184e70ea9a35daaf7b29e4fc8e2f9fd18e6b89679d1a4ebcb97722e359853e5723ace3a17cc3fb4a132947f758f2a4e88ccd6a8fe30bd7b48ff5d0872d46de4
6
+ metadata.gz: 45f454d796db3b1202bc238aadb4bb744686ddffe4efbf328ac172d3eeea6c21614a643d21ae49b971ca43eee0ad29b5ebb636773ebce0cd643620b3f99646f6
7
+ data.tar.gz: 1300508ed83ecefa768fb7ae6a8de08534eae83b2834fa9bf3577e77897ef7efb1a8ad5dfab88af92a1ba6c96caec9412dd14d48a1aa8938749bdfdaa17a5853
data/CHANGELOG.md CHANGED
@@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 0.8.0 - 2021-12-30
11
+
12
+ ### Added
13
+
14
+ - Ability to specify a logger instance for exporter web server. [@palkan], [#19](https://github.com/yabeda-rb/yabeda-prometheus/pull/19)
15
+ - Ability to specify Prometheus instance value for push gateway. [@ollym], [#20](https://github.com/yabeda-rb/yabeda-prometheus/pull/20)
16
+
17
+ ### Changed
18
+
19
+ - Logging is disabled by default for exporter web server. [@palkan], [#19](https://github.com/yabeda-rb/yabeda-prometheus/pull/19)
20
+
10
21
  ## 0.7.0 - 2021-07-21
11
22
 
12
23
  ### Added
@@ -128,3 +139,5 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
128
139
  [@alexander37137]: https://github.com/alexander37137 "Alexander Andreev"
129
140
  [@baarkerlounger]: https://github.com/baarkerlounger "Daniel Baark"
130
141
  [@dsalahutdinov]: https://github.com/dsalahutdinov "Dmitry Salahutdinov"
142
+ [@palkan]: https://github.com/palkan "Vladimir Dementyev"
143
+ [@ollym]: https://github.com/ollym "Oliver Morgan"
data/README.md CHANGED
@@ -94,6 +94,13 @@ end
94
94
 
95
95
  These are only enabled in debug mode. See [Yabeda debugging metrics](https://github.com/yabeda-rb/yabeda#debugging-metrics) on how to enable it (e.g. by specifying `YABEDA_DEBUG=true` in your environment variables).
96
96
 
97
+ ## Exporter logs
98
+
99
+ By default, exporter web server logs are disabled. For example, you can plug in a Rails logger:
100
+
101
+ ```ruby
102
+ Yabeda::Prometheus::Exporter.start_metrics_server! logger: Rails.application.logger
103
+ ```
97
104
  ## Development
98
105
 
99
106
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -18,11 +18,11 @@ module Yabeda
18
18
  @app.call(env)
19
19
  end
20
20
 
21
- def start_metrics_server!
21
+ def start_metrics_server!(**rack_app_options)
22
22
  Thread.new do
23
23
  default_port = ENV.fetch("PORT", 9394)
24
24
  ::Rack::Handler::WEBrick.run(
25
- rack_app,
25
+ rack_app(**rack_app_options),
26
26
  Host: ENV["PROMETHEUS_EXPORTER_BIND"] || "0.0.0.0",
27
27
  Port: ENV.fetch("PROMETHEUS_EXPORTER_PORT", default_port),
28
28
  AccessLog: [],
@@ -30,9 +30,9 @@ module Yabeda
30
30
  end
31
31
  end
32
32
 
33
- def rack_app(exporter = self, path: "/metrics")
33
+ def rack_app(exporter = self, path: "/metrics", logger: Logger.new(IO::NULL))
34
34
  ::Rack::Builder.new do
35
- use ::Rack::CommonLogger
35
+ use ::Rack::CommonLogger, logger
36
36
  use ::Rack::ShowExceptions
37
37
  use exporter, path: path
38
38
  run NOT_FOUND_HANDLER
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Yabeda
4
4
  module Prometheus
5
- VERSION = "0.7.0"
5
+ VERSION = "0.8.0"
6
6
  end
7
7
  end
@@ -18,7 +18,7 @@ module Yabeda
18
18
  @push_gateway ||= begin
19
19
  ::Prometheus::Client::Push.new(
20
20
  ENV.fetch("PROMETHEUS_JOB_NAME", "yabeda"),
21
- nil,
21
+ ENV["PROMETHEUS_INSTANCE"],
22
22
  ENV.fetch("PROMETHEUS_PUSH_GATEWAY", "http://localhost:9091"),
23
23
  ).tap do |gateway|
24
24
  http = gateway.instance_variable_get(:@http)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yabeda-prometheus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Novikov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-07-21 00:00:00.000000000 Z
11
+ date: 2021-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: prometheus-client