Commit 754a6920 authored by jejacks0n's avatar jejacks0n

Provide default context key hashing strategy

- With changes in gitlab-experiment v0.6.0 this has been removed, and to
keep existing experiments running without issue, we’re providing this
less cryptic MD5 solution as the default, which we’ll work to migrate
away from over time.
parent 26a202fd
......@@ -5,4 +5,12 @@ Gitlab::Experiment.configure do |config|
config.cache = Gitlab::Experiment::Cache::RedisHashStore.new(
pool: ->(&block) { Gitlab::Redis::SharedState.with { |redis| block.call(redis) } }
)
# TODO: This will be deprecated as of v0.6.0, but needs to stay intact for
# actively running experiments until a versioning concept is put in place to
# enable migrating into the new SHA2 strategy.
config.context_hash_strategy = lambda do |source, seed|
source = source.keys + source.values if source.is_a?(Hash)
Digest::MD5.hexdigest(Array(source).map { |v| identify(v) }.unshift(seed).join('|'))
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment