internal

package
Version: v1.19.1 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2021 License: Apache-2.0 Imports: 30 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 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 struct {
	// contains filtered or unexported fields
}

OcaStore translates Prometheus scraping diffs into OpenCensus format.

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

func (*OcaStore) Appender

func (o *OcaStore) Appender(context.Context) storage.Appender

func (*OcaStore) Close

func (o *OcaStore) Close() error

func (*OcaStore) SetScrapeManager

func (o *OcaStore) SetScrapeManager(scrapeManager *scrape.Manager)

SetScrapeManager is used to config the underlying scrape.Manager as it's needed for OcaStore, otherwise OcaStore cannot accept any Appender() request

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