gce

package
v0.0.0-...-7d8b796 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SDCheckInterval = flag.Duration("promscrape.gceSDCheckInterval", time.Minute, "Interval for checking for changes in gce. "+
	"This works only if gce_sd_configs is configured in '-promscrape.config' file. "+
	"See https://docs.victoriametrics.com/sd_configs.html#gce_sd_configs for details")

SDCheckInterval defines interval for targets refresh.

Functions

This section is empty.

Types

type AccessConfig

type AccessConfig struct {
	Type  string
	NatIP string
}

AccessConfig is access config from https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

type Instance

type Instance struct {
	ID                string `json:"id"`
	Name              string
	Status            string
	MachineType       string
	Zone              string
	NetworkInterfaces []NetworkInterface
	Tags              TagList
	Metadata          MetadataList
	Labels            *promutils.Labels
}

Instance is instance from https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

type InstanceList

type InstanceList struct {
	Items         []Instance
	NextPageToken string
}

InstanceList is response to https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

type MetadataEntry

type MetadataEntry struct {
	Key   string
	Value string
}

MetadataEntry is a single entry from metadata

type MetadataList

type MetadataList struct {
	Items []MetadataEntry
}

MetadataList is metadataList from https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

type NetworkInterface

type NetworkInterface struct {
	Name          string
	Network       string
	Subnetwork    string
	NetworkIP     string
	AccessConfigs []AccessConfig
}

NetworkInterface is network interface from https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

type SDConfig

type SDConfig struct {
	Project string   `yaml:"project"`
	Zone    ZoneYAML `yaml:"zone"`
	Filter  string   `yaml:"filter,omitempty"`
	// RefreshInterval time.Duration `yaml:"refresh_interval"`
	// refresh_interval is obtained from `-promscrape.gceSDCheckInterval` command-line option.
	Port         *int    `yaml:"port,omitempty"`
	TagSeparator *string `yaml:"tag_separator,omitempty"`
}

SDConfig represents service discovery config for gce.

See https://prometheus.io/docs/prometheus/latest/configuration/configuration/#gce_sd_config

func (*SDConfig) GetLabels

func (sdc *SDConfig) GetLabels(baseDir string) ([]*promutils.Labels, error)

GetLabels returns gce labels according to sdc.

func (*SDConfig) MustStop

func (sdc *SDConfig) MustStop()

MustStop stops further usage for sdc.

type TagList

type TagList struct {
	Items []string
}

TagList is tag list from https://cloud.google.com/compute/docs/reference/rest/v1/instances/list

type Zone

type Zone struct {
	Name string
}

Zone is zone from https://cloud.google.com/compute/docs/reference/rest/v1/zones/list

type ZoneList

type ZoneList struct {
	Items         []Zone
	NextPageToken string
}

ZoneList is response to https://cloud.google.com/compute/docs/reference/rest/v1/zones/list

type ZoneYAML

type ZoneYAML struct {
	Zones []string
}

ZoneYAML holds info about zones.

func (ZoneYAML) MarshalYAML

func (z ZoneYAML) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaler

func (*ZoneYAML) UnmarshalYAML

func (z *ZoneYAML) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML implements yaml.Unmarshaler

Jump to

Keyboard shortcuts

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