Documentation ¶
Overview ¶
* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You 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
- func CreateHealthCheck(cfg v2.HealthCheck) types.HealthChecker
- func NewHealthCheckLogger(output string) types.HealthCheckLog
- func RegisterCommonCallbacks(name string, cb types.HealthCheckCb) bool
- func RegisterSessionFactory(p types.ProtocolName, f types.HealthCheckSessionFactory)
- func SetHealthCheckLogger(creator hcLogCreator)
- type CodeRange
- type HTTPDialSession
- type HTTPDialSessionFactory
- type HttpCheckConfig
- type TCPDialSession
- type TCPDialSessionFactory
Constants ¶
const ( DefaultTimeout = time.Second DefaultInterval = 15 * time.Second DefaultIntervalJitter = 5 * time.Millisecond DefaultHealthyThreshold uint32 = 1 DefaultUnhealthyThreshold uint32 = 1 )
const (
HTTPCheckConfigKey = "http_check_config"
)
Variables ¶
This section is empty.
Functions ¶
func CreateHealthCheck ¶
func CreateHealthCheck(cfg v2.HealthCheck) types.HealthChecker
CreateHealthCheck is an extendable function that can create different health checker by different health check session. The Default session is TCPDial session
func NewHealthCheckLogger ¶ added in v1.4.0
func NewHealthCheckLogger(output string) types.HealthCheckLog
NewHealthCheckLogger returns a hc logger
func RegisterCommonCallbacks ¶
func RegisterCommonCallbacks(name string, cb types.HealthCheckCb) bool
func RegisterSessionFactory ¶
func RegisterSessionFactory(p types.ProtocolName, f types.HealthCheckSessionFactory)
func SetHealthCheckLogger ¶ added in v1.4.0
func SetHealthCheckLogger(creator hcLogCreator)
Types ¶
type HTTPDialSession ¶ added in v0.27.0
type HTTPDialSession struct { Codes []CodeRange // contains filtered or unexported fields }
func (*HTTPDialSession) CheckHealth ¶ added in v0.27.0
func (s *HTTPDialSession) CheckHealth() bool
func (*HTTPDialSession) OnTimeout ¶ added in v0.27.0
func (s *HTTPDialSession) OnTimeout()
type HTTPDialSessionFactory ¶ added in v0.27.0
type HTTPDialSessionFactory struct{}
func (*HTTPDialSessionFactory) NewSession ¶ added in v0.27.0
func (f *HTTPDialSessionFactory) NewSession(cfg map[string]interface{}, host types.Host) types.HealthCheckSession
type HttpCheckConfig ¶ added in v0.27.0
type HttpCheckConfig struct { Port int `json:"port,omitempty"` Timeout api.DurationConfig `json:"timeout,omitempty"` Path string `json:"path,omitempty"` Method string `json:"method,omitempty"` Scheme string `json:"scheme,omitempty"` Domain string `json:"domain,omitempty"` Codes []CodeRange `json:"codes,omitempty"` }
type TCPDialSession ¶
type TCPDialSession struct {
// contains filtered or unexported fields
}
func (*TCPDialSession) CheckHealth ¶
func (s *TCPDialSession) CheckHealth() bool
func (*TCPDialSession) OnTimeout ¶
func (s *TCPDialSession) OnTimeout()
type TCPDialSessionFactory ¶
type TCPDialSessionFactory struct{}
func (*TCPDialSessionFactory) NewSession ¶
func (f *TCPDialSessionFactory) NewSession(cfg map[string]interface{}, host types.Host) types.HealthCheckSession