Documentation ¶
Index ¶
- func DecodeReadRequest(r *http.Request) (*prompb.ReadRequest, error)
- func EncodeReadResponse(resp *prompb.ReadResponse, w http.ResponseWriter) error
- func ExternablLabelsHandler(next storage.Queryable, externalLabels model.LabelSet) storage.Queryable
- func FromQuery(req *prompb.Query) (int64, int64, []*labels.Matcher, error)
- func FromQueryResult(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.SelectParams) (*prompb.Query, error)
- func ToQueryResult(ss storage.SeriesSet) (*prompb.QueryResult, error)
- func ToWriteRequest(samples []*model.Sample) *prompb.WriteRequest
- type Client
- type ClientConfig
- type QueueManager
- type Storage
- func (s *Storage) Add(l labels.Labels, t int64, v float64) (uint64, error)
- func (s *Storage) AddFast(l labels.Labels, _ uint64, t int64, v float64) 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 ¶
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 ExternablLabelsHandler ¶
func ExternablLabelsHandler(next storage.Queryable, externalLabels model.LabelSet) storage.Queryable
ExternablLabelsHandler returns a storage.Queryable which creates a externalLabelsQuerier.
func FromQueryResult ¶ added in v1.8.0
func FromQueryResult(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 ¶ 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) (*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.
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 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 ¶
NewStorage returns a remote.Storage.
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.