зеркало из https://github.com/github/dat-science.git
Merge pull request #1 from github/include-a-timestamp-when-publishing-experiment-results
Add :timestamp to publish payload
This commit is contained in:
Коммит
cb33c05b1c
|
@ -50,6 +50,8 @@ module Dat
|
||||||
def run
|
def run
|
||||||
return run_control unless candidate? && enabled?
|
return run_control unless candidate? && enabled?
|
||||||
|
|
||||||
|
timestamp = Time.now
|
||||||
|
|
||||||
if control_runs_first?
|
if control_runs_first?
|
||||||
control = observe_control
|
control = observe_control
|
||||||
candidate = observe_candidate
|
candidate = observe_candidate
|
||||||
|
@ -59,6 +61,7 @@ module Dat
|
||||||
end
|
end
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
|
:timestamp => timestamp,
|
||||||
:candidate => candidate.payload,
|
:candidate => candidate.payload,
|
||||||
:control => control.payload,
|
:control => control.payload,
|
||||||
:first => control_runs_first? ? :control : :candidate
|
:first => control_runs_first? ? :control : :candidate
|
||||||
|
|
|
@ -106,6 +106,8 @@ class DatScienceExperimentTest < MiniTest::Unit::TestCase
|
||||||
assert_equal "foo", payload[:experiment]
|
assert_equal "foo", payload[:experiment]
|
||||||
assert_equal :control, payload[:first]
|
assert_equal :control, payload[:first]
|
||||||
|
|
||||||
|
assert_in_delta Time.now.to_f, payload[:timestamp].to_f, 2.0
|
||||||
|
|
||||||
assert payload[:control][:duration]
|
assert payload[:control][:duration]
|
||||||
assert_nil payload[:control][:exception]
|
assert_nil payload[:control][:exception]
|
||||||
assert_equal :foo, payload[:control][:value]
|
assert_equal :foo, payload[:control][:value]
|
||||||
|
|
Загрузка…
Ссылка в новой задаче