sparrow

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChecksController added in v0.3.1

type ChecksController struct {
	// contains filtered or unexported fields
}

ChecksController is responsible for managing checks.

func NewChecksController added in v0.3.1

func NewChecksController(dbase db.DB, metrics Metrics) *ChecksController

NewChecksController creates a new ChecksController.

func (*ChecksController) GenerateCheckSpecs added in v0.3.1

func (cc *ChecksController) GenerateCheckSpecs(ctx context.Context) (openapi3.T, error)

GenerateCheckSpecs generates the OpenAPI specifications for the given checks Returns the complete OpenAPI specification for all checks

func (*ChecksController) Reconcile added in v0.3.1

func (cc *ChecksController) Reconcile(ctx context.Context, cfg runtime.Config)

Reconcile reconciles the checks. It registers new checks, updates existing checks and unregisters checks not in the new config.

func (*ChecksController) RegisterCheck added in v0.3.1

func (cc *ChecksController) RegisterCheck(ctx context.Context, check checks.Check) error

RegisterCheck registers a new check.

func (*ChecksController) Run added in v0.3.1

func (cc *ChecksController) Run(ctx context.Context) error

Run runs the ChecksController with handling results and errors.

func (*ChecksController) Shutdown added in v0.3.1

func (cc *ChecksController) Shutdown(ctx context.Context) (err error)

Shutdown shuts down the ChecksController.

func (*ChecksController) UnregisterCheck added in v0.3.1

func (cc *ChecksController) UnregisterCheck(ctx context.Context, check checks.Check) error

UnregisterCheck unregisters a check.

type ErrCreateOpenapiSchema

type ErrCreateOpenapiSchema struct {
	// contains filtered or unexported fields
}

func (ErrCreateOpenapiSchema) Error added in v0.3.1

func (e ErrCreateOpenapiSchema) Error() string

type ErrRunningCheck added in v0.3.1

type ErrRunningCheck struct {
	Check checks.Check
	Err   error
}

func (*ErrRunningCheck) Error added in v0.3.1

func (e *ErrRunningCheck) Error() string

type ErrShutdown added in v0.3.1

type ErrShutdown struct {
	// contains filtered or unexported fields
}

func (ErrShutdown) HasError added in v0.3.1

func (e ErrShutdown) HasError() bool

type Metrics added in v0.1.2

type Metrics interface {
	// GetRegistry returns the prometheus registry instance
	// containing the registered prometheus collectors
	GetRegistry() *prometheus.Registry
}

func NewMetrics added in v0.1.2

func NewMetrics() Metrics

NewMetrics initializes the metrics and returns the PrometheusMetrics

type MetricsMock added in v0.1.2

type MetricsMock struct {
	// GetRegistryFunc mocks the GetRegistry method.
	GetRegistryFunc func() *prometheus.Registry
	// contains filtered or unexported fields
}

MetricsMock is a mock implementation of Metrics.

func TestSomethingThatUsesMetrics(t *testing.T) {

	// make and configure a mocked Metrics
	mockedMetrics := &MetricsMock{
		GetRegistryFunc: func() *prometheus.Registry {
			panic("mock out the GetRegistry method")
		},
	}

	// use mockedMetrics in code that requires Metrics
	// and then make assertions.

}

func (*MetricsMock) GetRegistry added in v0.1.2

func (mock *MetricsMock) GetRegistry() *prometheus.Registry

GetRegistry calls GetRegistryFunc.

func (*MetricsMock) GetRegistryCalls added in v0.1.2

func (mock *MetricsMock) GetRegistryCalls() []struct {
}

GetRegistryCalls gets all the calls that were made to GetRegistry. Check the length with:

len(mockedMetrics.GetRegistryCalls())

type PrometheusMetrics added in v0.1.2

type PrometheusMetrics struct {
	// contains filtered or unexported fields
}

func (*PrometheusMetrics) GetRegistry added in v0.1.2

func (m *PrometheusMetrics) GetRegistry() *prometheus.Registry

GetRegistry returns the registry to register prometheus metrics

type Sparrow

type Sparrow struct {
	// contains filtered or unexported fields
}

Sparrow is the main struct of the sparrow application

func New

func New(cfg *config.Config) *Sparrow

New creates a new sparrow from a given configfile

func (*Sparrow) Run

func (s *Sparrow) Run(ctx context.Context) error

Run starts the sparrow

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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