Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Check ¶
type Check interface { Validatable RunFn(s *Store) func() Check(resp *Response) bool }
Check is a interface for monitoring checks.
type CheckResult ¶
type CheckResult struct { MonitorID string ServiceID string At time.Time Success bool Trace *Trace Error error StatusCode int }
CheckResult is a struct.
type Config ¶
type Config struct { Server *Server `hcl:"server,block"` Monitors []*Monitor `hcl:"monitor,block"` }
Config keeps monitor configuration.
func LoadConfig ¶
LoadConfig loads and parses config from given path.
func ParseConfig ¶
ParseConfig parses config from given data.
func (*Config) ActiveServices ¶
ActiveServices returns list of active services per monitor.
func (*Config) IsTLSConfigured ¶ added in v0.1.5
IsTLSConfigured returns true if config for TLS is valid.
type Details ¶
type Details struct { Trace *Trace `json:"trace"` Error *ErrorDetails `json:"error,omitempty"` Response *ResponseDetails `json:"response,omitempty"` }
Details for checks.
type ErrorDetails ¶ added in v0.1.5
type ErrorDetails struct {
Message string `json:"message"`
}
ErrorDetails contains response error.
type Expect ¶
type Expect struct { // label Subject string `hcl:"subject,label"` // body Inclusion []int `hcl:"in"` }
Expect defines service assertion.
type HTTPCheck ¶
type HTTPCheck struct { // body IntervalSec uint64 `hcl:"interval"` TimeoutSec uint64 `hcl:"timeout"` Addr string `hcl:"addr"` Expectations []Expect `hcl:"expect,block"` // contains filtered or unexported fields }
HTTPCheck defines http type check.
type Metric ¶
type Metric struct { MonitorID string `json:"monitor_id"` ServiceID string `json:"service_id"` Bucket time.Time `json:"bucket"` Health float64 `json:"health"` Details Details `json:"details"` PassedChecks uint64 `json:"passed_checks"` FailedChecks uint64 `json:"failed_checks"` }
Metric represents metric for given time bucket.
type Monitor ¶
type Monitor struct { // label ID string `hcl:"id,label"` // body Name string `hcl:"name"` Services []*Service `hcl:"service,block"` }
Monitor keeps the configuration of a single monitor. It aggregates one or more services.
type ReadFilter ¶
type ReadFilter struct { Since time.Time TimeBucket uint TimeBucketUnit string Interval uint IntervalUnit string ActiveServices map[string][]string }
ReadFilter contains params to configure metrics read.
func (*ReadFilter) IntervalToDuration ¶
func (f *ReadFilter) IntervalToDuration() time.Duration
IntervalToDuration converts user defined interval to time.Duration.
func (*ReadFilter) Until ¶
func (f *ReadFilter) Until() time.Time
Until calculates when interval should stop.
type ResponseDetails ¶ added in v0.2.0
type ResponseDetails struct {
StatusCode int `json:"status_code"`
}
ResponseDetails contains response error.
type Runner ¶
type Runner struct {
// contains filtered or unexported fields
}
Runner is responsible for scheduling jobs.
type Server ¶ added in v0.1.5
type Server struct { BindAddress string `hcl:"bind_address"` TLSCertFile string `hcl:"tls_cert_file"` TLSKeyFile string `hcl:"tls_key_file"` }
Server configuration.
type Service ¶
type Service struct { // label ID string `hcl:"id,label"` // body Name string `hcl:"name"` HTTPChecks []*HTTPCheck `hcl:"http,block"` }
Service defines monitor checks.
type Store ¶
type Store interface { // Migrate runs right after creating a connection to store. // Store implementation is responsible for creating/migrating schema. Migrate(ctx context.Context) error // Close shuts down the connection to store. Close(ctx context.Context) // Save inserts service check result to store. Save(ctx context.Context, result *CheckResult) // Read loads all metrics from store. Read(ctx context.Context, filter *ReadFilter) ([]*Metric, error) // Truncate removes all metrics from store. Truncate(ctx context.Context) error }
Store interface.
type Trace ¶
type Trace struct { DNSLookup time.Duration `json:"dns_lookup"` TCPConnection time.Duration `json:"tcp_connection"` TLSHandshake time.Duration `json:"tls_handshake"` ServerProcessing time.Duration `json:"server_processing"` ContentTransfer time.Duration `json:"content_transfer"` Total time.Duration `json:"total"` }
Trace contains details about the request duration.