Documentation ¶
Overview ¶
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright (c) 2016-2019 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BinaryFilter ¶
type BinaryFilter struct {
Healthy bool
}
BinaryFilter is a filter which can be switched to all-healthy vs. all-unhealthy.
func NewBinaryFilter ¶
func NewBinaryFilter() *BinaryFilter
NewBinaryFilter returns a new BinaryFilter that defaults to all-healthy.
type Filter ¶
Filter filters out unhealthy hosts from a host list.
func NewFilter ¶
func NewFilter(config FilterConfig, checker Checker) Filter
NewFilter creates a new Filter. Filter is stateful -- consecutive runs are required to detect healthy / unhealthy hosts.
type FilterConfig ¶
type FilterConfig struct { // Fails is the number of consecutive failed health checks for a host to be // considered unhealthy. Fails int `yaml:"fails"` // Passes is the number of consecutive passed health checks for a host to be // considered healthy. Passes int `yaml:"passes"` // Timeout of each individual health check. Timeout time.Duration `yaml:"timeout"` }
FilterConfig defines configuration for Filter.
type IdentityFilter ¶
type IdentityFilter struct{}
IdentityFilter is a Filter which never filters out any addresses.
type List ¶
List is a hostlist.List which can be passively health checked.
func NoopFailed ¶
NoopFailed converts a hostlist.List to a List by making the Failed method a no-op. Useful for using a Monitor in place of a Passive.
type ManualFilter ¶
ManualFilter is a Filter whose unhealthy hosts can be manually changed.
func NewManualFilter ¶
func NewManualFilter() *ManualFilter
NewManualFilter returns a new ManualFilter.
type Monitor ¶
type Monitor struct {
// contains filtered or unexported fields
}
Monitor performs active health checks asynchronously. Can be used in as a hostlist.List.
func NewMonitor ¶
func NewMonitor(config MonitorConfig, hosts hostlist.List, filter Filter) *Monitor
NewMonitor monitors the health of hosts using filter.
type MonitorConfig ¶
MonitorConfig defines configuration for Monitor.
type Passive ¶
type Passive struct {
// contains filtered or unexported fields
}
Passive wraps a passive health check and can be used as a hostlist.List. See PassiveFilter for passive health check documenation.
func NewPassive ¶
func NewPassive(hosts hostlist.List, filter PassiveFilter) *Passive
NewPassive returns a new Passive.
type PassiveFilter ¶
PassiveFilter filters unhealthy hosts passively by tracking failed requests to hosts. Clients are responsible for marking failures from individual hosts, and PassiveFilter updates which hosts are unhealthy. It is recommended that clients only mark failures for network errors, not HTTP errors.
func NewPassiveFilter ¶
func NewPassiveFilter(config PassiveFilterConfig, clk clock.Clock) PassiveFilter
NewPassiveFilter creates a new PassiveFilter.
type PassiveFilterConfig ¶
type PassiveFilterConfig struct { // Fails is the number of failed requests that must occur during the FailTimeout // period for a host to be marked as unhealthy. Fails int `yaml:"fails"` // FailTimeout is the window of time during which Fails must occur for a host // to be marked as unhealthy. // // FailTimeout is also the time for which a server is marked unhealthy. FailTimeout time.Duration `yaml:"fail_timeout"` }
PassiveFilterConfig defines configuration for PassiveFilter.