async-service-supervisor 0.15.0 → 0.16.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
- checksums.yaml.gz.sig +0 -0
- data/lib/async/service/supervisor/monitor.rb +9 -0
- data/lib/async/service/supervisor/process_monitor.rb +9 -4
- data/lib/async/service/supervisor/version.rb +1 -1
- data/readme.md +4 -5
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d6f60f666c3e162c85ca9a275a74dd74dc2219230950d18a0ecf08cffa5761a
|
|
4
|
+
data.tar.gz: 2c78c20413ca658e6f2341999bfe42fc1600028978ab134ea10f0b0bed5ac44c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c4f862fdaeef651d0b736381340277720b987ac70a3f2e32481a636c638a251f30f5340da9f9789938eb4c7e25b9188b1e3f83c86ae0846f2620d23c9e69365f
|
|
7
|
+
data.tar.gz: 59291a5fe82bd9dbd2b42ef041b2cde87648666c787c99c90725b88576c0484e759c11fdd6a23ce8d58ce4666f6d21e9258065a2af870f040ab74cbccf15d50a
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -8,11 +8,20 @@ require "async/loop"
|
|
|
8
8
|
module Async
|
|
9
9
|
module Service
|
|
10
10
|
module Supervisor
|
|
11
|
+
# Base class for supervisor monitors that run periodically within the supervisor process.
|
|
12
|
+
#
|
|
13
|
+
# Subclasses should override {#run_once} to implement specific monitoring logic.
|
|
11
14
|
class Monitor
|
|
15
|
+
# Initialize a new monitor.
|
|
16
|
+
#
|
|
17
|
+
# @parameter interval [Numeric] The interval in seconds between each invocation of {#run_once}.
|
|
12
18
|
def initialize(interval: 1.0)
|
|
13
19
|
@interval = interval
|
|
14
20
|
end
|
|
15
21
|
|
|
22
|
+
# Serialize the monitor state for JSON representation.
|
|
23
|
+
#
|
|
24
|
+
# @returns [Hash] An empty hash by default; subclasses should override to include relevant state.
|
|
16
25
|
def as_json(...)
|
|
17
26
|
{}
|
|
18
27
|
end
|
|
@@ -67,15 +67,20 @@ module Async
|
|
|
67
67
|
{ppid: @ppid, metrics: self.metrics}
|
|
68
68
|
end
|
|
69
69
|
|
|
70
|
-
#
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
70
|
+
# Emit the process metrics.
|
|
71
|
+
#
|
|
72
|
+
# @parameter metrics [Hash] The process metrics to emit.
|
|
73
|
+
def emit(metrics)
|
|
74
74
|
# Log each process individually for better searchability in log platforms:
|
|
75
75
|
metrics.each do |process_id, general|
|
|
76
76
|
Console.info(self, "Process metrics captured.", general: general)
|
|
77
77
|
end
|
|
78
78
|
end
|
|
79
|
+
|
|
80
|
+
# Run one iteration of the process monitor.
|
|
81
|
+
def run_once
|
|
82
|
+
self.emit(self.metrics)
|
|
83
|
+
end
|
|
79
84
|
end
|
|
80
85
|
end
|
|
81
86
|
end
|
data/readme.md
CHANGED
|
@@ -28,6 +28,10 @@ Please see the [project documentation](https://socketry.github.io/async-service-
|
|
|
28
28
|
|
|
29
29
|
Please see the [project releases](https://socketry.github.io/async-service-supervisor/releases/index) for all releases.
|
|
30
30
|
|
|
31
|
+
### v0.16.0
|
|
32
|
+
|
|
33
|
+
- Add `ProcessMonitor#emit(metrics)` as an override point for subclasses to consume captured process metrics (e.g. emitting StatsD gauges).
|
|
34
|
+
|
|
31
35
|
### v0.15.0
|
|
32
36
|
|
|
33
37
|
- Improve robustness and error handling of default monitors and server loop, ensuring that monitor failures either completely crash the server or retry appropriately, rather than leaving the server in a broken state.
|
|
@@ -72,11 +76,6 @@ Please see the [project releases](https://socketry.github.io/async-service-super
|
|
|
72
76
|
- Disable memory sampler by default and use text output format.
|
|
73
77
|
- Introduce support for redirecting dump output to logs.
|
|
74
78
|
|
|
75
|
-
### v0.8.0
|
|
76
|
-
|
|
77
|
-
- Add `Async::Service::Supervisor::ProcessMonitor` for logging CPU and memory metrics periodically.
|
|
78
|
-
- Fix documentation to use correct `maximum_size_limit:` parameter name for `MemoryMonitor` (was incorrectly documented as `limit:`).
|
|
79
|
-
|
|
80
79
|
## Contributing
|
|
81
80
|
|
|
82
81
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Releases
|
|
2
2
|
|
|
3
|
+
## v0.16.0
|
|
4
|
+
|
|
5
|
+
- Add `ProcessMonitor#emit(metrics)` as an override point for subclasses to consume captured process metrics (e.g. emitting StatsD gauges).
|
|
6
|
+
|
|
3
7
|
## v0.15.0
|
|
4
8
|
|
|
5
9
|
- Improve robustness and error handling of default monitors and server loop, ensuring that monitor failures either completely crash the server or retry appropriately, rather than leaving the server in a broken state.
|
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|