Module: Greenroom

Defined in:
lib/greenroom.rb,
lib/greenroom/cli.rb,
lib/greenroom/digest.rb,
lib/greenroom/version.rb,
lib/greenroom/recorder.rb,
lib/greenroom/reporter.rb,
lib/greenroom/cli/check.rb,
lib/greenroom/cli/judge.rb,
lib/greenroom/census/job.rb,
lib/greenroom/census/run.rb,
lib/greenroom/census/cursor.rb,
lib/greenroom/census/middleware.rb,
lib/greenroom/reporter/new_relic.rb,
lib/greenroom/experiment_behavior.rb,
sig/greenroom.rbs

Defined Under Namespace

Modules: CLI, Census, Digest, ExperimentBehavior Classes: Error, MiddlewareNotRegisteredError, NotRegisteredError, Recorder, Reporter

Constant Summary collapse

VERSION =

Returns:

  • (String)
"0.1.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.reporterObject

Where recorded events go. Defaults to Reporter::Null, so a host that has not configured delivery yet gets silence instead of a load-time error.



38
39
40
# File 'lib/greenroom.rb', line 38

def reporter
  @reporter
end

Class Method Details

.assert_registered!Object

Meant to run at boot. A host that includes only ExperimentBehavior in its experiment class, and forgets Scientist::Experiment, gets no error and no candidate ever runs: enabled? and publish both exist, but Scientist::Experiment.new still returns a Scientist::Default (enabled? always false), so every experiment stays quietly inert forever. Probing at boot turns that silent misconfiguration into a startup failure instead.

Raises:



47
48
49
50
51
52
53
# File 'lib/greenroom.rb', line 47

def assert_registered!
  return unless Scientist::Experiment.new("greenroom-probe").instance_of?(Scientist::Default)

  raise NotRegisteredError,
    "No class includes Scientist::Experiment yet. Add `include Scientist::Experiment` " \
    "to the class that runs your experiments."
end