Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redis proxy traffic mirroring runtime default #8171

Closed
kb000 opened this issue Sep 6, 2019 · 2 comments · Fixed by #8089
Closed

Redis proxy traffic mirroring runtime default #8171

kb000 opened this issue Sep 6, 2019 · 2 comments · Fixed by #8089
Labels

Comments

@kb000
Copy link
Contributor

kb000 commented Sep 6, 2019

MirrorPolicyImpl::shouldMirror will override a default runtime fraction of 0, and instead mirror 100% of the time.

bool MirrorPolicyImpl::shouldMirror(const std::string& command) const {
if (!upstream_) {
return false;
}
if (exclude_read_commands_ && Common::Redis::SupportedCommands::writeCommands().find(command) ==
Common::Redis::SupportedCommands::writeCommands().end()) {
return false;
}
if (default_value_.numerator() > 0) {
return runtime_.snapshot().featureEnabled(runtime_key_, default_value_);
}
return true;
}

This is at odds with documentation:

// If not specified, all requests to the target cluster will be mirrored. If
// specified, Envoy will lookup the runtime key to get the % of requests to
// mirror. Valid values are from 0 to 10000, allowing for increments of
// 0.01% of requests to be mirrored. If the runtime key is specified in the
// configuration but not present in runtime, 0 is the default and thus 0% of
// requests will be mirrored.

    // If not specified, all requests to the target cluster will be mirrored. If
    // specified, Envoy will lookup the runtime key to get the % of requests to
    // mirror. Valid values are from 0 to 10000, allowing for increments of
    // 0.01% of requests to be mirrored. If the runtime key is specified in the
    // configuration but not present in runtime, 0 is the default and thus 0% of
    // requests will be mirrored.

And also inconsistent with the behavior of http router traffic mirroring:

if (config.request_mirror_policy().has_runtime_fraction()) {
runtime_key_ = config.request_mirror_policy().runtime_fraction().runtime_key();
default_value_ = config.request_mirror_policy().runtime_fraction().default_value();
} else {
runtime_key_ = config.request_mirror_policy().runtime_key();
default_value_.set_numerator(0);

@kb000
Copy link
Contributor Author

kb000 commented Sep 6, 2019

@HenryYYang

@zuercher zuercher added bug help wanted Needs help! labels Sep 6, 2019
@zuercher
Copy link
Member

zuercher commented Sep 6, 2019

Looks like it completely ignores the deprecated runtime_key field and only heeds runtime_fraction if the default numerator is > 0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants