retrieval

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelsToResource

func LabelsToResource(labels labels.Labels) *resource_pb.Resource

func ReadProgressFile

func ReadProgressFile(dir string) (offset int, err error)

ReadProgressFile reads the progress file in the given directory and returns the saved offset.

func SaveProgressFile

func SaveProgressFile(dir string, offset int) error

SaveProgressFile saves a progress file with the given offset in directory.

Types

type Appender

type Appender interface {
	Append(s SizedMetric)
}

Appender appends a time series with exactly one data point.

type MetadataGetter

type MetadataGetter interface {
	Get(ctx context.Context, job, instance, metric string) (*config.MetadataEntry, error)
}

type PrometheusReader

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

func NewPrometheusReader

func NewPrometheusReader(
	logger log.Logger,
	walDirectory string,
	tailer tail.WalTailer,
	filters [][]*labels.Matcher,
	metricRenames map[string]string,
	metadataGetter MetadataGetter,
	appender Appender,
	metricsPrefix string,
	maxPointAge time.Duration,
	scrapeConfig []*promconfig.ScrapeConfig,
	failingReporter common.FailingReporter,
	leaderCandidate leader.Candidate,
) *PrometheusReader

NewPrometheusReader is the PrometheusReader constructor

func (*PrometheusReader) CurrentSegment

func (r *PrometheusReader) CurrentSegment() int

func (*PrometheusReader) Next

func (r *PrometheusReader) Next()

func (*PrometheusReader) Run

func (r *PrometheusReader) Run(ctx context.Context, startOffset int) error

Run starts the main read loop, that reads the prometheus' WAL log to find and parse Series and Samples.

Series read are used to update an internal time series cache, containing metadata, labels and reset times.

Samples read are transformed by the retrieval.sampleBuilder into OTLP metrics and forwarded to the PrometheusReader.appender, generally a otlp.QueueManager.

type SizedMetric added in v0.24.0

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

SizedMetric encapsulates a small number of points w/ precomputed approximate size.

func NewSizedMetric added in v0.24.0

func NewSizedMetric(metric *metric_pb.Metric, count, size int) SizedMetric

func (SizedMetric) Count added in v0.24.0

func (s SizedMetric) Count() int

func (SizedMetric) Metric added in v0.24.0

func (s SizedMetric) Metric() *metric_pb.Metric

func (SizedMetric) Size added in v0.24.0

func (s SizedMetric) Size() int

Jump to

Keyboard shortcuts

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