collectors

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 26, 2023 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTimeSeriesMetrics added in v0.13.0

func NewTimeSeriesMetrics(descriptor *monitoring.MetricDescriptor,
	ch chan<- prometheus.Metric,
	fillMissingLabels bool,
	deltaCounterStore DeltaCounterStore,
	deltaDistributionStore DeltaDistributionStore,
	aggregateDeltas bool) (*timeSeriesMetrics, error)

Types

type CollectedHistogram added in v0.13.0

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

type CollectedMetric added in v0.13.0

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

type ConstMetric added in v0.6.0

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

type DeltaCounterStore added in v0.13.0

type DeltaCounterStore interface {

	// Increment will use the incoming metricDescriptor and currentValue to either create a new entry or add the incoming
	// value to an existing entry in the underlying store
	Increment(metricDescriptor *monitoring.MetricDescriptor, currentValue *ConstMetric)

	// ListMetrics will return all known entries in the store for a metricDescriptorName
	ListMetrics(metricDescriptorName string) map[string][]*CollectedMetric
}

DeltaCounterStore defines a set of functions which must be implemented in order to be used as a DeltaCounterStore which accumulates DELTA Counter metrics over time

func NewInMemoryDeltaCounterStore added in v0.13.0

func NewInMemoryDeltaCounterStore(logger log.Logger, ttl time.Duration) DeltaCounterStore

NewInMemoryDeltaCounterStore returns an implementation of DeltaCounterStore which is persisted in-memory

type DeltaDistributionStore added in v0.13.0

type DeltaDistributionStore interface {

	// Increment will use the incoming metricDescriptor and currentValue to either create a new entry or add the incoming
	// value to an existing entry in the underlying store
	Increment(metricDescriptor *monitoring.MetricDescriptor, currentValue *HistogramMetric)

	// ListMetrics will return all known entries in the store for a metricDescriptorName
	ListMetrics(metricDescriptorName string) map[string][]*CollectedHistogram
}

DeltaDistributionStore defines a set of functions which must be implemented in order to be used as a DeltaDistributionStore which accumulates DELTA histogram metrics over time

func NewInMemoryDeltaDistributionStore added in v0.13.0

func NewInMemoryDeltaDistributionStore(logger log.Logger, ttl time.Duration) DeltaDistributionStore

NewInMemoryDeltaDistributionStore returns an implementation of DeltaDistributionStore which is persisted in-memory

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 {
	// contains filtered or unexported fields
}

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, distributionStore DeltaDistributionStore) (*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