remote

package
v2.4.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeReadRequest added in v1.8.0

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

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

func EncodeReadResponse added in v1.8.0

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

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

func ExternalLabelsHandler

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

ExternalLabelsHandler returns a storage.Queryable which creates a externalLabelsQuerier.

func FromQuery added in v1.8.0

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

FromQuery unpacks a Query proto.

func FromQueryResult added in v1.8.0

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 added in v1.8.0

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

ToQuery builds a Query proto.

func ToQueryResult added in v1.8.0

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

ToQueryResult builds a QueryResult proto.

func ToWriteRequest added in v1.8.0

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

ToWriteRequest converts an array of samples into a WriteRequest proto.

Types

type Client added in v1.1.0

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

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

func NewClient added in v1.1.0

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

NewClient creates a new Client.

func (Client) Name added in v1.1.0

func (c Client) Name() string

Name identifies the client.

func (*Client) Read added in v1.6.0

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

Read reads from a remote endpoint.

func (*Client) Store added in v1.1.0

func (c *Client) Store(ctx context.Context, req *prompb.WriteRequest) error

Store sends a batch of samples to the HTTP endpoint.

type ClientConfig added in v1.8.0

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

ClientConfig configures a Client.

type HTTPError

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

func (HTTPError) Error

func (e HTTPError) Error() string

func (HTTPError) Status

func (e HTTPError) Status() int

type QueueManager added in v1.6.0

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 added in v1.6.0

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

NewQueueManager builds a new QueueManager.

func (*QueueManager) Append added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

func (t *QueueManager) Start()

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

func (*QueueManager) Stop added in v1.6.0

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, flushDeadline time.Duration) *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(context.Context, *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