check

package
v1.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2020 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Overview

Package check handles check and broker management

Index

Constants

View Source
const (
	StatusActive      = "active"
	PrimaryCheckIndex = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	CreateCheckBundle(cfg *apiclient.CheckBundle) (*apiclient.CheckBundle, error)
	FetchBroker(cid apiclient.CIDType) (*apiclient.Broker, error)
	FetchBrokers() (*[]apiclient.Broker, error)
	FetchCheck(cid apiclient.CIDType) (*apiclient.Check, error)
	FetchCheckBundle(cid apiclient.CIDType) (*apiclient.CheckBundle, error)
	FetchCheckBundleMetrics(cid apiclient.CIDType) (*apiclient.CheckBundleMetrics, error)
	Get(url string) ([]byte, error)
	SearchCheckBundles(searchCriteria *apiclient.SearchQueryType, filterCriteria *apiclient.SearchFilterType) (*[]apiclient.CheckBundle, error)
	UpdateCheckBundle(cfg *apiclient.CheckBundle) (*apiclient.CheckBundle, error)
	UpdateCheckBundleMetrics(cfg *apiclient.CheckBundleMetrics) (*apiclient.CheckBundleMetrics, error)
}

API interface abstraction of circonus api (for mocking)

type Check

type Check struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Check exposes the check bundle management interface

func New

func New(apiClient API) (*Check, error)

New returns a new check instance

func (*Check) CheckMeta added in v0.16.1

func (c *Check) CheckMeta() (*Meta, error)

CheckMeta returns check id, check bundle id, and check uuid

func (*Check) CheckPeriod added in v1.0.0

func (c *Check) CheckPeriod() (uint, error)

CheckPeriod returns check bundle period (intetrval between when broker should make request)

func (*Check) FetchBrokerConfig added in v1.0.0

func (c *Check) FetchBrokerConfig() error

FetchBrokerConfig re-loads the broker using the API

func (*Check) FetchCheckConfig added in v1.0.0

func (c *Check) FetchCheckConfig() error

FetchCheckConfig re-loads the check using the API

func (*Check) FindPrimaryBrokerInstance added in v1.0.0

func (c *Check) FindPrimaryBrokerInstance(ctx context.Context, cfgs *ReverseConfigs) (string, error)

FindPrimaryBrokerInstance will walk through reverse urls to locate the instance in a broker cluster which is the current check owner. Returns the instance cn or error.

func (*Check) GetReverseConfigs added in v1.0.0

func (c *Check) GetReverseConfigs() (*ReverseConfigs, error)

GetReverseConfigs returns the reverse connection configuration(s) to use for the check

func (*Check) RefreshReverseConfig added in v1.0.0

func (c *Check) RefreshReverseConfig() error

RefreshReverseConfig refreshes the check, broker and broker tls configurations

func (*Check) SubmissionURL added in v1.1.0

func (c *Check) SubmissionURL() (string, *tls.Config, error)

SubmissionURL returns the URL to submit metrics to as well as the tls config for https

type ErrInvalidOwner added in v1.0.0

type ErrInvalidOwner struct {
	Err      string
	CheckID  string
	BrokerCN string
}

func (*ErrInvalidOwner) Error added in v1.0.0

func (e *ErrInvalidOwner) Error() string

type ErrNoOwnerFound added in v1.0.0

type ErrNoOwnerFound struct {
	Err     string
	CheckID string
}

func (*ErrNoOwnerFound) Error added in v1.0.0

func (e *ErrNoOwnerFound) Error() string

type ErrNotActive added in v1.0.0

type ErrNotActive struct {
	Err      string
	CheckID  string
	BundleID string
}

func (*ErrNotActive) Error added in v1.0.0

func (e *ErrNotActive) Error() string

type Meta added in v0.16.1

type Meta struct {
	BundleID  string
	CheckUUID string
	CheckID   string
}

Meta contains check id meta data

type ReverseConfig

type ReverseConfig struct {
	CN         string
	BrokerAddr *net.TCPAddr
	BrokerID   string
	ReverseURL *url.URL
	TLSConfig  *tls.Config
}

ReverseConfig contains the reverse configuration for the check

type ReverseConfigs added in v1.0.0

type ReverseConfigs map[string]ReverseConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL