gcpip

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IPAllocationError

type IPAllocationError struct {
	Operation  string
	Region     string
	Attempt    int
	StatusCode int
	QuotaInfo  *QuotaDetails
	Err        error
	Timestamp  time.Time
}

IPAllocationError wraps errors from IP allocation attempts

func NewIPAllocationError

func NewIPAllocationError(op, region string, attempt int, err error) *IPAllocationError

NewIPAllocationError creates a new IP allocation error

func (*IPAllocationError) Error

func (e *IPAllocationError) Error() string

type IPAllocationMetrics

type IPAllocationMetrics struct {
	AttemptCount int
	FailureCount int
	LatencyMs    float64
	ErrorTypes   map[string]int
	RegionStats  map[string]*RegionMetrics
	StartTime    time.Time
	LastAttempt  time.Time
	// contains filtered or unexported fields
}

IPAllocationMetrics tracks metrics for IP allocation attempts

func NewIPAllocationMetrics

func NewIPAllocationMetrics() *IPAllocationMetrics

NewIPAllocationMetrics creates a new metrics tracker

func (*IPAllocationMetrics) RecordAttempt

func (m *IPAllocationMetrics) RecordAttempt(region string)

RecordAttempt records an IP allocation attempt

func (*IPAllocationMetrics) RecordError

func (m *IPAllocationMetrics) RecordError(region, errorType string, latencyMs float64)

RecordError records an IP allocation failure

func (*IPAllocationMetrics) UpdateQuota

func (m *IPAllocationMetrics) UpdateQuota(region string, used, limit int)

UpdateQuota updates quota information for a region

type QuotaDetails

type QuotaDetails struct {
	Used      int
	Limit     int
	Region    string
	Timestamp time.Time
}

QuotaDetails contains information about IP address quota

type RegionMetrics

type RegionMetrics struct {
	Attempts      int
	Failures      int
	AvgLatencyMs  float64
	QuotaLimit    int
	QuotaUsage    int
	LastErrorTime time.Time
}

RegionMetrics tracks per-region allocation metrics

Jump to

Keyboard shortcuts

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