performance

package
v0.0.0-...-0b35af4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchProcessor

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

BatchProcessor processes items in batches for better performance

func NewBatchProcessor

func NewBatchProcessor(batchSize int, flushTimeout time.Duration, processor func([]interface{}) error) *BatchProcessor

NewBatchProcessor creates a new batch processor

func (*BatchProcessor) Add

func (bp *BatchProcessor) Add(item interface{}) error

Add adds an item to the batch

type CacheEntry

type CacheEntry struct {
	Value      interface{}
	ExpiresAt  time.Time
	AccessTime time.Time
	HitCount   int64
}

CacheEntry represents a cache entry

type CacheManager

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

CacheManager provides intelligent caching

func NewCacheManager

func NewCacheManager(maxSize int, ttl time.Duration) *CacheManager

NewCacheManager creates a new cache manager

func (*CacheManager) Get

func (cm *CacheManager) Get(key string) (interface{}, bool)

Get gets a value from cache

func (*CacheManager) GetStats

func (cm *CacheManager) GetStats() CacheStats

GetStats returns cache statistics

func (*CacheManager) Put

func (cm *CacheManager) Put(key string, value interface{})

Put puts a value in cache

type CacheStats

type CacheStats struct {
	Size      int
	HitCount  int64
	MissCount int64
	HitRate   float64
}

CacheStats represents cache statistics

type CircuitBreaker

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

CircuitBreaker implements circuit breaker pattern

func NewCircuitBreaker

func NewCircuitBreaker(maxFailures int, resetTimeout time.Duration) *CircuitBreaker

NewCircuitBreaker creates a new circuit breaker

func (*CircuitBreaker) Call

func (cb *CircuitBreaker) Call(fn func() error) error

Call executes a function with circuit breaker protection

func (*CircuitBreaker) GetState

func (cb *CircuitBreaker) GetState() CircuitState

GetState returns the current circuit breaker state

type CircuitState

type CircuitState int

CircuitState represents circuit breaker state

const (
	CircuitClosed CircuitState = iota
	CircuitOpen
	CircuitHalfOpen
)

type ConnectionPool

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

ConnectionPool manages connection pooling

func NewConnectionPool

func NewConnectionPool(maxSize int, timeout time.Duration) *ConnectionPool

NewConnectionPool creates a new connection pool

func (*ConnectionPool) Get

func (cp *ConnectionPool) Get(ctx context.Context) (interface{}, error)

Get gets a connection from the pool

func (*ConnectionPool) Put

func (cp *ConnectionPool) Put(conn interface{}) error

Put returns a connection to the pool

type FetchResult

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

FetchResult represents fetch operation result

type HealthCheck

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

HealthCheck handles system health checks

func NewHealthCheck

func NewHealthCheck(logger *zap.Logger) *HealthCheck

func (*HealthCheck) AddCheck

func (hc *HealthCheck) AddCheck(name string, check func(context.Context) error)

func (*HealthCheck) RunChecks

func (hc *HealthCheck) RunChecks(ctx context.Context) map[string]error

RunChecks executes all registered health checks

type MemoryOptimizer

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

MemoryOptimizer optimizes memory usage

func NewMemoryOptimizer

func NewMemoryOptimizer() *MemoryOptimizer

NewMemoryOptimizer creates a new memory optimizer

func (*MemoryOptimizer) GetMemoryStats

func (mo *MemoryOptimizer) GetMemoryStats() MemoryStats

GetMemoryStats returns memory statistics

func (*MemoryOptimizer) OptimizeMemory

func (mo *MemoryOptimizer) OptimizeMemory()

OptimizeMemory optimizes memory usage

type MemoryStats

type MemoryStats struct {
	Alloc      uint64
	TotalAlloc uint64
	Sys        uint64
	NumGC      uint32
	GCPause    uint64
}

MemoryStats represents memory statistics

type MonitoringService

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

MonitoringService handles metrics and observability

func NewMonitoringService

func NewMonitoringService() (*MonitoringService, error)

NewMonitoringService creates a new monitoring service

func (*MonitoringService) GetMetrics

func (s *MonitoringService) GetMetrics() interface{}

GetMetrics returns the underlying metrics registry

func (*MonitoringService) RecordAIRequest

func (s *MonitoringService) RecordAIRequest(provider, model, status string, duration time.Duration, tokens int)

RecordAIRequest records AI service request metrics

func (*MonitoringService) RecordCloudOperation

func (s *MonitoringService) RecordCloudOperation(provider, operation, status string, duration time.Duration)

RecordCloudOperation records cloud API operation metrics

func (*MonitoringService) RecordCostSavings

func (s *MonitoringService) RecordCostSavings(provider, category string, amount float64)

RecordCostSavings records estimated cost savings

func (*MonitoringService) RecordHTTPRequest

func (s *MonitoringService) RecordHTTPRequest(method, path, status string, duration time.Duration)

RecordHTTPRequest records HTTP request metrics

func (*MonitoringService) RecordOptimizationAction

func (s *MonitoringService) RecordOptimizationAction(provider, action, status string)

RecordOptimizationAction records optimization actions taken

func (*MonitoringService) SetActiveWorkers

func (s *MonitoringService) SetActiveWorkers(count int)

SetActiveWorkers updates the active worker count metric

type PerformanceOptimizer

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

PerformanceOptimizer optimizes application performance

func NewPerformanceOptimizer

func NewPerformanceOptimizer(metrics *monitoring.MonitoringService, logger interface{}) *PerformanceOptimizer

NewPerformanceOptimizer creates a new performance optimizer

func (*PerformanceOptimizer) OptimizeResourceFetching

func (po *PerformanceOptimizer) OptimizeResourceFetching(ctx context.Context, adapters []cloud.CloudAdapter) ([]*cloud.ResourceV2, error)

OptimizeResourceFetching optimizes cloud resource fetching

Jump to

Keyboard shortcuts

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