Documentation ¶
Index ¶
Constants ¶
const FiveMinutePruneWindow int64 = 5 * 60
Five minutes in seconds for Unix comparisons
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { ProjectIDs []string `yaml:"project_ids"` MetricPrefixes []string `yaml:"metrics_prefixes"` ExtraFilters []string `yaml:"extra_filters"` RequestInterval time.Duration `yaml:"request_interval"` RequestOffset time.Duration `yaml:"request_offset"` IngestDelay bool `yaml:"ingest_delay"` DropDelegatedProjects bool `yaml:"drop_delegated_projects"` ClientTimeout time.Duration `yaml:"gcp_client_timeout"` }
func (*Config) NewIntegration ¶
func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error)
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler for Config
type CounterOrHistogram ¶ added in v1.2.0
type CounterOrHistogram interface { collectors.ConstMetric | collectors.HistogramMetric }
type CounterOrHistogramStore ¶ added in v1.2.0
type CounterOrHistogramStore[T CounterOrHistogram] interface { Increment(metricDescriptor *monitoring.MetricDescriptor, currentValue *T) ListMetrics(metricDescriptorName string) []*T }
type SelfPruningDeltaStore ¶ added in v1.2.0
type SelfPruningDeltaStore[T CounterOrHistogram] struct { // contains filtered or unexported fields }
func NewSelfPruningDeltaStore ¶ added in v1.2.0
func NewSelfPruningDeltaStore[T CounterOrHistogram](l log.Logger, wrapping CounterOrHistogramStore[T]) *SelfPruningDeltaStore[T]
NewSelfPruningDeltaStore provides a configured instance of the SelfPruningDeltaStore which wraps an existing delta store implementation with support for pruning the store when it's not being used as a part of normal operations.
The GCP exporter naturally prunes the store over time during normal operations. If the exporter is being used in clustering mode and does not have active GCP targets this will not happen. If it later has targets assigned any old counter values will be used potentially causing invalid rate and increase calculations.
This is a short term fix until clustering aware components are completed. This will ensure the in-memory counters are pruned when an exporter instance no longer has targets assigned.
func (*SelfPruningDeltaStore[T]) Increment ¶ added in v1.2.0
func (s *SelfPruningDeltaStore[T]) Increment(metricDescriptor *monitoring.MetricDescriptor, currentValue *T)
Increment delegates to the wrapped store We do not track metric descriptors from here to avoid more locking in a high throughput function
func (*SelfPruningDeltaStore[T]) ListMetrics ¶ added in v1.2.0
func (s *SelfPruningDeltaStore[T]) ListMetrics(metricDescriptorName string) []*T
ListMetrics delegates to the wrapped store and updates tracking for the metricDescriptorName based on the results
func (*SelfPruningDeltaStore[T]) Prune ¶ added in v1.2.0
func (s *SelfPruningDeltaStore[T]) Prune(ctx context.Context)