cluster

package
v0.34.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2023 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DefaultConfig provides default values for the config

Functions

This section is empty.

Types

type Cluster

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

Cluster connects an Agent to other Agents and allows them to distribute workload.

func New

func New(
	l log.Logger,
	reg prometheus.Registerer,
	cfg Config,
	im instance.Manager,
	validate ValidationFunc,
) (*Cluster, error)

New creates a new Cluster.

func (*Cluster) ApplyConfig

func (c *Cluster) ApplyConfig(cfg Config) error

ApplyConfig applies configuration changes to Cluster.

func (*Cluster) Reshard

func (c *Cluster) Reshard(ctx context.Context, _ *agentproto.ReshardRequest) (*empty.Empty, error)

Reshard implements agentproto.ScrapingServiceServer, and syncs the state of configs with the configstore.

func (*Cluster) Stop

func (c *Cluster) Stop()

Stop stops the cluster and all of its dependencies.

func (*Cluster) WireAPI

func (c *Cluster) WireAPI(r *mux.Router)

WireAPI injects routes into the provided mux router for the config management API.

func (*Cluster) WireGRPC

func (c *Cluster) WireGRPC(srv *grpc.Server)

WireGRPC injects gRPC server handlers into the provided gRPC server.

type Config

type Config struct {
	Enabled                    bool             `yaml:"enabled,omitempty"`
	ReshardInterval            time.Duration    `yaml:"reshard_interval,omitempty"`
	ReshardTimeout             time.Duration    `yaml:"reshard_timeout,omitempty"`
	ClusterReshardEventTimeout time.Duration    `yaml:"cluster_reshard_event_timeout,omitempty"`
	KVStore                    KVConfig         `yaml:"kvstore,omitempty"`
	Lifecycler                 LifecyclerConfig `yaml:"lifecycler,omitempty"`

	DangerousAllowReadingFiles bool `yaml:"dangerous_allow_reading_files,omitempty"`

	// TODO(rfratto): deprecate scraping_service_client in Agent and replace with this.
	Client                    client.Config `yaml:"-"`
	APIEnableGetConfiguration bool          `yaml:"-"`
}

Config describes how to instantiate a scraping service Server instance.

func (Config) IsZero added in v0.31.0

func (c Config) IsZero() bool

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config the Server to the given FlagSet.

func (*Config) RegisterFlagsWithPrefix

func (c *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet with a specified prefix.

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler.

type KVConfig added in v0.31.0

type KVConfig struct {
	kv.Config `yaml:",inline"`
}

KVConfig wraps the kv.Config type to allow defining IsZero, which is required to make omitempty work when marshalling YAML.

func (KVConfig) IsZero added in v0.31.0

func (k KVConfig) IsZero() bool

type LifecyclerConfig added in v0.31.0

type LifecyclerConfig struct {
	ring.LifecyclerConfig `yaml:",inline"`
}

LifecyclerConfig wraps the ring.LifecyclerConfig type to allow defining IsZero, which is required to make omitempty work when marshalling YAML.

func (LifecyclerConfig) IsZero added in v0.31.0

func (l LifecyclerConfig) IsZero() bool

type OwnershipFunc

type OwnershipFunc = func(key string) (bool, error)

OwnershipFunc should determine if a given keep is owned by the caller.

type ValidationFunc

type ValidationFunc = func(*instance.Config) error

ValidationFunc should validate a config.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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