Creating a module so that per thread registries can be easily created as
thread local variables.
Created a runtime registry for thread local variables in active record.
Changed the ScopeRegistry and the InstrumentationRegistry to use the
PerThreadRegistry module.
Merge pull request #10156 from wangjohn/grouping_thread_locals

Grouping thread locals in ActiveRecord