Lumitrace instruments Ruby source by wrapping selected expression nodes with
Lumitrace::R(id, (expr)). It does not rewrite the
entire AST, so coverage is best described as “expressions that are safe to wrap
in parentheses and call-position contexts.”
This document lists what is supported today, and what is intentionally skipped to avoid breaking valid Ruby syntax.
The following node kinds are instrumented when they appear in normal expression positions:
Prism::CallNode)
foo(bar)
yield expressions (Prism::YieldNode)
yield value
Prism::LocalVariableReadNode)
x
Prism::ItLocalVariableReadNode)
it
Prism::ConstantReadNode)
SomeConst
Prism::InstanceVariableReadNode)
@value
Prism::ClassVariableReadNode)
@@count
Prism::GlobalVariableReadNode)
$stdout
Notes:
These are intentionally skipped to keep output valid Ruby:
def, class, module, if, case, while, begin, rescue, etc.def foo
bar
end
1, "str", :sym, true, false, nildo ... end / { ... }) are
instrumented at the call expression level. Example:
items.each do |x|
x + 1
end
alias $ERROR_INFO $!alias old_name new_namedef Foo.bar
1
end
Foo is not instrumented here."#@path?#@query"
@path and @query inside the interpolation are not instrumented.token: style):
ec2_metadata_request(EC2_IAM_INFO, token:)
token read is not instrumented.defined?(...):
defined?(foo + bar)
foo + bar) is not instrumented, to preserve defined? semantics.All skips above correspond to syntactic positions where wrapping the token with
expr_record(...) would change the Ruby grammar (e.g., alias operands, method
name positions, or implicit keyword arguments).
If you want additional coverage, we can add more targeted rewrites, but they must preserve valid syntax in those special contexts.