gatewayclient

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: AGPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GatewayClient

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

func NewGatewayClient

func NewGatewayClient(cfg IndexGatewayClientConfig, r prometheus.Registerer, logger log.Logger) (*GatewayClient, error)

NewGatewayClient instantiates a new client used to communicate with an Index Gateway instance.

If it is configured to be in ring mode, a pool of GRPC connections to all Index Gateway instances is created. Otherwise, it creates a single GRPC connection to an Index Gateway instance running in simple mode.

func (*GatewayClient) BatchWrite

func (s *GatewayClient) BatchWrite(_ context.Context, _ index.WriteBatch) error

func (*GatewayClient) GetChunkRef

func (*GatewayClient) GetLabelVolume

func (*GatewayClient) GetSeries

func (*GatewayClient) GetStats

func (*GatewayClient) LabelNamesForMetricName

func (*GatewayClient) LabelValuesForMetricName

func (*GatewayClient) NewWriteBatch

func (s *GatewayClient) NewWriteBatch() index.WriteBatch

func (*GatewayClient) QueryPages

func (s *GatewayClient) QueryPages(ctx context.Context, queries []index.Query, callback index.QueryPagesCallback) error

func (*GatewayClient) Stop

func (s *GatewayClient) Stop()

Stop stops the execution of this gateway client.

If it is in simple mode, the single GRPC connection is closed. Otherwise, nothing happens.

type IndexGatewayClientConfig

type IndexGatewayClientConfig struct {
	// Mode sets in which mode the client will operate. It is actually defined at the
	// index_gateway YAML section and reused here.
	Mode indexgateway.Mode `yaml:"-"`

	// PoolConfig defines the behavior of the gRPC connection pool used to communicate
	// with the Index Gateway.
	//
	// Only relevant for the ring mode.
	// It is defined at the distributors YAML section and reused here.
	PoolConfig clientpool.PoolConfig `yaml:"-"`

	// Ring is the Index Gateway ring used to find the appropriate Index Gateway instance
	// this client should talk to.
	//
	// Only relevant for the ring mode.
	Ring ring.ReadRing `yaml:"-"`

	// GRPCClientConfig configures the gRPC connection between the Index Gateway client and the server.
	//
	// Used by both, ring and simple mode.
	GRPCClientConfig grpcclient.Config `yaml:"grpc_client_config"`

	// Address of the Index Gateway instance responsible for retaining the index for all tenants.
	//
	// Only relevant for the simple mode.
	Address string `yaml:"server_address,omitempty"`

	// Forcefully disable the use of the index gateway client for the storage.
	// This is mainly useful for the index-gateway component which should always use the storage.
	Disabled bool `yaml:"-"`

	// LogGatewayRequests configures if requests sent to the gateway should be logged or not.
	// The log messages are of type debug and contain the address of the gateway and the relevant tenant.
	LogGatewayRequests bool `yaml:"log_gateway_requests"`
}

IndexGatewayClientConfig configures the Index Gateway client used to communicate with the Index Gateway server.

func (*IndexGatewayClientConfig) RegisterFlags

func (i *IndexGatewayClientConfig) RegisterFlags(f *flag.FlagSet)

func (*IndexGatewayClientConfig) RegisterFlagsWithPrefix

func (i *IndexGatewayClientConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix register client-specific flags with the given prefix.

Flags that are used by both, client and server, are defined in the indexgateway package.

type IndexGatewayGRPCPool

type IndexGatewayGRPCPool struct {
	grpc_health_v1.HealthClient
	logproto.IndexGatewayClient
	io.Closer
}

IndexGatewayGRPCPool represents a pool of gRPC connections to different index gateway instances.

Only used when Index Gateway is configured to run in ring mode.

func NewIndexGatewayGRPCPool

func NewIndexGatewayGRPCPool(address string, opts []grpc.DialOption) (*IndexGatewayGRPCPool, error)

NewIndexGatewayGRPCPool instantiates a new pool of IndexGateway GRPC connections.

Internally, it also instantiates a protobuf index gateway client and a health client.

Jump to

Keyboard shortcuts

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