async-service-supervisor 0.19.0 → 0.20.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/utilization_monitor.rb +38 -25
- data/lib/async/service/supervisor/version.rb +1 -1
- data/readme.md +4 -7
- 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: fb8f5a6980d5ea448b4e4ec8826590167195c4fc31c3d40d2ba3e79e118bc270
|
|
4
|
+
data.tar.gz: 47bf75e14cfb55cba7007b50cea7029151bd6c265ebf8d0547340b4e53b58a14
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 02b8bb2dada453bc5b96f48ae2608cd655c5eb0cfe22568c9aacd68efe798fcc25a3c652d7cfe94cdcf144676c7aa5d4a12b92f3f91ba6d0d419a2154c296991
|
|
7
|
+
data.tar.gz: 547604201a8a872e1498773e3ef6e472ed5a4970b5781c9fd6638802095e732d23bf5049332a8bb9d1cfdab0699421d50a52abff2f3ecc701a1d2366c5acadb8
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -281,35 +281,48 @@ module Async
|
|
|
281
281
|
#
|
|
282
282
|
# @returns [Hash] Hash mapping service names to aggregated utilization metrics.
|
|
283
283
|
def sample
|
|
284
|
-
|
|
285
|
-
|
|
284
|
+
aggregated = {}
|
|
285
|
+
|
|
286
|
+
sample_by_worker.each_value do |worker|
|
|
287
|
+
service_name = worker[:state][:name] || "unknown"
|
|
286
288
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
else
|
|
302
|
-
# For non-numeric values, we could handle differently
|
|
303
|
-
# For now, just store the last value
|
|
304
|
-
aggregated[service_name][key] = value
|
|
305
|
-
end
|
|
289
|
+
data = worker[:utilization]
|
|
290
|
+
|
|
291
|
+
# Initialize service aggregation if needed
|
|
292
|
+
aggregated[service_name] ||= {}
|
|
293
|
+
|
|
294
|
+
# Sum up all numeric fields
|
|
295
|
+
data.each do |key, value|
|
|
296
|
+
if value.is_a?(Numeric)
|
|
297
|
+
aggregated[service_name][key] ||= 0
|
|
298
|
+
aggregated[service_name][key] += value
|
|
299
|
+
else
|
|
300
|
+
# For non-numeric values, we could handle differently
|
|
301
|
+
# For now, just store the last value
|
|
302
|
+
aggregated[service_name][key] = value
|
|
306
303
|
end
|
|
307
|
-
|
|
308
|
-
# Count workers per service (for utilization denominator)
|
|
309
|
-
aggregated[service_name][:worker_count] = (aggregated[service_name][:worker_count] || 0) + 1
|
|
310
304
|
end
|
|
311
305
|
|
|
312
|
-
|
|
306
|
+
# Count workers per service (for utilization denominator)
|
|
307
|
+
aggregated[service_name][:worker_count] = (aggregated[service_name][:worker_count] || 0) + 1
|
|
308
|
+
end
|
|
309
|
+
|
|
310
|
+
aggregated
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
# Sample utilization data for each registered worker.
|
|
314
|
+
#
|
|
315
|
+
# @returns [Hash] An immutable hash keyed by worker ID, with supervisor state and utilization values.
|
|
316
|
+
def sample_by_worker
|
|
317
|
+
@guard.synchronize do
|
|
318
|
+
@workers.each_with_object({}) do |(worker_id, supervisor_controller), workers|
|
|
319
|
+
if utilization = @allocator.read(worker_id)
|
|
320
|
+
workers[worker_id] = {
|
|
321
|
+
state: supervisor_controller.state.dup.freeze,
|
|
322
|
+
utilization: utilization.freeze,
|
|
323
|
+
}.freeze
|
|
324
|
+
end
|
|
325
|
+
end.freeze
|
|
313
326
|
end
|
|
314
327
|
end
|
|
315
328
|
|
data/readme.md
CHANGED
|
@@ -30,6 +30,10 @@ Please see the [project documentation](https://socketry.github.io/async-service-
|
|
|
30
30
|
|
|
31
31
|
Please see the [project releases](https://socketry.github.io/async-service-supervisor/releases/index) for all releases.
|
|
32
32
|
|
|
33
|
+
### v0.20.0
|
|
34
|
+
|
|
35
|
+
- Add per-worker snapshots to `Async::Service::Supervisor::UtilizationMonitor`.
|
|
36
|
+
|
|
33
37
|
### v0.18.0
|
|
34
38
|
|
|
35
39
|
- Allow supervised services to merge additional worker state during preparation and worker construction.
|
|
@@ -68,13 +72,6 @@ Please see the [project releases](https://socketry.github.io/async-service-super
|
|
|
68
72
|
- Add `state` parameter to `Worker#initialize` to allow workers to provide state during registration.
|
|
69
73
|
- State is now accessible via `supervisor_controller.state` instead of `connection.state` (as it was in `Async::Container::Supervisor`).
|
|
70
74
|
|
|
71
|
-
### v0.10.0
|
|
72
|
-
|
|
73
|
-
- Serialize `register`/`remove` and `check!` operations in `MemoryMonitor` to prevent race conditions.
|
|
74
|
-
- Remove `memory_sample` functionality - it wasn't very useful and added a lot of complexity.
|
|
75
|
-
- Add support for `Memory::Leak::Cluster` `free_size_minimum:` option.
|
|
76
|
-
- Remove extraneous "Memory leak detected\!" logs.
|
|
77
|
-
|
|
78
75
|
## Contributing
|
|
79
76
|
|
|
80
77
|
We welcome contributions to this project.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|