Documentation ¶
Index ¶
- Constants
- Variables
- func Use()
- type AggregateOption
- type AggregateOptions
- type ComponentsDisclosureControl
- type CompositeHealth
- type CompositeIndicator
- type DetailedHealth
- type DetailsDisclosureControl
- type DisclosureControl
- type DisclosureControlFunc
- type Health
- type HealthProperties
- type Indicator
- type IndicatorOption
- type IndicatorOptions
- type Options
- type PingIndicator
- type Registrar
- type ShowMode
- type SimpleHealth
- type SimpleStatusAggregator
- type StaticStatusCodeMapper
- type Status
- type StatusAggregator
- type StatusCodeMapper
- type StatusOrders
- type StatusProperties
- type SystemHealthRegistrar
Constants ¶
const (
HealthPropertiesPrefix = "management.endpoint.health"
)
Variables ¶
var DefaultStaticStatusCodeMapper = StaticStatusCodeMapper{ StatusUp: http.StatusOK, StatusDown: http.StatusServiceUnavailable, StatusOutOfService: http.StatusServiceUnavailable, StatusUnknown: http.StatusInternalServerError, }
var ( DefaultStatusOrders = []Status{ StatusDown, StatusOutOfService, StatusUp, StatusDown, } )
var Module = &bootstrap.Module{ Name: "actuator-health", Precedence: bootstrap.ActuatorPrecedence, Options: []fx.Option{ fx.Provide( BindHealthProperties, NewSystemHealthRegistrar, provideInterfaces, ), }, }
Functions ¶
Types ¶
type AggregateOption ¶
type AggregateOption struct {
StatusOrders []Status
}
type AggregateOptions ¶
type AggregateOptions func(opt *AggregateOption)
type CompositeHealth ¶
type CompositeHealth struct { SimpleHealth Components map[string]Health `json:"components,omitempty"` }
CompositeHealth implement Health
func NewCompositeHealth ¶
func NewCompositeHealth(status Status, description string, components map[string]Health) *CompositeHealth
type CompositeIndicator ¶
type CompositeIndicator struct {
// contains filtered or unexported fields
}
CompositeIndicator implement Indicator and SystemHealthRegistrar
func NewCompositeIndicator ¶
func NewCompositeIndicator(opts ...IndicatorOptions) *CompositeIndicator
func (*CompositeIndicator) Add ¶
func (c *CompositeIndicator) Add(contributors ...Indicator)
func (*CompositeIndicator) Health ¶
func (c *CompositeIndicator) Health(ctx context.Context, options Options) Health
func (*CompositeIndicator) Name ¶
func (c *CompositeIndicator) Name() string
type DetailedHealth ¶
type DetailedHealth struct { SimpleHealth Details map[string]interface{} `json:"details,omitempty"` }
DetailedHealth implement Health
func NewDetailedHealth ¶
func NewDetailedHealth(status Status, description string, details map[string]interface{}) *DetailedHealth
type DisclosureControl ¶
type DisclosureControl interface { DetailsDisclosureControl ComponentsDisclosureControl }
type DisclosureControlFunc ¶
DisclosureControlFunc convert function to DisclosureControl This type can be registered via Registrar.Register
func (DisclosureControlFunc) ShouldShowComponents ¶
func (fn DisclosureControlFunc) ShouldShowComponents(ctx context.Context) bool
func (DisclosureControlFunc) ShouldShowDetails ¶
func (fn DisclosureControlFunc) ShouldShowDetails(ctx context.Context) bool
type HealthProperties ¶
type HealthProperties struct { Status StatusProperties `json:"status"` // When to show components. If not specified the 'show-details' setting will be used. ShowComponents *ShowMode `json:"show-components"` // When to show full health details. ShowDetails ShowMode `json:"show-details"` // Permisions used to determine whether or not a user is authorized to be shown details. // When empty, all authenticated users are authorized. Permissions utils.CommaSeparatedSlice `json:"permissions"` }
func BindHealthProperties ¶
func BindHealthProperties(ctx *bootstrap.ApplicationContext) HealthProperties
BindHealthProperties create and bind SessionProperties, with a optional prefix
func NewHealthProperties ¶
func NewHealthProperties() *HealthProperties
NewSessionProperties create a SessionProperties with default values
type IndicatorOption ¶
type IndicatorOption struct { Name string Contributors []Indicator Aggregator StatusAggregator }
type IndicatorOptions ¶
type IndicatorOptions func(opt *IndicatorOption)
type PingIndicator ¶
type PingIndicator struct { }
func (PingIndicator) Health ¶
func (b PingIndicator) Health(ctx context.Context, options Options) Health
func (PingIndicator) Name ¶
func (b PingIndicator) Name() string
type Registrar ¶
type Registrar interface { // Register configure SystemHealthRegistrar and HealthEndpoint // supported input parameters are: // - Indicator // - StatusAggregator // - DetailsDisclosureControl // - ComponentsDisclosureControl // - DisclosureControl Register(items ...interface{}) error // MustRegister same as Register, but panic if there is error MustRegister(items ...interface{}) }
type ShowMode ¶
type ShowMode int
ShowMode is options for showing items in responses from the HealthEndpoint web extensions.
const ( // ShowModeNever Never show the item in the response. ShowModeNever ShowMode = iota // ShowModeAuthorized Show the item in the response when accessed by an authorized user. ShowModeAuthorized // ShowModeAlways Always show the item in the response. ShowModeAlways // ShowModeCustom Shows the item in response with a customized rule. ShowModeCustom )
func (ShowMode) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*ShowMode) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type SimpleHealth ¶
SimpleHealth implements Health
func (SimpleHealth) Description ¶
func (h SimpleHealth) Description() string
func (SimpleHealth) Status ¶
func (h SimpleHealth) Status() Status
type SimpleStatusAggregator ¶
type SimpleStatusAggregator struct {
// contains filtered or unexported fields
}
SimpleStatusAggregator implements StatusAggregator
func NewSimpleStatusAggregator ¶
func NewSimpleStatusAggregator(opts ...AggregateOptions) *SimpleStatusAggregator
type StaticStatusCodeMapper ¶
func (StaticStatusCodeMapper) StatusCode ¶
func (m StaticStatusCodeMapper) StatusCode(_ context.Context, status Status) int
type Status ¶
type Status int
func (Status) MarshalText ¶
MarshalText implements encoding.TextMarshaler
func (*Status) UnmarshalText ¶
UnmarshalText implements encoding.TextUnmarshaler
type StatusAggregator ¶
type StatusOrders ¶
type StatusOrders []Status
func (*StatusOrders) UnmarshalText ¶
func (o *StatusOrders) UnmarshalText(data []byte) error
encoding.TextUnmarshaler
type StatusProperties ¶
type StatusProperties struct { // Comma-separated list of health statuses in order of severity. Orders StatusOrders `json:"order"` // Mapping of health statuses to HTTP status codes. By default, registered health // statuses map to sensible defaults (for example, UP maps to 200). ScMapping map[Status]int `json:"http-mapping"` }
type SystemHealthRegistrar ¶
type SystemHealthRegistrar struct { Indicator *CompositeIndicator DetailsDisclosure DetailsDisclosureControl ComponentsDisclosure ComponentsDisclosureControl }
SystemHealthRegistrar implements Registrar
func NewSystemHealthRegistrar ¶
func NewSystemHealthRegistrar(di regDI) *SystemHealthRegistrar
func (*SystemHealthRegistrar) MustRegister ¶
func (i *SystemHealthRegistrar) MustRegister(items ...interface{})
func (*SystemHealthRegistrar) Register ¶
func (i *SystemHealthRegistrar) Register(items ...interface{}) error
Register configure SystemHealthRegistrar supported input parameters are:
- Indicator
- StatusAggregator
- DetailsDisclosureControl
- ComponentsDisclosureControl
- DisclosureControl