Documentation ¶
Index ¶
- func DecodeReadRequest(r *http.Request) (*prompb.ReadRequest, error)
- func EncodeReadResponse(resp *prompb.ReadResponse, w http.ResponseWriter) error
- 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 ToQuery(from, to int64, matchers []*labels.Matcher) (*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 (r *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 ¶
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 FromQueryResult ¶
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 ToQueryResult ¶
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 ¶
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 ¶
type ClientConfig struct { URL *config.URL Timeout model.Duration ReadRecent bool HTTPClientConfig config.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 ¶ 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 ¶
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) ApplyConfig ¶
ApplyConfig updates the state as the new config requires.
type StorageClient ¶ added in v1.0.0
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.