Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CollectorCache ¶ added in v0.18.0
type CollectorCache struct {
// contains filtered or unexported fields
}
collectorCache is a cache for MonitoringCollectors
func NewCollectorCache ¶ added in v0.18.0
func NewCollectorCache(ttl time.Duration) *CollectorCache
NewCollectorCache returns a new CollectorCache with the given TTL
func (*CollectorCache) Get ¶ added in v0.18.0
func (c *CollectorCache) Get(key string) (*MonitoringCollector, bool)
Get returns a MonitoringCollector if the key is found and not expired If key is found it resets the TTL for the collector
func (*CollectorCache) Store ¶ added in v0.18.0
func (c *CollectorCache) Store(key string, collector *MonitoringCollector)
type ConstMetric ¶ added in v0.6.0
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
Sum float64
Count uint64
Buckets map[float64]uint64
LabelValues []string
ReportTime time.Time
CollectionTime time.Time
KeysHash uint64
}
func (*HistogramMetric) MergeHistogram ¶ added in v0.15.1
func (h *HistogramMetric) MergeHistogram(other *HistogramMetric)
type MetricFilter ¶ added in v0.12.0
type MonitoringCollector ¶
type MonitoringCollector struct {
// contains filtered or unexported fields
}
func NewMonitoringCollector ¶
func NewMonitoringCollector(projectID string, monitoringService *monitoring.Service, opts MonitoringCollectorOptions, logger *slog.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
}
Click to show internal directories.
Click to hide internal directories.