control

package
v0.0.0-...-2e1cf37 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handler

func Handler() http.Handler

func Register

func Register(ctx context.Context, controlEndpoint string, service string, publicEndpoint string) error

Register calls the endpoint registration

func RegisterInstance

func RegisterInstance(ctx context.Context, controlEndpoint string, data Instance) error

func RegisterStressor

func RegisterStressor(ctx context.Context, controlEndpoint string, name string, publicEndpoint string, testInProgress bool) error

func Trigger

func Trigger(ctx context.Context, endpoint string, target StressTest) error

Types

type Instance

type Instance struct {
	Name                string            `json:"name"`
	LastPing            time.Time         `json:"lastPing,omitempty"`
	TimeSinceLastPingMs int64             `json:"timeSinceLastPingMs,omitempty"`
	Services            map[string]string `json:"services"`
	Metrics             struct {
		Requests int64 `json:"requests"`
	} `json:"metrics"`
}

type Server

type Server struct {
	Service  string `json:"service"`
	Endpoint string `json:"endpoint"`
}

func Services

func Services(ctx context.Context, controlEndpoint string) ([]*Server, error)

Services returns the list of services that are registered

type StressTest

type StressTest struct {
	Name              string        `json:"name"`
	Target            string        `json:"target"`
	Method            string        `json:"method"`
	RequestsPerSecond int           `json:"requestsPerSecond"`
	Workers           int           `json:"workers"`
	Timeout           time.Duration `json:"timeout"`
	Sustain           time.Duration `json:"sustain"`
}

type Stressor

type Stressor struct {
	BaseEndpoint   string `json:"baseEndpoint"`
	Name           string `json:"name"`
	TestInProgress bool   `json:"testInProgress"`
}

Jump to

Keyboard shortcuts

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