gce

package
v1.64.1 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2021 License: Apache-2.0 Imports: 12 Imported by: 3

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://prometheus.io/docs/prometheus/latest/configuration/configuration/#gce_sd_config 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            discoveryutils.SortedLabels
}

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 added in v1.55.0

func (sdc *SDConfig) GetLabels(baseDir string) ([]map[string]string, error)

GetLabels returns gce labels according to sdc.

func (*SDConfig) MustStop added in v1.55.0

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 {
	// contains filtered or unexported fields
}

ZoneYAML holds info about zones.

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