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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: acb581fece1b2ca0364e8b7f3fee2893c15d788f022377c23ba810a71276beb7
4
- data.tar.gz: 68d38aa49e35ef1c63e6f214ff271daca6650dfa5bffb1d628eb0f429b5d6219
3
+ metadata.gz: 5d6f60f666c3e162c85ca9a275a74dd74dc2219230950d18a0ecf08cffa5761a
4
+ data.tar.gz: 2c78c20413ca658e6f2341999bfe42fc1600028978ab134ea10f0b0bed5ac44c
5
5
  SHA512:
6
- metadata.gz: b46f7d61a4ec984478e0fbc062ebb14dc48899a2c004dc23c1446a69f2d095e5614f4eb6fedc0a7d6f264318ea84ce2f12a69b99bff643c18b0b2ef35b13fa8d
7
- data.tar.gz: a836860985fc1753ca0b116a9d929562c8b24fd9ba474043c178e2dfa26dd59caf64106ce96a3b508762560c88d5ea39fb74f72d63559f91fab425e79c1869e1
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
- # Run one iteration of the process monitor.
71
- def run_once
72
- metrics = self.metrics
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
@@ -9,7 +9,7 @@ module Async
9
9
  module Service
10
10
  # @namespace
11
11
  module Supervisor
12
- VERSION = "0.15.0"
12
+ VERSION = "0.16.0"
13
13
  end
14
14
  end
15
15
  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
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-service-supervisor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file