local

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2023 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const PrometheusURL = "/metrics"

URL on the controller where the metrics are exported in the Prometheus format.

Variables

View Source
var File_internal_local_local_proto protoreflect.FileDescriptor
View Source
var LogDir = filepath.Join(logging.DefaultLogDir, "weaver-gke-local")

LogDir is where weaver-gke-local deployed applications store their logs.

Functions

func Nanny

func Nanny(context.Context) (string, *http.Client, error)

Nanny returns the nanny address, along with the HTTP client that can be used to reach it.

func NewPrometheusHandler

func NewPrometheusHandler(db *metricdb.T, logger *slog.Logger) http.Handler

NewPrometheusHandler returns a Prometheus HTTP handler that exports metrics stored in the given metrics database. The returned handler supports the following query parameters:

  • app=<app>, which restricts metrics to the given application, and
  • version=<version>, which restricts metrics to the given app version.

func PrepareRollout

func PrepareRollout(ctx context.Context, cfg *config.GKEConfig) (*controller.RolloutRequest, *http.Client, error)

PrepareRollout returns a new rollout request for the given application version, along with the HTTP client that should be used to reach it. May mutate the passed-in run.

func RecordListener

func RecordListener(ctx context.Context, s store.Store, cfg *config.GKEConfig, lis *nanny.Listener) error

RecordListener records the network listener exported by an application version.

func RunNanny

func RunNanny(ctx context.Context, opts NannyOptions) error

RunNanny creates and runs a nanny.

func RunProxy

func RunProxy(ctx context.Context, port int) error

RunProxy creates and runs a proxy listening on ":port".

func Store

func Store(region string) (store.Store, error)

Store returns a store that persists data in the given directory. If the directory does not exist, it is created.

Types

type ListenState

type ListenState struct {

	// Listeners is the set of all exported listeners in the deployment.
	Listeners []*nanny.Listener `protobuf:"bytes,1,rep,name=listeners,proto3" json:"listeners,omitempty"`
	// contains filtered or unexported fields
}

ListenState contains the state stored for the network listeners in the store.

func (*ListenState) Descriptor deprecated

func (*ListenState) Descriptor() ([]byte, []int)

Deprecated: Use ListenState.ProtoReflect.Descriptor instead.

func (*ListenState) GetListeners

func (x *ListenState) GetListeners() []*nanny.Listener

func (*ListenState) ProtoMessage

func (*ListenState) ProtoMessage()

func (*ListenState) ProtoReflect

func (x *ListenState) ProtoReflect() protoreflect.Message

func (*ListenState) Reset

func (x *ListenState) Reset()

func (*ListenState) String

func (x *ListenState) String() string

type NannyOptions

type NannyOptions struct {
	Region           string // simulated GKE region (e.g., us-central1)
	StartController  bool   // start a controller?
	StartDistributor bool   // start a distributor/manager?
	Port             int    // listen on localhost:port
}

NannyOptions configure a nanny.

type Starter

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

Starter starts ReplicaSets on the local machine.

func NewStarter

func NewStarter(s store.Store) *Starter

NewStarter creates a starter that runs all replicas of a colocation group as OS processes on the local machine.

func (*Starter) Babysitters

func (s *Starter) Babysitters() []*babysitter.Babysitter

Babysitters returns a snapshot of all currently running babysitters.

func (*Starter) Start

func (s *Starter) Start(ctx context.Context, cfg *config.GKEConfig, replicaSet string) error

Start starts the ReplicaSet for a given deployment.

func (*Starter) Stop

func (s *Starter) Stop(_ context.Context, deployments []string) error

Stop kills processes in all of the deployments' colocation groups, blocking until all of the processes are killed.

Directories

Path Synopsis
Package proxy provides an implementation of a simple proxying service.
Package proxy provides an implementation of a simple proxying service.

Jump to

Keyboard shortcuts

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