-
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
add x-envoy-immediate-health-check-fail header support #1570
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#pragma once | ||
|
||
#include <memory> | ||
|
||
namespace Envoy { | ||
namespace Upstream { | ||
|
||
/** | ||
* A monitor for "passive" health check events that might happen on every thread. For example, if a | ||
* special HTTP header is received, the data plane may decide to fast fail a host to avoid waiting | ||
* for the full HC interval to elapse before determining the host is active HC failed. | ||
*/ | ||
class HealthCheckHostMonitor { | ||
public: | ||
virtual ~HealthCheckHostMonitor() {} | ||
|
||
/** | ||
* Mark the host as unhealthy. Note that this may not be immediate as events may need to be | ||
* propagated between multiple threads. | ||
*/ | ||
virtual void setUnhealthy() PURE; | ||
}; | ||
|
||
typedef std::unique_ptr<HealthCheckHostMonitor> HealthCheckHostMonitorPtr; | ||
|
||
} // namespace Upstream | ||
} // namespace Envoy |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ | |
#include "envoy/http/codec.h" | ||
#include "envoy/network/connection.h" | ||
#include "envoy/ssl/context.h" | ||
#include "envoy/upstream/health_check_host_monitor.h" | ||
#include "envoy/upstream/load_balancer_type.h" | ||
#include "envoy/upstream/outlier_detection.h" | ||
#include "envoy/upstream/resource_manager.h" | ||
|
@@ -80,11 +81,19 @@ class Host : virtual public HostDescription { | |
virtual bool healthy() const PURE; | ||
|
||
/** | ||
* Set the host's outlier detector. Outlier detectors are assumed to be thread safe, however | ||
* a new outlier detector must be installed before the host is used across threads. Thus, | ||
* Set the host's health checker monitor. Monitors are assumed to be thread safe, however | ||
* a new monitor must be installed before the host is used across threads. Thus, | ||
* this routine should only be called on the main thread before the host is used across threads. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe add an There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no great way to do this because of how we use hosts in tests, etc. I think I'm going to skip this for now. I will make a note to look at it in a follow up. |
||
*/ | ||
virtual void setOutlierDetector(Outlier::DetectorHostSinkPtr&& outlier_detector) PURE; | ||
virtual void setHealthChecker(HealthCheckHostMonitorPtr&& health_checker) PURE; | ||
|
||
/** | ||
* Set the host's outlier detector monitor. Outlier detector monitors are assumed to be thread | ||
* safe, however a new outlier detector monitor must be installed before the host is used across | ||
* threads. Thus, this routine should only be called on the main thread before the host is used | ||
* across threads. | ||
*/ | ||
virtual void setOutlierDetector(Outlier::DetectorHostMonitorPtr&& outlier_detector) PURE; | ||
|
||
/** | ||
* @return the current load balancing weight of the host, in the range 1-100. | ||
|
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.
Yeah, I think this nomenclature is easier to parse for me.