Skip to content

Switch to using declarative behavior registration

What does this MR do and why?

Part of #350944

It removes the public *_behavior methods because they're inefficient -- we scan all public methods and look for ones that end in _behavior.

A better way is to register the behaviors directly, with a block (as is used in each case here), or by specifying a private method name to call.

So for instance, we're passing blocks to each case in this MR because they're all very simple, but for more advanced logic the method can be specified for the variant:

class ExampleExperiment < ApplicationExperiment
  control :my_complex_control_method

  private

  def my_complex_control_method
    # ... several lines of code
  end
end

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jeremy Jackson

Merge request reports