prometheus_exporter 0.4.12 → 0.4.13

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: 675e7d70e60c829a7b7d1a062300f23f37ae4b7ec9c413a59e172c0c244abbbc
4
- data.tar.gz: bdf19d92ec159ede770f0166b658b397f21a63c4b946ec0cdf91af902db1dd1b
3
+ metadata.gz: 2ab1a1e0efbea1b4fd2613ae1f733bb693fbfba91373a9687f4e66e1f9d70361
4
+ data.tar.gz: 0a798a9908fe29500b06fb153270ab413631e781a29e6fc490d40d682b40bcc4
5
5
  SHA512:
6
- metadata.gz: e8072bc72646c5c06e8029605d76fca0e075ec99651ae0c158b4a9989d6d4a43366ca0ef5e4398168718e07f1fde9888d7b8050499ca24da44255d9ca5fccf72
7
- data.tar.gz: 4aba5c0791a2aaed035cf42bc091b58fc4d54619ce4e815c3511e332fbda99779c6e1ee2624e78d0bae10f1e0ce6d911f859f0fe7782b9b46fa726742aa80457
6
+ metadata.gz: 1034d8636dd53f4bd801f957b550a34b03e8179a74341f194b45bc7ec3fddd00ae55817b1668d87d9147ba60d03ad7b401c3f49acb1d03013f9944f60c84c5a4
7
+ data.tar.gz: 20bf37da5d593f206391f741025b1c010a5cf036f468d391c22feb5e2e998b8ffb55213b948df5491fc3c81bc78398feb66749432fb63283b468aafade1ccb7a
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ 0.4.13 - 09-07-2019
2
+
3
+ - Fix: Memory leak in unicorn and puma collectors
4
+
1
5
  0.4.12 - 30-05-2019
2
6
 
3
7
  - Fix: unicorn collector reporting incorrect number of unicorn workers
data/README.md CHANGED
@@ -16,7 +16,7 @@ To learn more see [Instrumenting Rails with Prometheus](https://samsaffron.com/a
16
16
  * [Delayed Job plugin](#delayed-job-plugin)
17
17
  * [Hutch metrics](#hutch-message-processing-tracer)
18
18
  * [Puma metrics](#puma-metrics)
19
- * [Unicorn metrics](#unicorn-metrics)
19
+ * [Unicorn metrics](#unicorn-process-metrics)
20
20
  * [Custom type collectors](#custom-type-collectors)
21
21
  * [Multi process mode with custom collector](#multi-process-mode-with-custom-collector)
22
22
  * [GraphQL support](#graphql-support)
@@ -4,11 +4,15 @@ module PrometheusExporter::Instrumentation
4
4
  class Sidekiq
5
5
  def self.death_handler
6
6
  -> (job, ex) do
7
- PrometheusExporter::Client.default.send_json(
8
- type: "sidekiq",
9
- name: job["class"],
10
- dead: true,
11
- )
7
+ job_is_fire_and_forget = job["retry"] == false
8
+
9
+ unless job_is_fire_and_forget
10
+ PrometheusExporter::Client.default.send_json(
11
+ type: "sidekiq",
12
+ name: job["class"],
13
+ dead: true,
14
+ )
15
+ end
12
16
  end
13
17
  end
14
18
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  module PrometheusExporter::Server
4
4
  class PumaCollector < TypeCollector
5
+ MAX_PUMA_METRIC_AGE = 30
5
6
  PUMA_GAUGES = {
6
7
  workers_total: "Number of puma workers.",
7
8
  booted_workers_total: "Number of puma workers booted.",
@@ -47,6 +48,10 @@ module PrometheusExporter::Server
47
48
  end
48
49
 
49
50
  def collect(obj)
51
+ now = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
52
+
53
+ obj["created_at"] = now
54
+ @puma_metrics.delete_if { |m| m["created_at"] + MAX_PUMA_METRIC_AGE < now }
50
55
  @puma_metrics << obj
51
56
  end
52
57
  end
@@ -3,6 +3,8 @@
3
3
  # custom type collector for prometheus_exporter for handling the metrics sent from
4
4
  # PrometheusExporter::Instrumentation::Unicorn
5
5
  class PrometheusExporter::Server::UnicornCollector < PrometheusExporter::Server::TypeCollector
6
+ MAX_UNICORN_METRIC_AGE = 60
7
+
6
8
  UNICORN_GAUGES = {
7
9
  workers_total: 'Number of unicorn workers.',
8
10
  active_workers_total: 'Number of active unicorn workers',
@@ -36,6 +38,9 @@ class PrometheusExporter::Server::UnicornCollector < PrometheusExporter::Server:
36
38
  end
37
39
 
38
40
  def collect(obj)
41
+ now = ::Process.clock_gettime(::Process::CLOCK_MONOTONIC)
42
+ obj["created_at"] = now
43
+ @unicorn_metrics.delete_if { |m| m['created_at'] + MAX_UNICORN_METRIC_AGE < now }
39
44
  @unicorn_metrics << obj
40
45
  end
41
46
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module PrometheusExporter
4
- VERSION = "0.4.12"
4
+ VERSION = "0.4.13"
5
5
  end
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.4.12
4
+ version: 0.4.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Saffron
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-30 00:00:00.000000000 Z
11
+ date: 2019-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop