Line data Source code
1 : #pragma once 2 : 3 : #include <memory> 4 : 5 : #include "envoy/common/pure.h" 6 : 7 : namespace Envoy { 8 : namespace Upstream { 9 : 10 : /** 11 : * A monitor for "passive" health check events that might happen on every thread. For example, if a 12 : * special HTTP header is received, the data plane may decide to fast fail a host to avoid waiting 13 : * for the full Health Check interval to elapse before determining the host is active health check 14 : * failed. 15 : */ 16 : class HealthCheckHostMonitor { 17 : public: 18 1574 : virtual ~HealthCheckHostMonitor() = default; 19 : 20 : /** 21 : * The reason the host is being set unhealthy via the monitor. 22 : */ 23 : enum class UnhealthyType { 24 : // Protocol indication (e.g., x-envoy-immediate-health-check-fail) that the host should be 25 : // immediately taken out of rotation. 26 : ImmediateHealthCheckFail 27 : }; 28 : 29 : /** 30 : * Mark the host as unhealthy. Note that this may not be immediate as events may need to be 31 : * propagated between multiple threads. 32 : * @param type specifies the reason the host is being marked unhealthy. 33 : */ 34 : virtual void setUnhealthy(UnhealthyType type) PURE; 35 : }; 36 : 37 : using HealthCheckHostMonitorPtr = std::unique_ptr<HealthCheckHostMonitor>; 38 : 39 : } // namespace Upstream 40 : } // namespace Envoy