gcp_exporter

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const FiveMinutePruneWindow int64 = 5 * 60

Five minutes in seconds for Unix comparisons

Variables

View Source
var DefaultConfig = Config{
	ClientTimeout:         15 * time.Second,
	RequestInterval:       5 * time.Minute,
	RequestOffset:         0,
	IngestDelay:           false,
	DropDelegatedProjects: false,
}

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) InstanceKey

func (c *Config) InstanceKey(_ string) (string, error)

func (*Config) Name

func (c *Config) Name() string

func (*Config) NewIntegration

func (c *Config) NewIntegration(l log.Logger) (integrations.Integration, error)

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler for Config

func (*Config) Validate

func (c *Config) Validate() error

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)

Jump to

Keyboard shortcuts

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