-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Outlier detection config #543
Outlier detection config #543
Conversation
needs docs |
EventLoggerPtr event_logger) | ||
: dispatcher_(dispatcher), runtime_(runtime), time_source_(time_source), | ||
DetectorConfig::DetectorConfig(const Json::ObjectPtr& json_config) { | ||
interval_ms_ = static_cast<uint64_t>(json_config->getInteger("interval_ms", 10000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move these to the initializer list
@@ -17,8 +17,8 @@ DetectorPtr DetectorImplFactory::createForCluster(Cluster& cluster, | |||
// Right now we don't support any configuration but in order to make the config backwards |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete comment
@@ -17,8 +17,8 @@ DetectorPtr DetectorImplFactory::createForCluster(Cluster& cluster, | |||
// Right now we don't support any configuration but in order to make the config backwards | |||
// compatible we just look for an empty object. | |||
if (cluster_config.hasObject("outlier_detection")) { | |||
return DetectorImpl::create(cluster, dispatcher, runtime, ProdSystemTimeSource::instance_, | |||
event_logger); | |||
return DetectorImpl::create(cluster, cluster_config.getObject("outlier_detection", true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't "allow_empty" here (remove true param), the object must exist in this branch.
@@ -43,6 +43,27 @@ TEST(OutlierDetectorImplFactoryTest, Detector) { | |||
DetectorImplFactory::createForCluster(cluster, *loader, dispatcher, runtime, nullptr)); | |||
} | |||
|
|||
TEST(OutlierDetectorImplFactoryTest, DetectorConfig) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is not really a useful test. Can you test the config object directly, and make sure the loaded values are what you expect (or do that additionally)
45fb071
to
f15d8ae
Compare
uint64_t enforcing() { return enforcing_; } | ||
|
||
private: | ||
const uint64_t interval_ms_{}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{} is no longer needed since you are using the initializer list.
*/ | ||
class DetectorConfig { | ||
public: | ||
DetectorConfig(const Json::ObjectPtr& json_config); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pass const Json::Object&
SystemTimeSource& time_source, | ||
EventLoggerPtr event_logger); | ||
static std::shared_ptr<DetectorImpl> | ||
create(const Cluster& cluster, const Json::ObjectPtr& json_config, Event::Dispatcher& dispatcher, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pass const Json::Object&
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. fixed everywhere.
|
||
// Upstream::Outlier::Detector | ||
void addChangedStateCb(ChangeStateCb cb) override { callbacks_.push_back(cb); } | ||
|
||
private: | ||
DetectorImpl(const Cluster& cluster, Event::Dispatcher& dispatcher, Runtime::Loader& runtime, | ||
DetectorImpl(const Cluster& cluster, const Json::ObjectPtr& json_config, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: pass const Json::Object&
if (cluster_config.hasObject("outlier_detection")) { | ||
return DetectorImpl::create(cluster, dispatcher, runtime, ProdSystemTimeSource::instance_, | ||
event_logger); | ||
return DetectorImpl::create(cluster, cluster_config.getObject("outlier_detection", false), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: you don't need false param, it's the default.
619f65e
to
97209f3
Compare
Signed-off-by: Lizan Zhou <lizan@tetrate.io>
Description: this PR integrates [Envoy's ApiListener](#9516) to replace Envoy Mobile's use of the AsyncClient. Doing so gives Envoy Mobile access to all L7 facilities provided by Envoy's Http Connection Manager; including but no limited to the L7 filters. Risk Level: HIGH! This PR changes the underlying code for Envoy Mobile's core functionality Testing: unit tests updated for the dispatcher, integration tests, and e2e tests with the example apps. Additionally, the ApiListener code has been unit and integration tested in Envoy. Fixes #543 Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
Description: this PR integrates [Envoy's ApiListener](#9516) to replace Envoy Mobile's use of the AsyncClient. Doing so gives Envoy Mobile access to all L7 facilities provided by Envoy's Http Connection Manager; including but no limited to the L7 filters. Risk Level: HIGH! This PR changes the underlying code for Envoy Mobile's core functionality Testing: unit tests updated for the dispatcher, integration tests, and e2e tests with the example apps. Additionally, the ApiListener code has been unit and integration tested in Envoy. Fixes #543 Signed-off-by: Jose Nino <jnino@lyft.com> Signed-off-by: JP Simard <jp@jpsim.com>
fixes #540