gatewayclient

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: AGPL-3.0 Imports: 33 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, limits indexgateway.Limits, logger log.Logger, metricsNamespace string) (*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 using a ring. Otherwise, it creates a GRPC connection pool to as many addresses as can be resolved from the given address.

func (*GatewayClient) BatchWrite

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

func (*GatewayClient) GetChunkRef

func (*GatewayClient) GetSeries

func (*GatewayClient) GetShards

func (s *GatewayClient) GetShards(
	ctx context.Context,
	in *logproto.ShardsRequest,
) (res *logproto.ShardsResponse, err error)

func (*GatewayClient) GetStats

func (*GatewayClient) GetVolume

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.

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"`

	GRPCUnaryClientInterceptors  []grpc.UnaryClientInterceptor  `yaml:"-"`
	GRCPStreamClientInterceptors []grpc.StreamClientInterceptor `yaml:"-"`
}

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