gcp

package module
Version: v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2023 License: Apache-2.0 Imports: 5 Imported by: 1

README

GCP Resource detection library

This is a library intended to be used by Upstream OpenTelemetry resource detectors. It exists within this repository to allow for integration testing of the detection functions in real GCP environments.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Detector

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

Detector collects resource information for all GCP platforms.

func NewDetector

func NewDetector() *Detector

NewDetector returns a *Detector which can get detect the platform, and fetch attributes of the platform on which it is running.

func (*Detector) AppEngineFlexAvailabilityZoneAndRegion added in v0.32.1

func (d *Detector) AppEngineFlexAvailabilityZoneAndRegion() (string, string, error)

AppEngineFlexAvailabilityZoneAndRegion returns the zone and region in which this program is running.

func (*Detector) AppEngineServiceInstance

func (d *Detector) AppEngineServiceInstance() (string, error)

AppEngineServiceInstance returns the service instance of the app engine service.

func (*Detector) AppEngineServiceName

func (d *Detector) AppEngineServiceName() (string, error)

AppEngineServiceName returns the service name of the app engine service.

func (*Detector) AppEngineServiceVersion

func (d *Detector) AppEngineServiceVersion() (string, error)

AppEngineServiceVersion returns the service version of the app engine service.

func (*Detector) AppEngineStandardAvailabilityZone added in v0.32.1

func (d *Detector) AppEngineStandardAvailabilityZone() (string, error)

AppEngineStandardAvailabilityZone returns the zone the app engine service is running in.

func (*Detector) AppEngineStandardCloudRegion added in v0.32.1

func (d *Detector) AppEngineStandardCloudRegion() (string, error)

AppEngineStandardCloudRegion returns the region the app engine service is running in.

func (*Detector) CloudPlatform

func (d *Detector) CloudPlatform() Platform

CloudPlatform returns the platform on which this program is running.

func (*Detector) FaaSCloudRegion

func (d *Detector) FaaSCloudRegion() (string, error)

FaaSCloudRegion detects region from the metadata server. It is in the format /projects/<project_number>/regions/<region>. https://cloud.google.com/run/docs/reference/container-contract#metadata-server

func (*Detector) FaaSID

func (d *Detector) FaaSID() (string, error)

FaaSID returns the instance id of the cloud run instance or cloud function.

func (*Detector) FaaSName

func (d *Detector) FaaSName() (string, error)

FaaSName returns the name of the cloud run or cloud functions service.

func (*Detector) FaaSVersion

func (d *Detector) FaaSVersion() (string, error)

FaaSVersion returns the revision of the cloud run or cloud functions service.

func (*Detector) GCEAvailabilityZoneAndRegion

func (d *Detector) GCEAvailabilityZoneAndRegion() (string, string, error)

GCEAvailabilityZoneAndRegion returns the zone and region in which this program is running.

func (*Detector) GCEHostID

func (d *Detector) GCEHostID() (string, error)

GCEHostID returns the instance ID of the instance on which this program is running.

func (*Detector) GCEHostName

func (d *Detector) GCEHostName() (string, error)

GCEHostName returns the instance name of the instance on which this program is running.

func (*Detector) GCEHostType

func (d *Detector) GCEHostType() (string, error)

GCEHostType returns the machine type of the instance on which this program is running.

func (*Detector) GKEAvailabilityZoneOrRegion

func (d *Detector) GKEAvailabilityZoneOrRegion() (string, LocationType, error)

GKEAvailabilityZoneOrRegion returns the location of the cluster and whether the cluster is zonal or regional.

func (*Detector) GKEClusterName

func (d *Detector) GKEClusterName() (string, error)

GKEClusterName returns the name if the GKE cluster in which this program is running.

func (*Detector) GKEHostID

func (d *Detector) GKEHostID() (string, error)

GKEHostID returns the instance ID of the instance on which this program is running.

func (*Detector) ProjectID

func (d *Detector) ProjectID() (string, error)

ProjectID returns the ID of the project in which this program is running.

type LocationType

type LocationType int64
const (
	UndefinedLocation LocationType = iota
	Zone
	Region
)

type Platform

type Platform int64
const (
	UnknownPlatform Platform = iota
	GKE
	GCE
	CloudRun
	CloudFunctions
	AppEngineStandard
	AppEngineFlex
)

Jump to

Keyboard shortcuts

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