module Sashiko::Box

Wrapper around Ruby 4.0’s experimental Ruby::Box.

Ruby::Box creates an isolated loading namespace — requires, class definitions, monkey-patches, and OTel tracer providers loaded inside a Box are invisible to the rest of the process. That makes Box useful for multi-tenant observability inside a single Ruby process: each tenant gets its own Sashiko, its own OTel exporter, and its own instrumented classes.

Requires the process to be started with RUBY_BOX=1 (Box is opt-in and experimental in Ruby 4.0).

tenant_a = Sashiko::Box.new tenant_a.eval(<<~RUBY) OpenTelemetry::SDK.configure { |c| c.service_name = “tenant-a” } # … load tenant-a adapters / instrument classes … RUBY

If you want a bare Ruby::Box without Sashiko pre-required, use ::Ruby::Box.new directly.