gcp

package
v0.0.1-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	/*
	* An MQL query that will return data from Google Cloud with the
	* - Instance Name
	* - Region
	* - Zone
	* - Machine Type
	* - Reserved CPUs
	* - Utilization
	* NOTE: Using reserved CPUs as vCPUs, because they are equivalent for visible
	* vCPUs within a guest instance, except for shared-core machines:
	* https://cloud.google.com/monitoring/api/metrics_gcp
	 */
	CPUQuery = `` /* 465-byte string literal not displayed */

	/*
	* An MQL query that will return memory data from Google Cloud with the
	* - Instance Name
	* - Region
	* - Zone
	* - Machine Type
	* - Memory Usage
	* NOTE: According to Google the 'ram_used' metric is only available for
	* e2-xxxx instances, which means that we can get memory usage for other types
	* of VM's
	 */
	MEMQuery = `` /* 309-byte string literal not displayed */

)

Functions

func Sources

func Sources(ctx context.Context, cfg *config.Provider) []v1.Source

Sources instantiates a slice of instances of the Google Sources configured for use, one per project configured

Types

type Client

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

Client is the structure used as the provider for Google Cloud Platform

func New

func New(
	ctx context.Context,
	account *config.Account,
	opts ...options,
) (c *Client, teardown func(), err error)

New returns a new instance of the GCP provider as well as a function to cleanup connections once done

func (*Client) GetMetricsForInstances

func (c *Client) GetMetricsForInstances(
	ctx context.Context,
	project, window string,
) error

GetMetricsForInstances retrieves all the metrics for a given instance And updates the cached instance with the metrics

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context, project string)

Refresh fetches all the Instances for a project and stores metadata in order to help with metric collections

type Source

type Source struct {
	// Google Client
	*Client

	// The Project that Client is setup for
	Project *string

	// Teardown functionality
	Shutdown func()
}

Source is a configured google source that adheres to Aethers source interface

func (*Source) Fetch

func (s *Source) Fetch(ctx context.Context) ([]*v1.Instance, error)

Fetch returns a slice of instances, this is to adhere to the sources interface

func (*Source) Stop

func (s *Source) Stop(ctx context.Context) error

Stop is used to gracefully shutdown a source

Jump to

Keyboard shortcuts

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