collectors

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 14 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConstMetric added in v0.6.0

type ConstMetric struct {
	FqName         string
	LabelKeys      []string
	ValueType      prometheus.ValueType
	Value          float64
	LabelValues    []string
	ReportTime     time.Time
	CollectionTime time.Time

	KeysHash uint64
}

type DeltaCounterStore added in v0.13.0

type DeltaCounterStore interface {
	Increment(metricDescriptor *monitoring.MetricDescriptor, currentValue *ConstMetric)
	ListMetrics(metricDescriptorName string) []*ConstMetric
}

type DeltaHistogramStore added in v0.15.0

type DeltaHistogramStore interface {
	Increment(metricDescriptor *monitoring.MetricDescriptor, currentValue *HistogramMetric)
	ListMetrics(metricDescriptorName string) []*HistogramMetric
}

type DescriptorCache added in v0.14.0

type DescriptorCache interface {
	// Lookup searches the cache for an entry. If the cache has no entry or the entry has expired nil is returned.
	Lookup(prefix string) []*monitoring.MetricDescriptor

	// Store stores an entry in the cache
	Store(prefix string, data []*monitoring.MetricDescriptor)
}

type HistogramMetric added in v0.6.0

type HistogramMetric struct {
	FqName         string
	LabelKeys      []string
	Mean           float64
	Count          uint64
	Buckets        map[float64]uint64
	LabelValues    []string
	ReportTime     time.Time
	CollectionTime time.Time

	KeysHash uint64
}

type MetricFilter added in v0.12.0

type MetricFilter struct {
	Prefix   string
	Modifier string
}

type MonitoringCollector

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

func NewMonitoringCollector

func NewMonitoringCollector(projectID string, monitoringService *monitoring.Service, opts MonitoringCollectorOptions, logger log.Logger, counterStore DeltaCounterStore, histogramStore DeltaHistogramStore) (*MonitoringCollector, error)

func (*MonitoringCollector) Collect

func (c *MonitoringCollector) Collect(ch chan<- prometheus.Metric)

func (*MonitoringCollector) Describe

func (c *MonitoringCollector) Describe(ch chan<- *prometheus.Desc)

type MonitoringCollectorOptions added in v0.13.0

type MonitoringCollectorOptions struct {
	// MetricTypePrefixes are the Google Monitoring (ex-Stackdriver) metric type prefixes that the collector
	// will be querying.
	MetricTypePrefixes []string
	// ExtraFilters is a list of criteria to apply to each corresponding metric prefix query. If one or more are
	// applicable to a given metric type prefix, they will be 'AND' concatenated.
	ExtraFilters []MetricFilter
	// RequestInterval is the time interval used in each request to get metrics. If there are many data points returned
	// during this interval, only the latest will be reported.
	RequestInterval time.Duration
	// RequestOffset is used to offset the requested interval into the past.
	RequestOffset time.Duration
	// IngestDelay decides if the ingestion delay specified in the metrics metadata is used when calculating the
	// request time interval.
	IngestDelay bool
	// FillMissingLabels decides if metric labels should be added with empty string to prevent failures due to label inconsistency on metrics.
	FillMissingLabels bool
	// DropDelegatedProjects decides if only metrics matching the collector's projectID should be retrieved.
	DropDelegatedProjects bool
	// AggregateDeltas decides if DELTA metrics should be treated as a counter using the provided counterStore/distributionStore or a gauge
	AggregateDeltas bool
	// DescriptorCacheTTL is the TTL on the items in the descriptorCache which caches the MetricDescriptors for a MetricTypePrefix
	DescriptorCacheTTL time.Duration
	// DescriptorCacheOnlyGoogle decides whether only google specific descriptors should be cached or all
	DescriptorCacheOnlyGoogle bool
}

Jump to

Keyboard shortcuts

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