Documentation ¶
Index ¶
- Variables
- func DecodeReadRequest(r *http.Request) (*prompb.ReadRequest, error)
- func EncodeReadResponse(resp *prompb.ReadResponse, w http.ResponseWriter) error
- func ExternalLabelsHandler(next storage.Queryable, externalLabels model.LabelSet) storage.Queryable
- func FromQuery(req *prompb.Query) (int64, int64, []*labels.Matcher, *storage.SelectHints, error)
- func FromQueryResult(sortSeries bool, res *prompb.QueryResult) storage.SeriesSet
- func LabelProtosToMetric(labelPairs []*prompb.Label) model.Metric
- func MetricToLabelProtos(metric model.Metric) []prompb.Label
- func PreferLocalStorageFilter(next storage.Queryable, cb startTimeCallback) storage.Queryable
- func QueryableClient(c *Client) storage.Queryable
- func RequiredMatchersFilter(next storage.Queryable, required []*labels.Matcher) storage.Queryable
- func ToQuery(from, to int64, matchers []*labels.Matcher, p *storage.SelectHints) (*prompb.Query, error)
- func ToQueryResult(ss storage.SeriesSet, sampleLimit int) (*prompb.QueryResult, error)
- func ToWriteRequest(samples []*model.Sample) *prompb.WriteRequest
- type Client
- type ClientConfig
- type HTTPError
- type QueueManager
- type Storage
- func (s *Storage) Append(ref storage.SeriesRef, l labels.Labels, t int64, v float64) (storage.SeriesRef, error)
- func (s *Storage) AppendExemplar(ref storage.SeriesRef, l labels.Labels, e exemplar.Exemplar) (storage.SeriesRef, error)
- func (s *Storage) Appender() (storage.Appender, error)
- func (s *Storage) ApplyConfig(conf *config.Config) error
- func (s *Storage) Close() error
- func (*Storage) Commit() error
- func (s *Storage) Querier(ctx context.Context, mint, maxt int64) (storage.Querier, error)
- func (*Storage) Rollback() error
- func (s *Storage) StartTime() (int64, error)
- type StorageClient
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultQueueConfig is the default remote queue configuration. DefaultQueueConfig = config.QueueConfig{ MaxShards: 1000, MinShards: 1, MaxSamplesPerSend: 100, Capacity: 10000, BatchSendDeadline: model.Duration(5 * time.Second), MinBackoff: model.Duration(30 * time.Millisecond), MaxBackoff: model.Duration(100 * time.Millisecond), } )
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 ExternalLabelsHandler ¶
ExternalLabelsHandler returns a storage.Queryable which creates a externalLabelsQuerier.
func FromQueryResult ¶
func FromQueryResult(sortSeries bool, res *prompb.QueryResult) storage.SeriesSet
FromQueryResult unpacks a QueryResult proto.
func LabelProtosToMetric ¶
LabelProtosToMetric unpack a []*prompb.Label to a model.Metric
func MetricToLabelProtos ¶
MetricToLabelProtos builds a []*prompb.Label from a model.Metric
func PreferLocalStorageFilter ¶
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 ¶
QueryableClient returns a storage.Queryable which queries the given Client to select series sets.
func RequiredMatchersFilter ¶
RequiredMatchersFilter returns a storage.Queryable which creates a requiredMatchersQuerier.
func ToQuery ¶
func ToQuery(from, to int64, matchers []*labels.Matcher, p *storage.SelectHints) (*prompb.Query, error)
ToQuery builds a Query proto.
func ToQueryResult ¶
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.
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 labels.Labels, relabelConfigs []*relabel.Config, client StorageClient, flushDeadline time.Duration) *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 ¶
NewStorage returns a remote.Storage.
func (*Storage) Append ¶ added in v0.0.73
func (s *Storage) Append(ref storage.SeriesRef, l labels.Labels, t int64, v float64) (storage.SeriesRef, error)
Add implements storage.Appender.
func (*Storage) AppendExemplar ¶ added in v0.0.73
func (*Storage) ApplyConfig ¶
ApplyConfig updates the state as the new config requires.
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.