Help us shape the future of Go! Take the 2026 Go Developer Survey

remote

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2018 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeReadRequest

func DecodeReadRequest(r *http.Request) (*prompb.ReadRequest, error)

DecodeReadRequest reads a remote.Request from a http.Request.

func EncodeReadResponse

func EncodeReadResponse(resp *prompb.ReadResponse, w http.ResponseWriter) error

EncodeReadResponse writes a remote.Response to a http.ResponseWriter.

func ExternablLabelsHandler

func ExternablLabelsHandler(next storage.Queryable, externalLabels model.LabelSet) storage.Queryable

ExternablLabelsHandler returns a storage.Queryable which creates a externalLabelsQuerier.

func FromQuery

func FromQuery(req *prompb.Query) (int64, int64, []*labels.Matcher, error)

FromQuery unpacks a Query proto.

func FromQueryResult

func FromQueryResult(res *prompb.QueryResult) storage.SeriesSet

FromQueryResult unpacks a QueryResult proto.

func LabelProtosToMetric

func LabelProtosToMetric(labelPairs []*prompb.Label) model.Metric

LabelProtosToMetric unpack a []*prompb.Label to a model.Metric

func MetricToLabelProtos

func MetricToLabelProtos(metric model.Metric) []*prompb.Label

MetricToLabelProtos builds a []*prompb.Label from a model.Metric

func PreferLocalStorageFilter

func PreferLocalStorageFilter(next storage.Queryable, cb startTimeCallback) storage.Queryable

PreferLocalStorageFilter returns a QueryableFunc which creates a NoopQuerier if requested timeframe can be answered completely by the local TSDB, and reduces maxt if the timeframe can be partially answered by TSDB.

func QueryableClient

func QueryableClient(c *Client) storage.Queryable

QueryableClient returns a storage.Queryable which queries the given Client to select series sets.

func RequiredMatchersFilter

func RequiredMatchersFilter(next storage.Queryable, required []*labels.Matcher) storage.Queryable

RequiredMatchersFilter returns a storage.Queryable which creates a requiredMatchersQuerier.

func ToQuery

func ToQuery(from, to int64, matchers []*labels.Matcher) (*prompb.Query, error)

ToQuery builds a Query proto.

func ToQueryResult

func ToQueryResult(ss storage.SeriesSet) (*prompb.QueryResult, error)

ToQueryResult builds a QueryResult proto.

func ToWriteRequest

func ToWriteRequest(samples []*model.Sample) *prompb.WriteRequest

ToWriteRequest converts an array of samples into a WriteRequest proto.

Types

type Client

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

Client allows reading and writing from/to a remote HTTP endpoint.

func NewClient

func NewClient(index int, conf *ClientConfig) (*Client, error)

NewClient creates a new Client.

func (Client) Name

func (c Client) Name() string

Name identifies the client.

func (*Client) Read

func (c *Client) Read(ctx context.Context, query *prompb.Query) (*prompb.QueryResult, error)

Read reads from a remote endpoint.

func (*Client) Store

func (c *Client) Store(req *prompb.WriteRequest) error

Store sends a batch of samples to the HTTP endpoint.

type ClientConfig

type ClientConfig struct {
	URL              *config_util.URL
	Timeout          model.Duration
	HTTPClientConfig config_util.HTTPClientConfig
}

ClientConfig configures a Client.

type QueueManager

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

QueueManager manages a queue of samples to be sent to the Storage indicated by the provided StorageClient.

func NewQueueManager

func NewQueueManager(logger log.Logger, cfg config.QueueConfig, externalLabels model.LabelSet, relabelConfigs []*config.RelabelConfig, client StorageClient) *QueueManager

NewQueueManager builds a new QueueManager.

func (*QueueManager) Append

func (t *QueueManager) Append(s *model.Sample) error

Append queues a sample to be sent to the remote storage. It drops the sample on the floor if the queue is full. Always returns nil.

func (*QueueManager) NeedsThrottling

func (*QueueManager) NeedsThrottling() bool

NeedsThrottling implements storage.SampleAppender. It will always return false as a remote storage drops samples on the floor if backlogging instead of asking for throttling.

func (*QueueManager) Start

func (t *QueueManager) Start()

Start the queue manager sending samples to the remote storage. Does not block.

func (*QueueManager) Stop

func (t *QueueManager) Stop()

Stop stops sending samples to the remote storage and waits for pending sends to complete.

type Storage

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

Storage represents all the remote read and write endpoints. It implements storage.Storage.

func NewStorage

func NewStorage(l log.Logger, stCallback startTimeCallback) *Storage

NewStorage returns a remote.Storage.

func (*Storage) Add

func (s *Storage) Add(l labels.Labels, t int64, v float64) (uint64, error)

Add implements storage.Appender.

func (*Storage) AddFast

func (s *Storage) AddFast(l labels.Labels, _ uint64, t int64, v float64) error

AddFast implements storage.Appender.

func (*Storage) Appender

func (s *Storage) Appender() (storage.Appender, error)

Appender implements scrape.Appendable.

func (*Storage) ApplyConfig

func (s *Storage) ApplyConfig(conf *config.Config) error

ApplyConfig updates the state as the new config requires.

func (*Storage) Close

func (s *Storage) Close() error

Close the background processing of the storage queues.

func (*Storage) Commit

func (*Storage) Commit() error

Commit implements storage.Appender.

func (*Storage) Querier

func (s *Storage) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error)

Querier returns a storage.MergeQuerier combining the remote client queriers of each configured remote read endpoint.

func (*Storage) Rollback

func (*Storage) Rollback() error

Rollback implements storage.Appender.

func (*Storage) StartTime

func (s *Storage) StartTime() (int64, error)

StartTime implements the Storage interface.

type StorageClient

type StorageClient interface {
	// Store stores the given samples in the remote storage.
	Store(*prompb.WriteRequest) error
	// Name identifies the remote storage implementation.
	Name() string
}

StorageClient defines an interface for sending a batch of samples to an external timeseries database.

Jump to

Keyboard shortcuts

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