local

package
v0.23.5 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 54 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 (
	// The directories and files where "weaver gke-local" stores data.
	LogDir      = filepath.Join(runtime.LogsDir(), "gke-local")
	DataDir     = filepath.Join(must(runtime.DataDir()), "gke-local")
	MetricsFile = filepath.Join(DataDir, "metrics.db")
	TracesFile  = filepath.Join(DataDir, "traces.db")
)
View Source
var File_internal_local_local_proto protoreflect.FileDescriptor

Functions

func ApplyTraffic added in v0.22.1

func ApplyTraffic(ctx context.Context, proxyAddress string, assignment *nanny.TrafficAssignment, region string) error

ApplyTraffic applies the traffic assignment on the proxy running at the given address.

func Controller added in v0.18.0

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

Controller returns the address the tool should use to connect to the controller, as well as the HTTP client that can be used to reach it.

func GetListeners added in v0.22.1

func GetListeners(ctx context.Context, s store.Store, cfg *config.GKEConfig) ([]*nanny.Listener, error)

GetListeners returns network listeners in the given store associated with a given application version.

If a replica that exports a listener dies, we don't update the traffic rules to reflect the new set of listeners in case of a gke-local deployer. Note that this is intentional, as we don't worry about processes deaths.

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, error)

PrepareRollout returns a new rollout request for the given application version. This call may mutate the passed-in config.

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 RunController added in v0.18.0

func RunController(ctx context.Context, id string, region string, port int) error

RunController creates and runs a controller.

func RunDistributor added in v0.18.0

func RunDistributor(ctx context.Context, id, region string, port, managerPort int) error

RunDistributor creates and runs a distributor.

func RunManager added in v0.18.0

func RunManager(ctx context.Context, id, region string, port, proxyPort int) error

RunManager creates and runs a manager.

func RunProxy

func RunProxy(ctx context.Context, id string, 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 Starter

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

Starter starts ReplicaSets on the local machine.

func NewStarter

func NewStarter(logger *slog.Logger) (*Starter, error)

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

func (*Starter) Start

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

Start starts the ReplicaSet for a given deployment.

func (*Starter) Stop

func (s *Starter) Stop(_ context.Context, versions []*config.GKEConfig) error

Stop kills processes in all of the versions' replica sets, blocking until all of the processes are killed.

Directories

Path Synopsis
Package cond implements a context-aware condition variable.
Package cond implements a context-aware condition variable.
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