visionary-sdk 0.6.0 → 0.7.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
- data/README.md +4 -3
- data/lib/visionary/profiler.rb +9 -6
- data/lib/visionary/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: 2901c8417cdf340ca0f964c83a822e48604aacc975d9dee28f8b2f001d360f29
|
|
4
|
+
data.tar.gz: '08813447808f1203aa991ce8aad1b240e647873b9a7136f4b366435d820df20a'
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e8e1a1b3106edd9a8dca26981fba7533a97efddfd7600e4d4eb6388a9a8495c95e1b941659891aac59abd740cacfaded2dde57da831424e11644fcaf3fbf6625
|
|
7
|
+
data.tar.gz: b29b98ed8359c61738ec077382b5a5d1c9a7e0222ba78efcc653bdfd13609235e60a2c4d0d54fff73b086ce07e4c0b4e7dff426636077eb66546955b4dadd695
|
data/README.md
CHANGED
|
@@ -186,9 +186,10 @@ profile:
|
|
|
186
186
|
- `routes`: the milliseconds that the requests finishing during the profile
|
|
187
187
|
took, per `METHOD route`.
|
|
188
188
|
|
|
189
|
-
A turn is skipped when no request arrived since the last one. A
|
|
190
|
-
dropped when
|
|
191
|
-
|
|
189
|
+
A turn is skipped when no request arrived since the last one. A scheduled
|
|
190
|
+
profile is dropped when it has fewer than 20 samples (about 200 ms of CPU), and
|
|
191
|
+
kept otherwise even when no request finished during it (`routes` is then
|
|
192
|
+
`{}`). A **Profile now** one is kept with any samples.
|
|
192
193
|
|
|
193
194
|
**Cost:** nothing while profiling is off apart from the settings read every
|
|
194
195
|
30 s. While a profile runs, the sampler takes some tens of stack walks per
|
data/lib/visionary/profiler.rb
CHANGED
|
@@ -8,8 +8,11 @@ module Visionary
|
|
|
8
8
|
# Profiling, kept in visionary_settings). One background thread reads the
|
|
9
9
|
# settings every 30 s and, while profiling is on, samples the stacks of the
|
|
10
10
|
# threads that are running every 10 ms for profile.duration_ms every
|
|
11
|
-
# profile.interval_s
|
|
12
|
-
#
|
|
11
|
+
# profile.interval_s, skipping a turn when no request arrived since the
|
|
12
|
+
# last. A scheduled profile is kept with at least MIN_SAMPLES samples, a
|
|
13
|
+
# "Profile now" one with any, whether or not a request finished while it
|
|
14
|
+
# ran. Each profile is one profiles row: folded stacks plus the time each
|
|
15
|
+
# route's requests took while it ran ({} when none finished).
|
|
13
16
|
#
|
|
14
17
|
# Ruby has no CPU-time sampler without a native extension, so this walks
|
|
15
18
|
# Thread.list and keeps the threads whose status is "run". Threads that
|
|
@@ -412,8 +415,8 @@ module Visionary
|
|
|
412
415
|
end
|
|
413
416
|
|
|
414
417
|
# Samples for duration_ms and queues the profile. Returns the row, or
|
|
415
|
-
# nil when it was dropped (
|
|
416
|
-
def capture
|
|
418
|
+
# nil when it was dropped (fewer than min_samples, or cut short by close).
|
|
419
|
+
def capture(min_samples = MIN_SAMPLES)
|
|
417
420
|
@last_started = Tally.started
|
|
418
421
|
duration_s = @settings.duration_ms / 1000.0
|
|
419
422
|
counts = Hash.new(0)
|
|
@@ -448,7 +451,7 @@ module Visionary
|
|
|
448
451
|
elapsed_ms = ((mono - t0) * 1000).round(3)
|
|
449
452
|
folded, samples = Profiler.fold(counts)
|
|
450
453
|
routes = busy.transform_values { |ms| [ms.round, 1].max }
|
|
451
|
-
return nil if samples <
|
|
454
|
+
return nil if samples < min_samples || stopped?
|
|
452
455
|
|
|
453
456
|
row = [Visionary.timestamp(started_at), @cfg.service, @instance, @cfg.version, "ruby",
|
|
454
457
|
elapsed_ms, samples, JSON.generate(routes), folded]
|
|
@@ -478,7 +481,7 @@ module Visionary
|
|
|
478
481
|
next_poll = mono + POLL_S
|
|
479
482
|
if poll
|
|
480
483
|
@logger.info("visionary: taking a CPU profile now (asked for in the dashboard)")
|
|
481
|
-
capture
|
|
484
|
+
capture(1)
|
|
482
485
|
next_profile = mono + @settings.interval_s if next_profile
|
|
483
486
|
end
|
|
484
487
|
end
|
data/lib/visionary/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: visionary-sdk
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.7.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- styropyr0
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-10-
|
|
11
|
+
date: 2026-10-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: |
|
|
14
14
|
The Ruby collector for Visionary. A Rack middleware (with a Railtie for Rails)
|