internal

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2020 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewZapToGokitLogAdapter

func NewZapToGokitLogAdapter(logger *zap.Logger) gokitLog.Logger

NewZapToGokitLogAdapter create an adapter for zap.Logger to gokitLog.Logger

Types

type JobsMap

type JobsMap struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

JobsMap maps from a job instance to a map of timeseries instances for the job.

func NewJobsMap

func NewJobsMap(gcInterval time.Duration) *JobsMap

NewJobsMap creates a new (empty) JobsMap.

type MetadataCache

type MetadataCache interface {
	Metadata(metricName string) (scrape.MetricMetadata, bool)
	SharedLabels() labels.Labels
}

MetadataCache is an adapter to prometheus' scrape.Target and provide only the functionality which is needed

type MetadataService

type MetadataService interface {
	Get(job, instance string) (MetadataCache, error)
}

MetadataService is an adapter to ScrapeManager and provide only the functionality which is needed

type MetricFamily

type MetricFamily interface {
	Add(metricName string, ls labels.Labels, t int64, v float64) error
	IsSameFamily(metricName string) bool
	ToMetric() (*metricspb.Metric, int, int)
}

MetricFamily is unit which is corresponding to the metrics items which shared the same TYPE/UNIT/... metadata from a single scrape.

type MetricsAdjuster

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

MetricsAdjuster takes a map from a metric instance to the initial point in the metrics instance and provides AdjustMetrics, which takes a sequence of metrics and adjust their values based on the initial points.

func NewMetricsAdjuster

func NewMetricsAdjuster(tsm *timeseriesMap, logger *zap.Logger) *MetricsAdjuster

NewMetricsAdjuster is a constructor for MetricsAdjuster.

func (*MetricsAdjuster) AdjustMetrics

func (ma *MetricsAdjuster) AdjustMetrics(metrics []*metricspb.Metric) ([]*metricspb.Metric, int)

AdjustMetrics takes a sequence of metrics and adjust their values based on the initial and previous points in the timeseriesMap. If the metric is the first point in the timeseries, or the timeseries has been reset, it is removed from the sequence and added to the timeseriesMap. Additionally returns the total number of timeseries dropped from the metrics.

type OcaStore

type OcaStore interface {
	storage.Appendable
	io.Closer
	SetScrapeManager(*scrape.Manager)
}

OcaStore is an interface combines io.Closer and prometheus' scrape.Appendable

func NewOcaStore

func NewOcaStore(ctx context.Context, sink consumer.MetricsConsumer, logger *zap.Logger, jobsMap *JobsMap, useStartTimeMetric bool, startTimeMetricRegex string, receiverName string) OcaStore

NewOcaStore returns an ocaStore instance, which can be acted as prometheus' scrape.Appendable

type ScrapeManager

type ScrapeManager interface {
	TargetsAll() map[string][]*scrape.Target
}

Jump to

Keyboard shortcuts

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