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 +4 -4
- data/CHANGELOG +4 -0
- data/README.md +1 -1
- data/lib/prometheus_exporter/instrumentation/sidekiq.rb +9 -5
- data/lib/prometheus_exporter/server/puma_collector.rb +5 -0
- data/lib/prometheus_exporter/server/unicorn_collector.rb +5 -0
- data/lib/prometheus_exporter/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: 2ab1a1e0efbea1b4fd2613ae1f733bb693fbfba91373a9687f4e66e1f9d70361
|
4
|
+
data.tar.gz: 0a798a9908fe29500b06fb153270ab413631e781a29e6fc490d40d682b40bcc4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1034d8636dd53f4bd801f957b550a34b03e8179a74341f194b45bc7ec3fddd00ae55817b1668d87d9147ba60d03ad7b401c3f49acb1d03013f9944f60c84c5a4
|
7
|
+
data.tar.gz: 20bf37da5d593f206391f741025b1c010a5cf036f468d391c22feb5e2e998b8ffb55213b948df5491fc3c81bc78398feb66749432fb63283b468aafade1ccb7a
|
data/CHANGELOG
CHANGED
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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
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.
|
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-
|
11
|
+
date: 2019-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rubocop
|