monitoring

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Change

type Change struct {
	ResourceID string
	Type       ChangeType
	Details    map[string]interface{}
	Timestamp  time.Time
}

Change represents a detected change

type ChangeDetector

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

ChangeDetector detects changes in resources

func NewChangeDetector

func NewChangeDetector() *ChangeDetector

NewChangeDetector creates a new change detector

func (*ChangeDetector) DetectChanges

func (d *ChangeDetector) DetectChanges(provider string, currentResources []interface{}) []Change

DetectChanges detects changes in resources

type ChangeType

type ChangeType string

ChangeType represents the type of change detected

const (
	ChangeTypeCreate ChangeType = "create"
	ChangeTypeUpdate ChangeType = "update"
	ChangeTypeDelete ChangeType = "delete"
	ChangeTypeDrift  ChangeType = "drift"
)

type CloudEvent

type CloudEvent struct {
	ID         string                 `json:"id"`
	Source     string                 `json:"source"`
	Type       string                 `json:"type"`
	Time       time.Time              `json:"time"`
	Region     string                 `json:"region,omitempty"`
	Account    string                 `json:"account,omitempty"`
	Resource   string                 `json:"resource,omitempty"`
	Action     string                 `json:"action,omitempty"`
	Principal  string                 `json:"principal,omitempty"`
	Details    map[string]interface{} `json:"details,omitempty"`
	ChangeType ChangeType             `json:"change_type,omitempty"`
}

CloudEvent represents a cloud provider event

type ContinuousMonitor

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

ContinuousMonitor provides real-time infrastructure monitoring

func NewContinuousMonitor

func NewContinuousMonitor(config MonitorConfig) *ContinuousMonitor

NewContinuousMonitor creates a new continuous monitor

func (*ContinuousMonitor) RegisterProvider

func (m *ContinuousMonitor) RegisterProvider(name string, provider providers.CloudProvider)

RegisterProvider registers a cloud provider for monitoring

func (*ContinuousMonitor) Start

func (m *ContinuousMonitor) Start(ctx context.Context) error

Start begins continuous monitoring

func (*ContinuousMonitor) Stop

func (m *ContinuousMonitor) Stop()

Stop stops continuous monitoring

type EventBuffer

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

EventBuffer stores events for batch processing

func (*EventBuffer) Add

func (b *EventBuffer) Add(event CloudEvent)

Add adds an event to the buffer

func (*EventBuffer) Flush

func (b *EventBuffer) Flush() []CloudEvent

Flush returns all events and clears the buffer

type EventHandler

type EventHandler func(event CloudEvent) error

EventHandler processes specific event types

type EventMetrics

type EventMetrics struct {
	TotalEvents     int64
	ProcessedEvents int64
	FailedEvents    int64
	EventsByType    map[string]int64
	LastEventTime   time.Time
	// contains filtered or unexported fields
}

EventMetrics tracks event processing metrics

type EventProcessor

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

EventProcessor processes cloud events

func NewEventProcessor

func NewEventProcessor(bufferSize int) *EventProcessor

NewEventProcessor creates a new event processor

func (*EventProcessor) GetMetrics

func (p *EventProcessor) GetMetrics() EventMetrics

GetMetrics returns current metrics

func (*EventProcessor) ProcessEvent

func (p *EventProcessor) ProcessEvent(event CloudEvent)

ProcessEvent processes a single event

func (*EventProcessor) RegisterHandler

func (p *EventProcessor) RegisterHandler(eventType string, handler EventHandler)

RegisterHandler registers an event handler

func (*EventProcessor) Start

func (p *EventProcessor) Start(ctx context.Context)

Start starts the event processor

func (*EventProcessor) Stop

func (p *EventProcessor) Stop()

Stop stops the event processor

type MonitorConfig

type MonitorConfig struct {
	WebhookPort     int
	PollingInterval time.Duration
	AdaptivePolling bool
	MinPollInterval time.Duration
	MaxPollInterval time.Duration
	EventBuffer     int
	EnableWebhooks  bool
	EnablePolling   bool
}

MonitorConfig configures continuous monitoring

type WebhookServer

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

WebhookServer handles incoming webhook events

func NewWebhookServer

func NewWebhookServer(port int, handler func(CloudEvent)) *WebhookServer

NewWebhookServer creates a new webhook server

func (*WebhookServer) Start

func (s *WebhookServer) Start(ctx context.Context) error

Start starts the webhook server

func (*WebhookServer) Stop

func (s *WebhookServer) Stop()

Stop stops the webhook server

Jump to

Keyboard shortcuts

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