runtime_analysis 1.0.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 +7 -0
- data/CHANGELOG.md +115 -0
- data/LICENSE.txt +96 -0
- data/README.md +164 -0
- data/editor/nvim/README.md +278 -0
- data/editor/nvim/lua/runtime_analysis/connected.lua +565 -0
- data/editor/nvim/lua/runtime_analysis/go_to_class.lua +63 -0
- data/editor/nvim/lua/runtime_analysis/inline.lua +138 -0
- data/editor/nvim/lua/runtime_analysis/lens.lua +50 -0
- data/editor/nvim/lua/runtime_analysis/lsp.lua +92 -0
- data/editor/nvim/lua/runtime_analysis/menu.lua +98 -0
- data/editor/nvim/lua/runtime_analysis/preview.lua +70 -0
- data/editor/nvim/lua/runtime_analysis/project.lua +28 -0
- data/editor/nvim/lua/runtime_analysis/rerun.lua +39 -0
- data/editor/nvim/lua/runtime_analysis/text.lua +23 -0
- data/editor/nvim/lua/runtime_analysis/value_popup.lua +45 -0
- data/editor/nvim/plugin/runtime_analysis.lua +71 -0
- data/examples/trackers/PROMPT.md +86 -0
- data/examples/trackers/honeybadger.rb +19 -0
- data/examples/trackers/sentry.rb +16 -0
- data/ext/runtime_analysis/extconf.rb +68 -0
- data/ext/runtime_analysis/fast.c +775 -0
- data/ext/runtime_analysis/fast.h +59 -0
- data/ext/runtime_analysis/hold.c +560 -0
- data/ext/runtime_analysis/init.c +36 -0
- data/ext/runtime_analysis/names.c +78 -0
- data/ext/runtime_analysis/names.h +28 -0
- data/ext/runtime_analysis/novelty.c +139 -0
- data/ext/runtime_analysis/novelty.h +22 -0
- data/ext/runtime_analysis/os.c +73 -0
- data/ext/runtime_analysis/os.h +32 -0
- data/ext/runtime_analysis/ring.c +445 -0
- data/ext/runtime_analysis/rows.c +304 -0
- data/ext/runtime_analysis/sink.c +485 -0
- data/ext/runtime_analysis/sink.h +240 -0
- data/ext/runtime_analysis/state.c +254 -0
- data/ext/runtime_analysis/state.h +57 -0
- data/ext/runtime_analysis/wrapper.c +278 -0
- data/ext/runtime_analysis/wrapper.h +24 -0
- data/lib/runtime_analysis/errors.rb +34 -0
- data/lib/runtime_analysis/failsafe.rb +123 -0
- data/lib/runtime_analysis/host/controller_entry_point.rb +18 -0
- data/lib/runtime_analysis/host/declared.rb +152 -0
- data/lib/runtime_analysis/host/inject.rb +90 -0
- data/lib/runtime_analysis/host/job_runners.rb +27 -0
- data/lib/runtime_analysis/host/middleware.rb +23 -0
- data/lib/runtime_analysis/host/minitest_integration.rb +22 -0
- data/lib/runtime_analysis/host/railtie.rb +42 -0
- data/lib/runtime_analysis/host/reports.rb +54 -0
- data/lib/runtime_analysis/host/rspec_integration.rb +17 -0
- data/lib/runtime_analysis/host/web.rb +22 -0
- data/lib/runtime_analysis/host.rb +34 -0
- data/lib/runtime_analysis/inject.rb +5 -0
- data/lib/runtime_analysis/minitest.rb +9 -0
- data/lib/runtime_analysis/native/build.rb +17 -0
- data/lib/runtime_analysis/native/byte_size.rb +27 -0
- data/lib/runtime_analysis/native/call_site_logger/definitions.rb +51 -0
- data/lib/runtime_analysis/native/call_site_logger/held.rb +35 -0
- data/lib/runtime_analysis/native/call_site_logger/rows.rb +110 -0
- data/lib/runtime_analysis/native/call_site_logger/segments.rb +100 -0
- data/lib/runtime_analysis/native/call_site_logger/streams.rb +110 -0
- data/lib/runtime_analysis/native/call_site_logger.rb +80 -0
- data/lib/runtime_analysis/native/rotation_policy.rb +28 -0
- data/lib/runtime_analysis/native/sanitizer_runtime.rb +50 -0
- data/lib/runtime_analysis/native/sink.rb +12 -0
- data/lib/runtime_analysis/native.rb +74 -0
- data/lib/runtime_analysis/platform.rb +30 -0
- data/lib/runtime_analysis/query/index/anonymise.rb +98 -0
- data/lib/runtime_analysis/query/index/graph.rb +107 -0
- data/lib/runtime_analysis/query/index/graph_cache.rb +32 -0
- data/lib/runtime_analysis/query/index/reading/declared.rb +42 -0
- data/lib/runtime_analysis/query/index/reading/dict.rb +43 -0
- data/lib/runtime_analysis/query/index/reading/frame.rb +27 -0
- data/lib/runtime_analysis/query/index/reading/node.rb +45 -0
- data/lib/runtime_analysis/query/index/reading/path.rb +21 -0
- data/lib/runtime_analysis/query/index/reading/reruns.rb +30 -0
- data/lib/runtime_analysis/query/index/reading/rows.rb +128 -0
- data/lib/runtime_analysis/query/index/reading/stream.rb +82 -0
- data/lib/runtime_analysis/query/index/reading/tree.rb +66 -0
- data/lib/runtime_analysis/query/index/reading/tree_builder.rb +135 -0
- data/lib/runtime_analysis/query/index/reading/values.rb +49 -0
- data/lib/runtime_analysis/query/index/reading.rb +80 -0
- data/lib/runtime_analysis/query/index/shapes.rb +142 -0
- data/lib/runtime_analysis/query/index/signatures/active_support.rb +31 -0
- data/lib/runtime_analysis/query/index/signatures/core.json +1 -0
- data/lib/runtime_analysis/query/index/signatures/layers.rb +29 -0
- data/lib/runtime_analysis/query/index/signatures/lineage.rb +57 -0
- data/lib/runtime_analysis/query/index/signatures/overloads.rb +32 -0
- data/lib/runtime_analysis/query/index/signatures/rbs/entry.rb +95 -0
- data/lib/runtime_analysis/query/index/signatures/rbs/export.rb +76 -0
- data/lib/runtime_analysis/query/index/signatures/rbs/library.rb +43 -0
- data/lib/runtime_analysis/query/index/signatures/rbs/overload.rb +66 -0
- data/lib/runtime_analysis/query/index/signatures/rbs/project.rb +69 -0
- data/lib/runtime_analysis/query/index/signatures/rbs/types.rb +79 -0
- data/lib/runtime_analysis/query/index/signatures/rbs.rb +57 -0
- data/lib/runtime_analysis/query/index/signatures/sorbet/sig.rb +48 -0
- data/lib/runtime_analysis/query/index/signatures/sorbet/signed.rb +69 -0
- data/lib/runtime_analysis/query/index/signatures/sorbet/table.rb +43 -0
- data/lib/runtime_analysis/query/index/signatures/sorbet/types.rb +96 -0
- data/lib/runtime_analysis/query/index/signatures/sorbet.rb +150 -0
- data/lib/runtime_analysis/query/index/signatures/sources.rb +80 -0
- data/lib/runtime_analysis/query/index/signatures/written.rb +45 -0
- data/lib/runtime_analysis/query/index/signatures.rb +93 -0
- data/lib/runtime_analysis/query/index/source_named_graph.rb +84 -0
- data/lib/runtime_analysis/query/index/static/change_set.rb +20 -0
- data/lib/runtime_analysis/query/index/static/changes.rb +80 -0
- data/lib/runtime_analysis/query/index/static/code_visitor.rb +144 -0
- data/lib/runtime_analysis/query/index/static/klass.rb +13 -0
- data/lib/runtime_analysis/query/index/static/method.rb +19 -0
- data/lib/runtime_analysis/query/index/static/params.rb +52 -0
- data/lib/runtime_analysis/query/index/static/source.rb +69 -0
- data/lib/runtime_analysis/query/index/static/stub.rb +14 -0
- data/lib/runtime_analysis/query/index/static/stub_visitor.rb +133 -0
- data/lib/runtime_analysis/query/index/static/value.rb +17 -0
- data/lib/runtime_analysis/query/index/static/values.rb +71 -0
- data/lib/runtime_analysis/query/index/static/visibility.rb +40 -0
- data/lib/runtime_analysis/query/index/static.rb +85 -0
- data/lib/runtime_analysis/query/index.rb +32 -0
- data/lib/runtime_analysis/query/nodes.rb +60 -0
- data/lib/runtime_analysis/query/project/config.rb +108 -0
- data/lib/runtime_analysis/query/project.rb +40 -0
- data/lib/runtime_analysis/query/report/document.rb +84 -0
- data/lib/runtime_analysis/query/report/finding.rb +15 -0
- data/lib/runtime_analysis/query/report/json_renderer.rb +51 -0
- data/lib/runtime_analysis/query/report/list.rb +15 -0
- data/lib/runtime_analysis/query/report/location.rb +14 -0
- data/lib/runtime_analysis/query/report/one_row.rb +14 -0
- data/lib/runtime_analysis/query/report/outline.rb +15 -0
- data/lib/runtime_analysis/query/report/paint.rb +34 -0
- data/lib/runtime_analysis/query/report/related.rb +11 -0
- data/lib/runtime_analysis/query/report/table.rb +15 -0
- data/lib/runtime_analysis/query/report/text.rb +13 -0
- data/lib/runtime_analysis/query/report/text_renderer.rb +102 -0
- data/lib/runtime_analysis/query/report.rb +35 -0
- data/lib/runtime_analysis/query/surfaces/class_value.rb +17 -0
- data/lib/runtime_analysis/query/surfaces/cli/answer.rb +32 -0
- data/lib/runtime_analysis/query/surfaces/cli/command_line.rb +77 -0
- data/lib/runtime_analysis/query/surfaces/cli/usage.rb +32 -0
- data/lib/runtime_analysis/query/surfaces/cli.rb +101 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/lexical.rb +44 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/notation.rb +33 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/observed.rb +102 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/outline.rb +111 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/rbs_file.rb +100 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/rbs_member.rb +50 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/rbs_notation.rb +44 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/seen.rb +74 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/sig_text.rb +49 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/sorbet_edit.rb +106 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/sorbet_notation.rb +48 -0
- data/lib/runtime_analysis/query/surfaces/crystallise/subject.rb +55 -0
- data/lib/runtime_analysis/query/surfaces/crystallise.rb +94 -0
- data/lib/runtime_analysis/query/surfaces/mcp.rb +89 -0
- data/lib/runtime_analysis/query/surfaces/record/commands.rb +45 -0
- data/lib/runtime_analysis/query/surfaces/record/environment.rb +48 -0
- data/lib/runtime_analysis/query/surfaces/record/ignore.rb +62 -0
- data/lib/runtime_analysis/query/surfaces/record/question.rb +55 -0
- data/lib/runtime_analysis/query/surfaces/record/run.rb +30 -0
- data/lib/runtime_analysis/query/surfaces/record.rb +122 -0
- data/lib/runtime_analysis/query/surfaces/rerun.rb +87 -0
- data/lib/runtime_analysis/query/surfaces/setup/agents.rb +76 -0
- data/lib/runtime_analysis/query/surfaces/setup/changes.rb +107 -0
- data/lib/runtime_analysis/query/surfaces/setup/project.rb +80 -0
- data/lib/runtime_analysis/query/surfaces/setup/steps.md +205 -0
- data/lib/runtime_analysis/query/surfaces/setup.rb +98 -0
- data/lib/runtime_analysis/query/surfaces.rb +14 -0
- data/lib/runtime_analysis/query/tools/base.rb +86 -0
- data/lib/runtime_analysis/query/tools/method_lookup.rb +37 -0
- data/lib/runtime_analysis/query/tools/namespaces.rb +36 -0
- data/lib/runtime_analysis/query/tools/origins.rb +47 -0
- data/lib/runtime_analysis/query/tools/stubs.rb +53 -0
- data/lib/runtime_analysis/query/tools/unknown_method.rb +11 -0
- data/lib/runtime_analysis/query/tools/verify_mock.rb +145 -0
- data/lib/runtime_analysis/query/tools/what_calls.rb +67 -0
- data/lib/runtime_analysis/query/tools/what_it_receives.rb +142 -0
- data/lib/runtime_analysis/query/tools/where_nil_comes_from.rb +105 -0
- data/lib/runtime_analysis/query/tools/who_actually_answered.rb +82 -0
- data/lib/runtime_analysis/query/tools.rb +34 -0
- data/lib/runtime_analysis/query.rb +33 -0
- data/lib/runtime_analysis/recording/blob.rb +13 -0
- data/lib/runtime_analysis/recording/format.rb +32 -0
- data/lib/runtime_analysis/recording/opcodes.rb +30 -0
- data/lib/runtime_analysis/recording/raise_ids.rb +15 -0
- data/lib/runtime_analysis/recording/ruby_sink.rb +176 -0
- data/lib/runtime_analysis/recording/run_manifest.rb +110 -0
- data/lib/runtime_analysis/recording/seen/nothing.rb +15 -0
- data/lib/runtime_analysis/recording/seen/tally.rb +48 -0
- data/lib/runtime_analysis/recording/seen.rb +63 -0
- data/lib/runtime_analysis/recording/sink.rb +19 -0
- data/lib/runtime_analysis/recording/source_blob.rb +20 -0
- data/lib/runtime_analysis/recording.rb +52 -0
- data/lib/runtime_analysis/rspec.rb +8 -0
- data/lib/runtime_analysis/ruby_parsing/packages.rb +17 -0
- data/lib/runtime_analysis/ruby_parsing.rb +98 -0
- data/lib/runtime_analysis/trace/configuration/capturing.rb +32 -0
- data/lib/runtime_analysis/trace/configuration/per_run.rb +31 -0
- data/lib/runtime_analysis/trace/configuration/tier.rb +27 -0
- data/lib/runtime_analysis/trace/configuration.rb +115 -0
- data/lib/runtime_analysis/trace/entries.rb +47 -0
- data/lib/runtime_analysis/trace/hold/raises.rb +28 -0
- data/lib/runtime_analysis/trace/hold/requests.rb +47 -0
- data/lib/runtime_analysis/trace/hold/telling.rb +45 -0
- data/lib/runtime_analysis/trace/hold/unwound.rb +30 -0
- data/lib/runtime_analysis/trace/hold.rb +142 -0
- data/lib/runtime_analysis/trace/inclusion.rb +46 -0
- data/lib/runtime_analysis/trace/installer/alias_repair.rb +68 -0
- data/lib/runtime_analysis/trace/installer/answers.rb +24 -0
- data/lib/runtime_analysis/trace/installer/body_sync.rb +25 -0
- data/lib/runtime_analysis/trace/installer/built_classes.rb +43 -0
- data/lib/runtime_analysis/trace/installer/called_names.rb +33 -0
- data/lib/runtime_analysis/trace/installer/class_builders.rb +50 -0
- data/lib/runtime_analysis/trace/installer/deferral.rb +42 -0
- data/lib/runtime_analysis/trace/installer/hook.rb +170 -0
- data/lib/runtime_analysis/trace/installer/included_gems.rb +53 -0
- data/lib/runtime_analysis/trace/installer/probe.rb +28 -0
- data/lib/runtime_analysis/trace/installer/reflection.rb +50 -0
- data/lib/runtime_analysis/trace/installer/registry.rb +78 -0
- data/lib/runtime_analysis/trace/installer/sorbet.rb +29 -0
- data/lib/runtime_analysis/trace/installer/wrapping/ivar_writes.rb +62 -0
- data/lib/runtime_analysis/trace/installer/wrapping.rb +66 -0
- data/lib/runtime_analysis/trace/installer.rb +149 -0
- data/lib/runtime_analysis/trace/mechanism/block_entries.rb +29 -0
- data/lib/runtime_analysis/trace/mechanism/frame_readers.rb +61 -0
- data/lib/runtime_analysis/trace/mechanism/native_asks.rb +36 -0
- data/lib/runtime_analysis/trace/mechanism/native_sync.rb +28 -0
- data/lib/runtime_analysis/trace/mechanism/pure_wrapper.rb +41 -0
- data/lib/runtime_analysis/trace/mechanism/ruby_wrapper.rb +141 -0
- data/lib/runtime_analysis/trace/mechanism/wrapper.rb +79 -0
- data/lib/runtime_analysis/trace/mechanism/wrapper_shape.rb +40 -0
- data/lib/runtime_analysis/trace/mechanism.rb +28 -0
- data/lib/runtime_analysis/trace/nil_origin/answers.rb +24 -0
- data/lib/runtime_analysis/trace/nil_origin/beyond.rb +182 -0
- data/lib/runtime_analysis/trace/nil_origin/index.rb +164 -0
- data/lib/runtime_analysis/trace/nil_origin/lifetime.rb +29 -0
- data/lib/runtime_analysis/trace/nil_origin/named.rb +48 -0
- data/lib/runtime_analysis/trace/nil_origin/objects.rb +78 -0
- data/lib/runtime_analysis/trace/nil_origin/provenance.rb +136 -0
- data/lib/runtime_analysis/trace/nil_origin/receiver.rb +121 -0
- data/lib/runtime_analysis/trace/nil_origin/rows.rb +43 -0
- data/lib/runtime_analysis/trace/nil_origin/source.rb +315 -0
- data/lib/runtime_analysis/trace/nil_origin/stored.rb +159 -0
- data/lib/runtime_analysis/trace/nil_origin/told.rb +152 -0
- data/lib/runtime_analysis/trace/nil_origin/values.rb +47 -0
- data/lib/runtime_analysis/trace/nil_origin/weighed.rb +70 -0
- data/lib/runtime_analysis/trace/nil_origin/writers.rb +79 -0
- data/lib/runtime_analysis/trace/nil_origin.rb +278 -0
- data/lib/runtime_analysis/trace/novelty.rb +17 -0
- data/lib/runtime_analysis/trace/pure/novelty.rb +43 -0
- data/lib/runtime_analysis/trace/pure/state.rb +94 -0
- data/lib/runtime_analysis/trace/pure.rb +15 -0
- data/lib/runtime_analysis/trace/recorder/class_name.rb +63 -0
- data/lib/runtime_analysis/trace/recorder/fingerprint.rb +39 -0
- data/lib/runtime_analysis/trace/recorder/frame_key.rb +27 -0
- data/lib/runtime_analysis/trace/recorder/paths.rb +89 -0
- data/lib/runtime_analysis/trace/recorder/raise_site.rb +36 -0
- data/lib/runtime_analysis/trace/recorder/reachability.rb +46 -0
- data/lib/runtime_analysis/trace/recorder/row_emission.rb +137 -0
- data/lib/runtime_analysis/trace/recorder/safe_steps.rb +84 -0
- data/lib/runtime_analysis/trace/recorder/tree_steps.rb +42 -0
- data/lib/runtime_analysis/trace/recorder/unwinding.rb +23 -0
- data/lib/runtime_analysis/trace/recorder.rb +149 -0
- data/lib/runtime_analysis/trace/state.rb +16 -0
- data/lib/runtime_analysis/trace.rb +142 -0
- data/lib/runtime_analysis/version.rb +6 -0
- data/lib/runtime_analysis/web.rb +6 -0
- data/lib/runtime_analysis.rb +125 -0
- metadata +330 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: d4f871284e8d1fdb22c45994b2de0243b87c28c4a84913c0dfd4fb7b103fb841
|
|
4
|
+
data.tar.gz: 2804cb59aebc02f3e7cc97983819756fcf8e7ed1a7d8f40c69fb7a4737d81256
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: b6df13fb8a3b3a392e27256094cbe614eeab1f7a7f13fac461faf9737ab6ee46069f28bbd0db4337a1ae8259279006655cb3933802000ac6a31ff1b6f518682f
|
|
7
|
+
data.tar.gz: 7f22714d8a25796a365bfc7d7b0319e5630ba2dcb9be53b329ef8ad6b99c4252ed748f4ed4cd30348f528d2646fdc0541e36b605c09b95e95a55ed5ab9db1ef7
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
## [1.0.0] - 2026-11-28
|
|
2
|
+
|
|
3
|
+
- Install on JRuby and TruffleRuby. `gem install` ran the extension's build on every Ruby, and on JRuby it failed there with mkmf's "Could not create Makefile". The build now does nothing on a Ruby that is not CRuby, which records with `config.mechanism = :pure` as before. RubyGems still runs `make` there, so the machine needs one. `ra` and `RUNTIME_ANALYSIS_ROOT` no longer ask for the C wrapper when `RUNTIME_ANALYSIS_MECHANISM` is unset, so they record on those Rubies too, and asking for the extension where there is none says to use `:pure` instead of to build it
|
|
4
|
+
- Record a method whose class keeps its definition to itself. A class that defines its own `method_added` is asked before the recorder is, and when that hook does not call `super` for some name the method was never wrapped: its calls were missing and what it called was filed under its caller. Phlex does this for `view_template`. The recorder now puts its hook ahead of such a class's own, when the class defines the hook, when recording starts and when a class body in a recorded file ends, where it also wraps what it has not heard of. Each run's manifest gains `never_wrapped`, the methods of those classes still without a wrapper when the run ended, and `ra doctor` reads it
|
|
5
|
+
- Record the values of the methods you name with `config.probe` or `RUNTIME_ANALYSIS_PROBE` (`Order#total,Pricing.rate`), to tell a method that is asked the same thing again and again from one that is not. Each call to a probed method also writes a `VALUE` row (opcode 12) for its receiver, each argument and its return: a small immutable value, an Integer, Float, Symbol, `true`, `false`, `nil` or a String of up to 128 bytes, as a hash of the value and its class that matches equal values within the process, and anything else as its object id. The values themselves are never written. It works at every tier and with every mechanism, and in errors-only recording a kept request keeps its value rows. Other methods are recorded as before, and with no probe nothing changes
|
|
6
|
+
- Say only what was read when a record's row could not be. The recorder finds a record by its id when the tracker asks, and a record nothing references by then can have been collected; it then said "is NULL in this Address" of a record that was never saved, and "key is NULL" of a key that was set with its row gone. Without the row a nullable column is worded "read nil on this Account; no row was read, so it is NULL if the record was saved", the key of a `belongs_to` claims no kind and says it is NULL or set with no such row, and an enum claims nothing. The same holds for a receiver picked by a variable's name, which never had a row.
|
|
7
|
+
- Claim a stored NULL only for a receiver that may be a record. An attribute read from a Struct, a presenter, a class written as a constant or a nil that `&.` passed on was told as a NULL in a row of the one model with a column of that name. A model is now looked for by a name or a column only when the held rows do not say what the receiver was. A nil the raising line read from an instance variable is told as that when one of the call's arguments was nil too, where it was told as the argument, and for a job as "the job was given nil". A method that rescued another error and then called a method on nil is named as where it was raised, where the error had no call at all. A class method a module gives a class it extends is named for the module, `Finders#lookup`, which is how the index keys it. The methods listed as assigning a variable and not having run are those of the object's own class, where every class in the file was searched.
|
|
8
|
+
- Stop sending an exception messages the program did not send it. Each wrapper rescued an exception leaving a recorded method and raised it again, and Ruby sends an exception `backtrace` on every raise, and `exception` and `respond_to?` too when the raise is written in Ruby. An exception that overrides or mocks `backtrace` heard it once more for each recorded call it left, and a `TracePoint` on `:raise` fired as often. The exception is now read as it passes and never raised again: the C wrapper and the one written in Ruby carry the unwind on, and the pure wrapper and errors-only recording's hold on a request read `$!` as the call closes. The unwind row is the same, with one exception in the pure mechanism: a call that raises again the very exception being handled where it was called is recorded as a call a throw left
|
|
9
|
+
- Say what kind of nil it was, and for a stored NULL who could have written it. The `nil_origin` context gains `kind` and one line, `because`. A nil the request itself set is traced from the held rows to the call that set it, on the same object by its object id: "the same Account had `nickname=` called with nil at app/services/import.rb:14", through a writer, a constructor by place or by keyword, and a nil handed on through several objects. A method that assigns the variable in its own body is listed as a candidate and worded as one. Everything else is read from an index `ra nil_index` builds in CI or at deploy and the recorder loads when it starts, `config/runtime_analysis/nil_index.json` or `config.nil_index`: a column that is NULL in the row, a lookup that matched nothing, an absent key, a setting never set, a value held in process memory, a job argument that was nil before the job ran. A stored NULL comes with at most five write sites from the whole codebase, ranked, each with one reason, beside what the schema, the migrations and the row's own timestamps say. The index names its commit, an entry from a file that has changed since is left out, and without the file what the request set is still found. Nothing new leaves the machine. On a request of 1,000 calls it adds between 0.3 and 2 ms when the error is reported
|
|
10
|
+
- Keep a rake task that raised, with where its nil came from. Sentry reports a task's error after the task has ended, when its rows were already discarded, so the event had no context and nothing was written. Each task is now a request named `rake <task>`, kept under either signal when it raises
|
|
11
|
+
- Name a method a parent class or a module defines for where it is defined, and a template's compiled method by the template's path, in the nil sentence. Follow a nil error that `delegate` rescued and raised again to the calls it unwound through
|
|
12
|
+
- Write the requests already kept when a process exits without `RuntimeAnalysis.finish!`. A kept request is written by the writer thread after the request ends, and a program that exited straight after a failure could leave it half written. In errors-only recording the Railtie now registers an `at_exit` that runs `finish!`, and any other app calls `RuntimeAnalysis.finish_at_exit` once. A forked worker writes the requests it kept itself and none of its parent's, and a fault while closing is caught and counted like any other fault in the recorder
|
|
13
|
+
- Catch the recorder's own faults before the program it records sees them. An exception raised inside the recorder went out through the program's call: a `NoMethodError` in the recorder's enter path killed a worker thread before it signalled the thread waiting on it, which then waited for good. Everything the recorder does inside one of the program's calls now runs under a guard: both halves of each wrapper, what the C wrapper asks of Ruby, the hold on a request, the middleware, the hooks on error trackers and job runners, and `finish!`. A fault there is counted, the first is reported on stderr with its class and place and never its message, and the call goes on unrecorded and returns or raises what it would have with no recorder. After ten, recording stops for the process and does not start again. `RuntimeAnalysis.stats` has `errors`, `last_error` and `switched_off`, and `write_errors` for the files a writer thread could not open, write or name. An exception another thread raises into the recorder, a timeout's for one, is held back until the guard is left and then raised as it was
|
|
14
|
+
- Keep a request in errors-only recording only for an error your tracker reports, once the tracker tells the recorder. The gem loads and patches no error tracker. `RuntimeAnalysis.reported(error) { |origin| ... }`, called from the tracker's own callback after its ignore rules, keeps the request the error happened in, and for a method called on nil gives the block where the nil came from to put on the event. A block that raises is caught, reported once on stderr and counted in `RuntimeAnalysis.stats[:hook_errors]`, apart from the recorder's own faults, and never switches recording off. `config.error_signal` is `:raise` unless `:tracker` is named, and with `:tracker` named and nothing calling `reported`, the first exception to leave a request says so once on stderr, whatever jobs were kept before it. A report that comes with no request open, as from a Sidekiq app without `runtime_analysis-sidekiq`, is counted in `stats[:reported_outside_request]` and the first says so on stderr. `examples/trackers`, which is in the gem, has the initializer for Sentry, last run against sentry-ruby and sentry-rails 7.3 in a Rails app on 2026-11-29, and for Honeybadger, written against 6.10.2 and never run, with a prompt that has a coding agent write the callback for any other tracker. An app that ran an earlier build from source with Sentry or Honeybadger loaded adds those lines and sets `error_signal = :tracker`
|
|
15
|
+
- Keep a job that raised, whatever the signal. A job runner tells an error tracker of a failed job after the job has ended: Sidekiq from its error handlers, sentry-rails from around `perform_now`, rake from its own handler. `RuntimeAnalysis.job(name) { ... }` is a request that is kept when an exception leaves it and remembers where its nil came from, so `reported` called afterwards is still given it. ActiveJob's `perform_now` and each rake task are one. Sidekiq's is in a gem of its own, `runtime_analysis-sidekiq`, as a server middleware named `RuntimeAnalysis::Sidekiq::Middleware`: add it to the Gemfile of an app that runs Sidekiq. A failed job is kept even when the tracker ignores its error
|
|
16
|
+
- Say on the error tracker's event where a nil came from. When the error is a method called on nil, the block given to `RuntimeAnalysis.reported` is handed a `nil_origin` context to put on the event, with one sentence, "`upcase` was called on nil returned by Account#nickname (app/models/account.rb:6), in Report#title, during GET /title", and the facts behind it: the method that returned the nil and where it is defined, the method and line that raised, the request, the places the nil passed through, and the name of the segment the request is written to. The Sentry example also tags the event `nil_origin` with the method. It is worked out in the process from the rows the failed request still holds, the way `ra where_nil_blew_up` works it out from a recording, and nothing more leaves the machine than the event the tracker was sending. The message, backtrace and grouping are unchanged. `RuntimeAnalysis.nil_origin(error)` gives the same facts for any other tracker
|
|
17
|
+
- Add `config.ring`, the size of each recording thread's ring in bytes or as a size such as `"2MB"`, between 64KB and 1GB, 8MB by default. In errors-only recording it is the most a request can hold. `RuntimeAnalysis.stats[:largest_request]` is the bytes the largest request so far took, counted in full when the ring had no room for it, so it says what to set
|
|
18
|
+
- Record only the requests that fail, with `config.errors_only = true`. Every call is still observed, each thread's rows wait in its ring, and a request's rows are written only when the request fails, as a segment of their own that reads by itself. A healthy request leaves nothing on disk. A request is what `RuntimeAnalysis::Middleware` wraps, which the Railtie puts first in the stack, or a job's `perform`, or a call tree outside both. It failed when an exception left one of its call trees or the request itself, or, with `config.error_signal = :tracker`, when the app's error tracker reported an error and told the recorder (`RuntimeAnalysis.reported`, and `RuntimeAnalysis.keep_request` for a failure of the app's own). It records at tier `:raises`, through the C wrapper or the one written in Ruby, and is refused with the pure mechanism and with adaptive mode. A request larger than the 8 MB ring keeps its newest rows, and the segment's second row, `[10, dropped, kept at]`, says how many were lost and marks the segment as a kept request. Readers skip the row, so the format is still 1. On the overhead benchmark the recording thread pays what full recording pays, 5.8 times an unrecorded run at tier 4, the process uses 28% less of the CPU that recording adds, and a million reps write nothing where they wrote 568 MB
|
|
19
|
+
- Name the tiers: `:calls` is who called what, from which file and line; `:classes` adds the class of each argument and keyword; `:objects` adds object ids for receiver, arguments and return, and the return row; `:raises` adds the exception class and raise site when a call unwinds. `config.tier` and `RUNTIME_ANALYSIS_TIER` take a name or the number it stands for, 1 to 4, and the recording keeps the number. `ra setup` writes the name
|
|
20
|
+
- Record on a Ruby that has no extension to load, with `config.mechanism = :pure`, the default on JRuby and TruffleRuby. The wrapper written in Ruby records every call through the Ruby recorder, the call tree and the adaptive gate are the same in Ruby, and the sink written in Ruby is back, writing the stream the native one writes to one file. A recording made on JRuby or TruffleRuby reads like one made on MRI, and the same program gives the same trees on all three. Without the extension there is no fast path, so a recorded call costs what the Ruby recorder costs; nothing is read through the C lookups, so a `private` declared by name after a class has closed is not followed and a wrapper handed to `define_method` is copied as it is; and on a Ruby whose hook hears nothing of `def self.x` in a class body, JRuby, the class's singleton methods are discovered as its body closes
|
|
21
|
+
- Ask a method's own visibility of the method table instead of listing the class's private and protected methods for each one. Wrapping Campfire's whole bundle spent a quarter of its time in those lists; its boot with the bundle recorded takes 2.6 seconds where it took 3.7
|
|
22
|
+
- Keep the C wrapper in front of a method that reads the frame that called it, when the wrapper written in Ruby is chosen. Zeitwerk's `for_gem` takes a gem's root from `caller_locations(1, 1)`, and a frame of the recorder's there made it take the current directory. A file is parsed only when it mentions `caller`, `caller_locations`, `of_caller` or `uplevel:`
|
|
23
|
+
- Let a wrapper written in Ruby stand in front of each recorded method, with `config.mechanism = :ruby` or `RUNTIME_ANALYSIS_MECHANISM=ruby`. The C wrapper stays the default. A JIT compiles the Ruby wrapper together with the caller and the method, which it cannot do for a C function, and the wrapper calls the same C side to fold the route, ask adaptive mode's gate and write the rows. Under YJIT on the overhead benchmark it takes a fifth off recording's cost in adaptive mode and a tenth at tier 1, and without a JIT it costs a third more than the C wrapper. It is a frame of its own, which a backtrace shows as `(runtime_analysis wrapper)`
|
|
24
|
+
- Take the Pro tools out of the gem. The 29 Pro tools and the editor's code lens and references are answered by the `ra` binary from https://www.runtimeanalyz.ing, which reads the same recording. `ra tools` lists the five tools this gem carries and no longer marks locked ones or says how to unlock them; `ra activate`, the catalogue of Pro tools, the line under a free answer about calls on nil and the hover line about the examples that reach a method are gone with the Pro gem they pointed at. `ra serve` stops watching for a licence, since none is read here, and still stops when the bundle changes
|
|
25
|
+
- Skip a call in adaptive mode without finding where it was called from. The wrapper read the caller's file and line before it asked the gate, and a skipped call has no use for them. On the overhead benchmark a skipped call costs 68 nanoseconds where it cost 79, and tier 3 with adaptive mode is 2.8 times an unrecorded run where it was 3.1
|
|
26
|
+
- Measure recording on a server under traffic, where the suites measured it only on tests. Redmine in production mode served a fixed mix of a tracker's work, 8 actions a second for 15 minutes, 98.7 million recorded calls. It had seen 22,171 routes after one minute and 27,499 after fifteen. Recording added 8.7% to CPU time at tier 4 and 3.1% in adaptive mode, and over the last five minutes 9.7% and 3.9%. Adaptive mode's recording took 115 MB where the full one took 6.9 GB.
|
|
27
|
+
- Count routes and the calls handed to Ruby in `RuntimeAnalysis.stats`. `routes` is how many distinct routes the recorder has seen, which is what a recording process's memory follows. `slow` is the calls the wrapper gave to Ruby to record, beside `fast` for the ones it wrote itself, so the two add up to every call recorded
|
|
28
|
+
- Use a third of the memory for each route. A process's memory when recording follows the number of distinct routes it has seen, and each was about 740 bytes: a struct and an array in Ruby, and a 32-byte entry in a table kept half empty in the C wrapper. A route is now four integers, with frames and files kept once each, and the wrapper's entry is 24 bytes in a table that fills to three quarters. Recording Redmine's suite, 268,000 routes, peaks at about 540 MB where it peaked at about 880 MB, against 457 MB unrecorded. CPU time is unchanged: 111 seconds at tier 1 on both builds
|
|
29
|
+
- Turn adaptive mode on for a run started by `ra record` with `RUNTIME_ANALYSIS_ADAPTIVE=1`. It read the tier and the output directory from the environment and had no way to ask for adaptive mode
|
|
30
|
+
- Let the wrapper remember as many calls as a program makes. It kept the calls it may write without Ruby in a table of 1,024 entries for each stream, and a large test suite has hundreds of thousands of routes. Recording Redmine's suite, 2.98 million of 20.2 million calls found their entry put out by another and went through Ruby. The table now starts at 1,024 entries and doubles as it fills, up to a million, which is 32 MB. On Redmine 0.49 million calls go through Ruby where 3.15 million did, and recording adds 14 seconds to a 222 second suite at tier 1 and at tier 4, and 9 seconds in adaptive mode
|
|
31
|
+
- Mark every recording file with the format it is written in. Each segment starts with the row `[9,1]`, and a reader that meets a version newer than it knows refuses the recording and names both versions, where it would have misread it. `ra` says so and exits 2. A file with no mark is in format 1, so recordings made before this read as they did, and readers built before this skip the row. The number goes up only when a change on disk would make an older reader misread a file
|
|
32
|
+
- Record a repeated call at tiers 2, 3 and 4 from the C wrapper, as tier 1 has been. The wrapper gathers the class of each argument, the object ids, the keywords and the return itself. Each stream keeps a table from a class to the id its name has in the stream's dictionary, and asks Ruby the first time it meets a class or a keyword in a segment. A raise at tier 4 is still written by Ruby, which works out where it was raised. On the overhead benchmark tier 2 went from 3.19 seconds to 0.16 and tier 3 from 4.95 to 0.21, which is 4.0 and 5.3 times an unrecorded run where they were 82 and 127
|
|
33
|
+
- Skip a call in adaptive mode without going into Ruby. The gate that keeps a route's first call and one repeat in 64 is now in C, and the wrapper asks it before anything else. A skipped call used to cost about a microsecond to be told it was not wanted. On the overhead benchmark tier 3 with adaptive mode went from 1.31 seconds to 0.12, which is 2.9 times an unrecorded run where it was 33
|
|
34
|
+
- Have the drain thread take 8,192 rows each time it takes the ring's lock, where it took 256. It waits its turn for the lock behind the recorder, and with the recorder now this fast the waiting was half its time: a tier 3 call and its return took 240 nanoseconds to write and now take 120. Return and keyword rows are formatted into the batch as calls are
|
|
35
|
+
- Pack the ring's rows into the words they use. A row in the ring was a fixed slot of 520 bytes, sized for a keywords row with sixteen arguments, and a tier 1 call uses 48 of them. The ring is now a run of 8-byte words, and each row takes a header word and the words its kind needs. The drain thread formats a call straight from those words and writes a batch with one `fwrite`. It writes a row in 63 to 75 nanoseconds where it took 112, which is about half the time the recorder takes to make one at tier 1
|
|
36
|
+
- Give each stream an 8 MB ring where it had 2 MB. The rows still being dropped were lost to one cause: once or twice in a run a single write to the file is held up by the system for 3 to 15 ms, and a 2 MB ring holds 6 ms of tier 1 calls. In sixty runs of the benchmark at each size, 19 runs dropped rows on 2 MB, one on 4 MB and none on 8 MB. A ring that has been emptied starts again from its first word, so a thread uses as much of its ring as it has fallen behind by. Twenty threads making 400,000 calls each grew the process by 40.5 MB, where 2 MB rings had grown it by 42.8 MB
|
|
37
|
+
- Keep two busy calls from sharing one slot of the fast path. The wrapper remembers the calls it may write without Ruby in a table of 1,024 slots. Two calls that hashed to the same slot put each other out on every call, and both went through Ruby each time. Which calls collide changes from run to run, and in 8 runs of 100 the overhead benchmark took 0.60 seconds where it otherwise takes 0.14. An entry may now sit in any of eight slots, and a hundred runs took between 0.135 and 0.152 seconds
|
|
38
|
+
- Follow a change of visibility made after a class has closed. A wrapper took its method's visibility when the class was defined, and `Issue.send(:public, :hidden)` later left the method as private as its wrapper still was, so a recorded program raised where the unrecorded one did not. One of Redmine's 5,917 tests failed for this. `public`, `private`, `protected`, `public_class_method` and `private_class_method` now tell the recorder when they are given names
|
|
39
|
+
- Record a repeated call about twenty times faster at tier 1. A call the recorder has seen before, on the same route and from the same line, is now written by the C wrapper with no trip into Ruby, where it used to cost about thirty-five method calls and sixteen allocations. On the overhead benchmark tier 1 went from 3.0 seconds to 0.14, which is 3.6 times an unrecorded run where it was 81. Anything new still goes through Ruby: a new route or call site, the first call of a tree, a method of an included gem, a `method_missing`
|
|
40
|
+
- Stop the drain thread waking for every row. The recorder was slow enough that the drain thread caught up after each row, so every row cost a wake-up, a write and a flush. It now waits two milliseconds for a burst, takes it as a batch, and writes it with the lock released. That removed the benchmark's system time, 39 seconds of it against 88 of user time, and took about 15% off every tier
|
|
41
|
+
- The producer never waits for the drain thread. With calls arriving faster, the ring can fill, and a row that finds it full is dropped and counted, as before. The drain thread's wait for a burst is ended by the producer once the ring is half full, and that request cannot be lost between the drain thread's check and its wait.
|
|
42
|
+
- Say what is missing when the extension cannot be built. Installing the gem where there is no C compiler, as in a slim container image, ended in a stack trace from inside mkmf. It now says that a compiler and make are needed and how to install them on Debian, Alpine, Fedora and macOS. A platform without POSIX threads and poll is told that the extension builds on Linux and macOS, and under WSL on Windows
|
|
43
|
+
- Record through the native extension alone. The Ruby sink and the Ruby wrapper that took over when the extension was missing are gone. A Ruby wrapper is a frame in front of each method, and Ruby reads the calling frame for `private`, `protected` and `module_function`, so a program recorded that way could behave differently from one that was not. Without the extension the gem still loads and still reads recordings. Starting a recording raises `RuntimeAnalysis::Native::Missing`, which names the Ruby and the platform and says how to build it
|
|
44
|
+
- Record a method that has a Sorbet sig. sorbet-runtime replaces such a method with a checking method of its own before the recorder hears of the definition, so the recorder found a method written in sorbet's files and gave it no wrapper. An app with sigs throughout recorded almost nothing. The recorder is now told first, and its wrapper sits in front of sorbet's check, which still runs
|
|
45
|
+
- Keep a method defined with `define_method` after `private` as private while recording. The recorder's own `define_method` was a Ruby method, whose frame hid the caller's `private` from Ruby, so the method came out public. It is a C function now. Without the extension the fault remains
|
|
46
|
+
- Tell a class passed as a value from an instance of it. An argument that was the class `Lesson` and one that was a Lesson were recorded under the same name, so `ra crystallise` wrote `params(base: ApplicationController)` for a method handed the class, and Sorbet's runtime refused the call. A class or module that is itself an argument, a result or held in an Array is now recorded as `#<Class:Lesson>`, written as `T.class_of(Lesson)` or `singleton(Lesson)`, and shown in the editor as `singleton(Lesson)`. A call on such a value is typed by the class's own class methods. A recording made before this has the two alike, so record again before crystallising
|
|
47
|
+
- Record keywords as a Hash for a method that has no keyword parameters. `CreateBook.call name: "Kana"` hands `def self.call(book_params)` a Hash, which was recorded as keywords and left the parameter looking unpassed
|
|
48
|
+
- `ra crystallise --sorbet` extends `T::Sig` inside a `class_methods do` block, which runs as a module of its own. It put the extend in the module around the block, and the file failed to load with "undefined method 'sig'". A method written inside any other block, `included do` among them, is given no sig, since nothing says `sig` is there when the block runs
|
|
49
|
+
- In a Sorbet sig, a value a spec passed a double for is `T.untyped`, since Sorbet checks each call and a double is not an instance of the class it stands in for. A relation class Rails keeps private, `Book::ActiveRecord_Relation`, is written as `ActiveRecord::Relation`. RBS is not checked at runtime and keeps the real class in both cases
|
|
50
|
+
- Add `ra crystallise FILE`: write the types a recording saw as signatures. `--sorbet` writes a sig above each method of the file that a run called, with `extend T::Sig` in each class that gains one, and `--rbs` writes the file's classes to `sig/<path>.rbs` nested as the source nests them. Without `--write` it prints what it would write, and with no notation named it uses the one the project keeps. A value seen as several classes is a union, one that was sometimes nil is nilable, an Array says what it held, and what no run says is untyped. A class is named as Ruby would find it from where the signature goes, so `School::Lesson` inside `module School` is `Lesson`. A method that has a sig is left alone, and an RBS file is written over only when `ra crystallise` wrote it. `ra crystallize` is the same command
|
|
51
|
+
- Read a project's RBS without asking that it be complete. A class that inherits from, includes or returns a class the signatures do not declare used to be left out, with a line on stderr. It is read as written now, and a name RBS has no declaration for is settled against the classes the project declares in Ruby
|
|
52
|
+
- Read the block of `Event = Struct.new(:id) do ... end` as the body of Event. Its methods were listed as methods of the class or module around the assignment, so they matched nothing a run recorded by name. A class written inside such a block is named in the namespace around it, as Ruby names it
|
|
53
|
+
- Use the types a project declares, in the editor, for what no run recorded. `ra lsp` reads Sorbet sigs in the app's own source, the RBI files under `sorbet/rbi`, the RBS files under `sig`, and the gems' RBS that `rbs collection install` fetched. A call is typed by what its method is declared to return, a parameter no run passed by what it is declared to take, and the rest of the method is worked out from those. What a run observed still comes first, and a declared type is marked `~` like every type no run saw. A sig written right above a method is not repeated beside it. Sorbet is not loaded, since a sig is read as written. RBS takes the rbs gem, and when the app's bundle does not include it the files are read by a second Ruby outside the bundle. The declarations are read again when a file is saved
|
|
54
|
+
- Say what an Array holds for a call on a core class: `body.split(",")` is `~Array<String>`, and the block that goes through it gets `|part: ~String|`. The index of `each_with_index` and `with_index` is an Integer. A class method is found on a superclass, so `File.read` is typed
|
|
55
|
+
- Record reads of the fields of a `Data` or a `Struct` your code defines. `Occurrence = Data.define(:id)` used to leave `occurrence.id` out of the recording, because Ruby writes that reader in C and it has no file to place it in your app. The recorder now watches `Data.define` and `Struct.new`. When a line of your own code calls one, the fields named there are recorded like any method you wrote, with that line as where they are defined. A `Struct`'s writers are recorded too, and `==`, `to_h` and the rest are left alone. Add a gem's builder with `c.class_builders << [Value, :new]`
|
|
56
|
+
- Add `include_gems`: record your own code's calls into the gems you name, one call deep by default. `c.include_gems "activesupport", "values"` records that `name.camelize` returned a String and that `occurrence.id` was read, and nothing the gem does inside itself. Only the gem methods your source names are wrapped, and a call is recorded only when the line that made it is yours. `depth:` goes further in
|
|
57
|
+
|
|
58
|
+
- Add `ra record`: records a project that has not added the gem, and changes no file git would show. `ra record` runs the tests with recording on, `ra record dev` the server, and `ra record -- command` anything else. The recorder is loaded into the command from the installed gem, so the Gemfile, the lockfile and the helpers stay as they are. It starts when the first class under the project's root loads, which is after Bundler has chosen the program's gems, names each RSpec example and Minitest test, and names requests and jobs in a Rails app. The first use of a name asks which command it stands for, offers what the project's files suggest, and saves the answer in `~/.config/runtime_analysis/commands.json`. With no terminal to ask at it takes the offer. A recording that `.gitignore` does not cover is ignored through `.git/info/exclude`. In a project with the gem in its bundle, `ra record` switches on the project's own configuration
|
|
59
|
+
- `ra rerun` records in a project that has not added the gem, the way `ra record` does. It used to run the examples there and record nothing. It now passes the recording directory to the run, so `--recording` writes where it reads
|
|
60
|
+
- Name a Minitest test in a file run as `ruby test/x_test.rb`. Ruby gives that file's path as it was typed, and working out the test's name from it raised before the test ran
|
|
61
|
+
|
|
62
|
+
- Say what a Hash holds in the editor's types, worked out from what the source puts in it: `@paths[id] = Path.new(...)` makes `@paths = {}` read `@paths: ~Hash<Integer, Path> = {}`. An Array that is appended to gets the same, `@names: ~Array<String> = []`. An instance variable is typed from every method of its class in the file, where before each method saw only its own assignments. `[]=`, `store`, `<<`, `push`, `append` and `||=` on an index are read. A half that cannot be worked out is `untyped`. A block called on such a Hash has its parameters typed by the keys and what is under them, for `each`, `each_value`, `each_key` and the like
|
|
63
|
+
- Go to the class of what is under the cursor, in the free gem. `ra lsp` answers "go to type definition": on a constant with where that class or module is declared, and on a variable, a parameter or a call with where each class the recording saw there is declared, the one seen most first. For an Array the classes it held come first. Only classes the project declares are answered with. In Neovim this is `gf`, which does what it did before when no class is known under the cursor, whether that was Vim's own `gf` or another plugin's mapping. Several classes go to the location list
|
|
64
|
+
- Keep `ra lsp` running when a request raises. The request is answered with an error, what raised goes to stderr, and the next request is answered as usual. A `class` line with its name not yet typed raised while the inline types were worked out, which ended the server, and an editor does not start it again
|
|
65
|
+
- In Neovim, `<leader>ra` or `:Ra` opens a menu of every tool. Picking one asks what to ask it about, with the recorded methods, classes or namespaces to pick from, or the file being edited to start from, and shows the answer in a window. It uses `vim.ui.select`, so it is whatever picker the editor has
|
|
66
|
+
- Add `ra tools --json`: each tool's name, description, whether it can run, and what its argument is and completes from, for an editor or an agent to read
|
|
67
|
+
- Start `ra lsp` and `ra mcp` from an installed gem. Both state the gem's version, and nothing on the query side loaded it. Under `bundle exec` with a path gem it was there only because Bundler had read the gemspec
|
|
68
|
+
- In Neovim, find `ra` without relying on the `PATH`: the project's `bin/ra`, then `bundle exec ra` when the project's bundle holds the gem, then the gem the plugin ships in, then `ra`. The plugin ran plain `ra`, which a shell function or a version manager's shim can answer in a terminal and not for a process Neovim starts. The language server now starts in the project's root wherever Neovim was started, so it finds the recording and the bundle
|
|
69
|
+
- Run a class method that rspec-mocks stubs with `and_call_original`. rspec-mocks calls the original through a handle taken before the stub, and with the method traced that handle is the recorder's wrapper, whose `super` reached the stub, which called the handle again until the stack overflowed. A wrapper that has been dropped now runs the definition it was dropped from, and records the call. Both the native and the Ruby wrapper do this, and it costs a traced call nothing
|
|
70
|
+
- Put a module's own method back after rspec-mocks stubs and restores it when a method of the same name exists further up, as `load` does on Kernel. The method that came back was the one further up, so a stubbed `Shelf.load` called `Kernel#load` from then on
|
|
71
|
+
- List in a value's hover the messages the method's source sends it that no run recorded, such as a reader a gem defines. The hover used to say nothing was sent
|
|
72
|
+
- Say what an Array holds in the editor's types: `def occurrences -> Array<Occurrence>`, from the elements a run recorded in a returned Array. A block's first parameter is typed by what the Array it is called on held, and an Array built by `map` or `flat_map` is worked out from what its block returns
|
|
73
|
+
- Show the Pro tool `where_nil_would_break` in the editor: a call that would raise on nil, before any run has
|
|
74
|
+
- Add `RuntimeAnalysis::Web`, a Rack app to mount in the app being recorded: `mount RuntimeAnalysis::Web, at: "/_ra"` after `require "runtime_analysis/web"`. `GET /_ra/stats` answers with `RuntimeAnalysis.stats` for that process as JSON. It reads only, and has no authentication of its own. `ra setup` recommends it in a Rails app without mounting it, and the steps say how to put it behind a guard the app already has: beside another internal tool in the routes, behind the check its admin pages use, behind a password of its own, or in development only
|
|
75
|
+
- Add `ra setup`: makes the edits a project needs to record, and says what it changed and what to run next. It adds the gem, writes the configuration behind `RUNTIME_ANALYSIS_ENABLED` (an initializer in Rails, the top of the test helper elsewhere), names each test for RSpec or Minitest and ignores the recording in git. Running it again changes nothing. `ra setup --print` shows every step for a person or a coding agent to follow, with the editor, CI and production. `ra setup --agent` hands the steps to a coding agent on the PATH: it starts Claude Code with them, and prints one line to paste for Codex, Gemini CLI, Cursor, Aider and opencode
|
|
76
|
+
- Colour what `ra` prints to a terminal: in `ra tools` a tool you can run is green, a Pro one cyan with its mark in yellow. In a tool's answer the title is bold, a finding's mark takes the colour of its severity, its place is cyan and its fix green. Output that is piped, written to a file or asked for as JSON has none, and neither has any output when `NO_COLOR` is set. `ra serve` answers in colour and the client takes it out when it is not printing to a terminal
|
|
77
|
+
- List the Pro tools in `ra tools` marked `(Pro)`, describe them with `--help` and complete their arguments. Running one without Pro reports how to unlock it on stderr and exits 2. The MCP server serves only the tools that can run
|
|
78
|
+
- End a free tool's answer with one line when the recording holds calls on nil that raised, saying how many and how many in production. It goes to stderr from the command line and into the text an MCP client reads, and is left out of JSON. The editor's method hover names the Pro tools that list a method's callers and the examples that reach it
|
|
79
|
+
- Change the licence from MIT to the PolyForm Shield License 1.0.0: the source is available, and any use is permitted except providing a product that competes with it
|
|
80
|
+
- Record the name each `method_missing` was asked for, at every tier, as a row beside its call. A reader sees `event.payload_type` and `event.payload_id` as different calls, and the editor types them as observed. A recording from before this keeps the line-based stand-in, marked `~`
|
|
81
|
+
- In Neovim, `<leader>rt` or `:RaTypes` hides the inline types everywhere and shows them again
|
|
82
|
+
- Work out types no run recorded, and mark them with `~`: a call on a core class by what its signature returns once the receiver's class is known, and a method answered by `method_missing` by the `method_missing` calls recorded on that line. `const_name = event.payload_type.downcase.camelize` reads `const_name: ~String`
|
|
83
|
+
- Show observed types on the values inside methods, as inlay hints from `ra lsp`: beside an assignment or a block parameter the classes the value was seen as, and after a signature what the method returned. A variable is typed by the recorded call it was assigned from, and failing that by the calls it was passed to or received
|
|
84
|
+
- Hover a variable, parameter or call for its classes with counts and the messages the same objects were sent afterwards anywhere in the call tree, with the methods that sent them. In Neovim the same shows in a popup once the cursor rests on a value, and on `K`
|
|
85
|
+
- In the Neovim sidebar, `o` steps through the call stack to a method with `j` and `k` showing each frame beside it, `Enter` to stay and `Esc` to go back, and `?` shows the keys
|
|
86
|
+
- Add `call_stack`: one recorded call stack from where a tree started down to a method, each frame on the line it made the next call from. `--through` keeps to the routes that pass through another method
|
|
87
|
+
- Show the classes each argument was given, as inlay hints from `ra lsp`: `def advance(enrollment, book)` reads `def advance(enrollment: Enrollment, book: Book)`. The server keeps the text the editor holds, so hints stay on their parameters through unsaved edits, and asks the editor to fetch them again when a run finishes. Hover names each argument by its parameter and includes keyword arguments
|
|
88
|
+
- Add `ra rerun <file>`: records again the examples whose recorded runs reached a file, so the recording catches up with an edit. `:RaRerun` and `<leader>rr` run it from Neovim
|
|
89
|
+
- Keep a method working after rspec-mocks stubs it and puts it back. rspec-mocks holds a handle on the wrapper across the stub, and defining the method back from that handle copied the wrapper, whose `super` then found nothing
|
|
90
|
+
- Shorten what `ra lsp` shows beside the code: a method of the enclosing class loses the class name, the enclosing method is not named again, a place in the file is given by its line and a file in the same directory by its name. The Neovim plugin leaves out a trail the first line already states
|
|
91
|
+
- Keep `ra lsp` current: it reads the recording again when a run starts or finishes, asks the editor to watch the run manifests, and republishes the diagnostics of every open file when one changes
|
|
92
|
+
- Pin every file a run recorded a method in to the id git gives its content, in the run manifest at `finish!`. `where_nil_blew_up` uses it: a crash recorded before its file changed becomes a warning that says so, placed on the line its text has moved to, or on the method's first line when the text is gone
|
|
93
|
+
- Drop a nil crash from `where_nil_blew_up` once the same example or request is recorded again at tier 4 without it, or once its file has changed and a later tier 4 run calls the method as the file now stands. A recording directory keeps every run, so the crash stayed after the code was fixed. The run manifest now records the tier
|
|
94
|
+
- Add `where_nil_blew_up`: every line where a method was called on nil, with the trail back through the call tree to the method the nil came from. Tier 4 now records where an exception was raised and, for a missing method, its name and the class it was called on
|
|
95
|
+
- Show `where_nil_blew_up` in the editor: `ra lsp` publishes an error on the line that raised, with the trail as related locations, and a warning on the method the nil came from. The Neovim plugin attaches Ruby buffers to `ra lsp` when the project has a recording, underlines the code a finding is about, and draws errors and warnings beneath their line with the trail
|
|
96
|
+
- Add `whats_connected`: the files that reach a file through recorded calls and the files it reaches, with the hops between, and a Neovim sidebar under `editor/nvim` that shows it for the buffer you are in
|
|
97
|
+
- Count an example kept next to its code (`app/**/*_spec.rb`, `*_test.rb`) as a spec tree rather than an app run
|
|
98
|
+
- Record a module method a class extended (`extend`, Concern's `class_methods do`) as that class's class method, so it no longer collapses with an instance method of the same name
|
|
99
|
+
- Read a spec kept next to its code as a spec: leave it out of the method index, scan it for stubs, and count it as a spec file in a diff
|
|
100
|
+
- Read `class_methods do ... end` as class-method definitions
|
|
101
|
+
- Count only the calls a method's own file makes as feature envy, so a framework running a component's methods under a controller action no longer flags the action
|
|
102
|
+
- Take `whats_looping`'s file as a positional argument, like the other path-taking tools
|
|
103
|
+
- Leave methods added to Kernel, Object, BasicObject, Module and Class unwrapped: prepending onto Kernel breaks `Kernel.dup`, which Ruby's Delegator relies on, so recording a bundle that reopens Kernel crashed at boot
|
|
104
|
+
- Pass a wrapped method through untraced when the recorder itself calls it, and never send an observed object a message: its class, name and object id are read with core methods bound to it, so a proxy built on `method_missing` or a receiver that overrides `is_a?` no longer recurses or raises
|
|
105
|
+
- Restore a method that an alias, a self-alias (`silence_redefinition_of_method def ...`) or `module_function` replaced with a copy of the wrapper
|
|
106
|
+
- Report the wrapped method's arity, parameters and source location through `Method` and `UnboundMethod`; hand out the wrapped method from `instance_method`, and define it when `define_method` or `define_singleton_method` is given a wrapper
|
|
107
|
+
- Drop the wrapper when its method is removed or undefined. Ruby 3.4 keeps a stale cache entry when a method is removed from a module that has a module prepended and is itself prepended, so the wrapper's `super` kept reaching the removed method, which left every Mocha stub installed after teardown
|
|
108
|
+
- Leave the methods a `dup` or `clone` copies unwrapped: wrapping one prepends onto a copy whose method table is still being filled, which left Ruby's Delegator unable to undefine `to_s` on its copy of Kernel when the bundle was recorded
|
|
109
|
+
|
|
110
|
+
## [0.1.0] - 2026-09-27 (never published)
|
|
111
|
+
|
|
112
|
+
Rubygems never had a 0.1.0. Its only earlier release is 0.0.1, a placeholder with no recorder, since
|
|
113
|
+
yanked. The 1.0.0 entry above includes everything listed here.
|
|
114
|
+
|
|
115
|
+
- Initial release
|
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Copyright (c) 2026. All rights reserved.
|
|
2
|
+
|
|
3
|
+
Licensor: Espíritos Algébricos – Unipessoal Lda, Vila Nova de Gaia, Portugal, under licence from the
|
|
4
|
+
copyright owner. The terms are the PolyForm Shield License 1.0.0 below.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# PolyForm Shield License 1.0.0
|
|
9
|
+
|
|
10
|
+
<https://polyformproject.org/licenses/shield/1.0.0>
|
|
11
|
+
|
|
12
|
+
## Acceptance
|
|
13
|
+
|
|
14
|
+
In order to get any license under these terms, you must agree to them as both strict obligations and conditions to all your licenses.
|
|
15
|
+
|
|
16
|
+
## Copyright License
|
|
17
|
+
|
|
18
|
+
The licensor grants you a copyright license for the software to do everything you might do with the software that would otherwise infringe the licensor's copyright in it for any permitted purpose. However, you may only distribute the software according to [Distribution License](#distribution-license) and make changes or new works based on the software according to [Changes and New Works License](#changes-and-new-works-license).
|
|
19
|
+
|
|
20
|
+
## Distribution License
|
|
21
|
+
|
|
22
|
+
The licensor grants you an additional copyright license to distribute copies of the software. Your license to distribute covers distributing the software with changes and new works permitted by [Changes and New Works License](#changes-and-new-works-license).
|
|
23
|
+
|
|
24
|
+
## Notices
|
|
25
|
+
|
|
26
|
+
You must ensure that anyone who gets a copy of any part of the software from you also gets a copy of these terms or the URL for them above, as well as copies of any plain-text lines beginning with `Required Notice:` that the licensor provided with the software. For example:
|
|
27
|
+
|
|
28
|
+
> Required Notice: Copyright Yoyodyne, Inc. (http://example.com)
|
|
29
|
+
|
|
30
|
+
## Changes and New Works License
|
|
31
|
+
|
|
32
|
+
The licensor grants you an additional copyright license to make changes and new works based on the software for any permitted purpose.
|
|
33
|
+
|
|
34
|
+
## Patent License
|
|
35
|
+
|
|
36
|
+
The licensor grants you a patent license for the software that covers patent claims the licensor can license, or becomes able to license, that you would infringe by using the software.
|
|
37
|
+
|
|
38
|
+
## Noncompete
|
|
39
|
+
|
|
40
|
+
Any purpose is a permitted purpose, except for providing any product that competes with the software or any product the licensor or any of its affiliates provides using the software.
|
|
41
|
+
|
|
42
|
+
## Competition
|
|
43
|
+
|
|
44
|
+
Goods and services compete even when they provide functionality through different kinds of interfaces or for different technical platforms. Applications can compete with services, libraries with plugins, frameworks with development tools, and so on, even if they're written in different programming languages or for different computer architectures. Goods and services compete even when provided free of charge. If you market a product as a practical substitute for the software or another product, it definitely competes.
|
|
45
|
+
|
|
46
|
+
## New Products
|
|
47
|
+
|
|
48
|
+
If you are using the software to provide a product that does not compete, but the licensor or any of its affiliates brings your product into competition by providing a new version of the software or another product using the software, you may continue using versions of the software available under these terms beforehand to provide your competing product, but not any later versions.
|
|
49
|
+
|
|
50
|
+
## Discontinued Products
|
|
51
|
+
|
|
52
|
+
You may begin using the software to compete with a product or service that the licensor or any of its affiliates has stopped providing, unless the licensor includes a plain-text line beginning with `Licensor Line of Business:` with the software that mentions that line of business. For example:
|
|
53
|
+
|
|
54
|
+
> Licensor Line of Business: YoyodyneCMS Content Management System (http://example.com/cms)
|
|
55
|
+
|
|
56
|
+
## Sales of Business
|
|
57
|
+
|
|
58
|
+
If the licensor or any of its affiliates sells a line of business developing the software or using the software to provide a product, the buyer can also enforce [Noncompete](#noncompete) for that product.
|
|
59
|
+
|
|
60
|
+
## Fair Use
|
|
61
|
+
|
|
62
|
+
You may have "fair use" rights for the software under the law. These terms do not limit them.
|
|
63
|
+
|
|
64
|
+
## No Other Rights
|
|
65
|
+
|
|
66
|
+
These terms do not allow you to sublicense or transfer any of your licenses to anyone else, or prevent the licensor from granting licenses to anyone else. These terms do not imply any other licenses.
|
|
67
|
+
|
|
68
|
+
## Patent Defense
|
|
69
|
+
|
|
70
|
+
If you make any written claim that the software infringes or contributes to infringement of any patent, your patent license for the software granted under these terms ends immediately. If your company makes such a claim, your patent license ends immediately for work on behalf of your company.
|
|
71
|
+
|
|
72
|
+
## Violations
|
|
73
|
+
|
|
74
|
+
The first time you are notified in writing that you have violated any of these terms, or done anything with the software not covered by your licenses, your licenses can nonetheless continue if you come into full compliance with these terms, and take practical steps to correct past violations, within 32 days of receiving notice. Otherwise, all your licenses end immediately.
|
|
75
|
+
|
|
76
|
+
## No Liability
|
|
77
|
+
|
|
78
|
+
***As far as the law allows, the software comes as is, without any warranty or condition, and the licensor will not be liable to you for any damages arising out of these terms or the use or nature of the software, under any kind of legal claim.***
|
|
79
|
+
|
|
80
|
+
## Definitions
|
|
81
|
+
|
|
82
|
+
The **licensor** is the individual or entity offering these terms, and the **software** is the software the licensor makes available under these terms.
|
|
83
|
+
|
|
84
|
+
A **product** can be a good or service, or a combination of them.
|
|
85
|
+
|
|
86
|
+
**You** refers to the individual or entity agreeing to these terms.
|
|
87
|
+
|
|
88
|
+
**Your company** is any legal entity, sole proprietorship, or other kind of organization that you work for, plus all its affiliates.
|
|
89
|
+
|
|
90
|
+
**Affiliates** means the other organizations than an organization has control over, is under the control of, or is under common control with.
|
|
91
|
+
|
|
92
|
+
**Control** means ownership of substantially all the assets of an entity, or the power to direct its management and policies by vote, contract, or otherwise. Control can be direct or indirect.
|
|
93
|
+
|
|
94
|
+
**Your licenses** are all the licenses granted to you for the software under these terms.
|
|
95
|
+
|
|
96
|
+
**Use** means anything you do with the software requiring one of your licenses.
|
data/README.md
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# runtime_analysis
|
|
2
|
+
|
|
3
|
+
A stack trace tells you where a nil was used. `ra where_nil_comes_from` tells you which method
|
|
4
|
+
returned it, in which recorded runs, and what raised afterwards:
|
|
5
|
+
|
|
6
|
+
```text
|
|
7
|
+
NoMethodError: undefined method 'unlock!' for nil
|
|
8
|
+
app/models/scheduler.rb:13:in 'advance'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
$ ra where_nil_comes_from Curriculum#next_after
|
|
13
|
+
|
|
14
|
+
Curriculum#next_after
|
|
15
|
+
· nil returns and nil arguments
|
|
16
|
+
Curriculum#next_after returned nil
|
|
17
|
+
1 of 31 app runs · 0 of 2 spec calls
|
|
18
|
+
1 of 1 unwound with NoMethodError in Scheduler#advance (app/models/scheduler.rb:13)
|
|
19
|
+
otherwise returned Book
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`next_after` returned nil once, in a request, and in none of its specs. That run is the one that
|
|
23
|
+
raised.
|
|
24
|
+
|
|
25
|
+
This gem is the recorder. It runs inside your tests or your app and writes down each call your code
|
|
26
|
+
makes: who called which method, from which line, with which classes, and what came back. The `ra`
|
|
27
|
+
binary reads that recording and answers questions from it, in your terminal, for your coding agent
|
|
28
|
+
over MCP and in your editor over LSP.
|
|
29
|
+
|
|
30
|
+
## Install
|
|
31
|
+
|
|
32
|
+
```sh
|
|
33
|
+
curl -fsSL https://www.runtimeanalyz.ing/install.sh | sh # the ra binary, and a walk through sign-in and the recorder gem
|
|
34
|
+
ra record # runs your tests once and changes no file in your project
|
|
35
|
+
ra verify_mock spec # the stubs that differ from your real code
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The installer offers `gem install runtime_analysis` for the Ruby your project runs on. You do not
|
|
39
|
+
add the gem to your Gemfile to try it: `ra record` loads it into the command, and `git status`
|
|
40
|
+
shows nothing new afterwards. The gem ships no executable, so the binary is the only `ra`.
|
|
41
|
+
|
|
42
|
+
## The free tools
|
|
43
|
+
|
|
44
|
+
One line from each, on the
|
|
45
|
+
[example Rails app](https://github.com/runtime-analysis/rails_example):
|
|
46
|
+
|
|
47
|
+
```text
|
|
48
|
+
$ ra where_nil_comes_from Curriculum#next_after
|
|
49
|
+
1 of 1 unwound with NoMethodError in Scheduler#advance (app/models/scheduler.rb:13)
|
|
50
|
+
$ ra verify_mock spec/models/enrollment_spec.rb
|
|
51
|
+
the real one returns an Array whose elements receive #unlocked?, #title
|
|
52
|
+
$ ra what_calls Finance::Accounts#debit
|
|
53
|
+
Transfer#call app/services/transfer.rb:9 5 via public_send
|
|
54
|
+
$ ra what_it_receives Report#summary_line
|
|
55
|
+
classes Book 65 · RSpec::Mocks::InstanceVerifyingDouble 1
|
|
56
|
+
$ ra who_actually_answered app/billing/billing/checkout.rb:15
|
|
57
|
+
never answered here Mailer::Legacy, SlackNotifier, SmsNotifier
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
They need a free account, made the first time `ra login` runs. The 29 Pro tools read the same
|
|
61
|
+
recording; [www.runtimeanalyz.ing](https://www.runtimeanalyz.ing) lists them with their prices.
|
|
62
|
+
|
|
63
|
+
## In your process
|
|
64
|
+
|
|
65
|
+
The recorder wraps each method defined under `app` and `lib` and writes a row for each call to
|
|
66
|
+
files in `tmp/runtime_analysis`. A C extension does the wrapping and a thread of its own does the
|
|
67
|
+
writing, so your code never waits on the disk. When the buffer is full a row is dropped and
|
|
68
|
+
counted. An exception your method raises reaches your code unchanged.
|
|
69
|
+
|
|
70
|
+
It writes class names, method names, file paths, line numbers, the ids Ruby gives objects during a
|
|
71
|
+
run, and exception classes. It never writes a value: no strings, numbers, attributes, SQL or
|
|
72
|
+
`inspect` output. It makes no network call.
|
|
73
|
+
|
|
74
|
+
### Probing a method's values
|
|
75
|
+
|
|
76
|
+
To tell whether a method is asked the same thing over and over, name it in `config.probe`, or in
|
|
77
|
+
`RUNTIME_ANALYSIS_PROBE` separated by commas, the way the tools print it: `Graph.run` for a class
|
|
78
|
+
method, `Order#total` for an instance method.
|
|
79
|
+
|
|
80
|
+
```ruby
|
|
81
|
+
RuntimeAnalysis.configure { |c| c.probe = ["Pricing.rate", "Order#total"] }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Each call to a probed method also writes its receiver, its arguments and what it returned. An
|
|
85
|
+
Integer, Float, Symbol, `true`, `false`, `nil` or a String of up to 128 bytes is written as a hash
|
|
86
|
+
of the value and its class, so equal values match and the value itself is not in the file. Ruby
|
|
87
|
+
seeds `hash` afresh in each process, so two hashes compare only within the process that wrote them.
|
|
88
|
+
Any other object is written as its object id. Calls to other methods are recorded as before, and a
|
|
89
|
+
probed method costs more than the rest because it never takes the C extension's fast path.
|
|
90
|
+
`RUNTIME_ANALYSIS_PROBE=*` probes every method; it is there to measure the cost and nothing else.
|
|
91
|
+
|
|
92
|
+
On Redmine's 5,917 tests, recording at the lowest tier used 15.9% more CPU than not recording.
|
|
93
|
+
[What recording costs](https://www.runtimeanalyz.ing/performance) has the rest of the
|
|
94
|
+
measurements.
|
|
95
|
+
|
|
96
|
+
It runs on CRuby 3.2 and later, on Linux and macOS, and installing it needs a C compiler and make.
|
|
97
|
+
A project's source is read with prism 1.3 and later, prism 2 included, its Sorbet sigs with
|
|
98
|
+
sorbet-runtime 0.5.11162 and later, and its RBS files with rbs 3.8 and later, rbs 4 included. The
|
|
99
|
+
suite runs against the oldest and the newest of each.
|
|
100
|
+
|
|
101
|
+
## In production
|
|
102
|
+
|
|
103
|
+
On a server, record only the requests that fail:
|
|
104
|
+
|
|
105
|
+
```ruby
|
|
106
|
+
RuntimeAnalysis.configure do |c|
|
|
107
|
+
c.errors_only = true
|
|
108
|
+
c.error_signal = :tracker
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
Sentry.add_global_event_processor do |event, hint|
|
|
112
|
+
RuntimeAnalysis.reported(hint.is_a?(Hash) && hint[:exception]) do |origin|
|
|
113
|
+
event.contexts[:nil_origin] = origin
|
|
114
|
+
event.tags = event.tags.merge(nil_origin: origin[:returned_by]) if origin[:returned_by]
|
|
115
|
+
end
|
|
116
|
+
event
|
|
117
|
+
end
|
|
118
|
+
|
|
119
|
+
RuntimeAnalysis.start!
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
A healthy request writes nothing, and a failed one is written as one file. In a Rails app the gem
|
|
123
|
+
puts its middleware first in the stack, and an ActiveJob job or a rake task that raises is kept
|
|
124
|
+
too. For Sidekiq, add the `runtime_analysis-sidekiq` gem.
|
|
125
|
+
|
|
126
|
+
The second block is how the recorder learns which requests failed: your error tracker tells it,
|
|
127
|
+
from the tracker's own callback. That one is for Sentry.
|
|
128
|
+
[Configuration](https://www.runtimeanalyz.ing/configuration#your-error-tracker) has Honeybadger's,
|
|
129
|
+
and a prompt that has your coding agent write the callback for any other tracker. An error that is
|
|
130
|
+
a method called on nil then arrives at the tracker with a `nil_origin` context:
|
|
131
|
+
|
|
132
|
+
> `upcase` was called on nil returned by Account#nickname (app/models/account.rb:6), in
|
|
133
|
+
> Report#title, during GET /title
|
|
134
|
+
|
|
135
|
+
The context also says what kind of nil it was and the line it came from: a NULL column, a lookup
|
|
136
|
+
that matched nothing, a missing key, an unset `ENV` variable. For a NULL column it lists up to five
|
|
137
|
+
lines of your code that could have written it. Most of that is read from an index that
|
|
138
|
+
`ra nil_index` builds from your source in CI or at deploy, into
|
|
139
|
+
`config/runtime_analysis/nil_index.json`. All of it is in this gem, with no licence check, and it
|
|
140
|
+
goes to your own tracker and nowhere else.
|
|
141
|
+
|
|
142
|
+
`c.ring` is the most one request can hold on each recording thread, in bytes or as `"2MB"`, and 8MB
|
|
143
|
+
when you leave it out. `RuntimeAnalysis.stats[:largest_request]` says how much your largest request
|
|
144
|
+
took. An exception raised inside the recorder is caught and counted in `stats[:errors]`, your call
|
|
145
|
+
carries on, and after ten of them the recorder switches itself off for the process.
|
|
146
|
+
|
|
147
|
+
Nobody has run it in production yet. A Rails server has frozen with the gem enabled in development,
|
|
148
|
+
under concurrent requests during a code reload.
|
|
149
|
+
[Questions](https://www.runtimeanalyz.ing/questions#can-it-take-my-app-down) covers both and the
|
|
150
|
+
other limits.
|
|
151
|
+
|
|
152
|
+
## Source
|
|
153
|
+
|
|
154
|
+
This gem's source is at
|
|
155
|
+
[github.com/runtime-analysis/runtime_analysis](https://github.com/runtime-analysis/runtime_analysis).
|
|
156
|
+
Configuration, CI setup, tiers, errors-only recording and adaptive mode are described at
|
|
157
|
+
[www.runtimeanalyz.ing/configuration](https://www.runtimeanalyz.ing/configuration), and what
|
|
158
|
+
leaves your machine at [www.runtimeanalyz.ing/data](https://www.runtimeanalyz.ing/data).
|
|
159
|
+
|
|
160
|
+
## License
|
|
161
|
+
|
|
162
|
+
Copyright (c) 2026. All rights reserved. Licensed by Espíritos Algébricos – Unipessoal Lda under the
|
|
163
|
+
[PolyForm Shield License 1.0.0](LICENSE.txt). The source is available: you may use it, change it and
|
|
164
|
+
share it for any purpose except providing a product that competes with it.
|