resourcedetector

package
v0.0.0-...-b2113b7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGCEMetadataProvider

func NewGCEMetadataProvider() gceDataProvider

Types

type GCEMetadataProvider

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

Provide the GCE metadata using the on-VM metadata server The following metadata are not available on the metadata server: * Labels * Subnet URL

type GCEResource

type GCEResource struct {
	Project       string
	Zone          string
	Network       string
	Subnetwork    string
	PublicIP      string
	PrivateIP     string
	InstanceID    string
	InstanceName  string
	Tags          string
	MachineType   string
	DefaultScopes []string
	Metadata      map[string]string
	Label         map[string]string
	InterfaceIPv4 map[string]string
}

GCEResource implements the Resource interface and provide attributes of the VM when on GCE

func (GCEResource) MonitoredResource

func (r GCEResource) MonitoredResource() *monitoredres.MonitoredResource

func (GCEResource) OTelResourceAttributes

func (r GCEResource) OTelResourceAttributes() map[string]string

func (GCEResource) ProjectName

func (r GCEResource) ProjectName() string

func (GCEResource) PrometheusStyleMetadata

func (r GCEResource) PrometheusStyleMetadata() map[string]string

type GCEResourceBuilder

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

func (*GCEResourceBuilder) GetResource

func (gd *GCEResourceBuilder) GetResource() (Resource, error)

Return a resource instance with all the attributes based on the single and nested attributes spec

type GCEResourceBuilderInterface

type GCEResourceBuilderInterface interface {
	GetResource() (Resource, error)
}

type Resource

type Resource interface {
	ProjectName() string
	MonitoredResource() *monitoredres.MonitoredResource
	OTelResourceAttributes() map[string]string
	PrometheusStyleMetadata() map[string]string
}

An implementation of the Resource interface will have fields represent available attributes about the current monitoring resource.

func GetGCEResource

func GetGCEResource() (Resource, error)

func GetResource

func GetResource() (Resource, error)

Get a resource instance for the current environment; In order to access the attributes of a specific type of resource, needs to cast the returned Resource instance to its underlying type: actual, ok := resource.(GCEResource)

func GetUnrecognizedPlatformResource

func GetUnrecognizedPlatformResource() (Resource, error)

type UnrecognizedPlatformResource

type UnrecognizedPlatformResource struct {
}

UnrecognizedPlatformResource that returns an empty resource instance without any attributes for unrecognized environments

func (UnrecognizedPlatformResource) MonitoredResource

func (UnrecognizedPlatformResource) OTelResourceAttributes

func (UnrecognizedPlatformResource) OTelResourceAttributes() map[string]string

func (UnrecognizedPlatformResource) ProjectName

func (UnrecognizedPlatformResource) ProjectName() string

func (UnrecognizedPlatformResource) PrometheusStyleMetadata

func (UnrecognizedPlatformResource) PrometheusStyleMetadata() map[string]string

Jump to

Keyboard shortcuts

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