collector

package
v0.0.0-...-9f02593 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NodeClusterTypeUUIDNamespace     = "b9b24e78-5764-461b-8a0b-55bbe189d3d9"
	ClusterResourceUUIDNamespace     = "75d74e65-f51f-4195-94ea-e4495b940a8f"
	ClusterResourceTypeUUIDNamespace = "be370c55-e9fc-4094-81c3-83d6be4a6a14"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AlarmsDataSource

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

AlarmsDataSource is the struct that holds the alarms data source

func (*AlarmsDataSource) GetGenerationID

func (d *AlarmsDataSource) GetGenerationID() int

GetGenerationID retrieves the current generation id for this data source

func (*AlarmsDataSource) GetID

func (d *AlarmsDataSource) GetID() uuid.UUID

GetID returns the data source ID for this data source

func (*AlarmsDataSource) IncrGenerationID

func (d *AlarmsDataSource) IncrGenerationID() int

IncrGenerationID increments the current generation id for this data source

func (*AlarmsDataSource) Init

func (d *AlarmsDataSource) Init(uuid uuid.UUID, generationID int, _ chan<- *async.AsyncChangeEvent)

Init initializes the data source with its configuration data

func (*AlarmsDataSource) Name

func (d *AlarmsDataSource) Name() string

Name returns the name of this data source

type ClusterDataSource

type ClusterDataSource interface {
	DataSource
	MakeNodeClusterType(resource *models.NodeCluster) (*models.NodeClusterType, error)
	MakeClusterResourceType(resource *models.ClusterResource) (*models.ClusterResourceType, error)
}

ClusterDataSource defines an interface of a data source capable of getting handling Cluster resources.

type Collector

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

Collector defines the attributes required by the collector implementation.

func NewCollector

func NewCollector(repo *repo.ClusterRepository, notificationHandler NotificationHandler, dataSources []DataSource) *Collector

NewCollector creates a new collector instance

func (*Collector) Run

func (c *Collector) Run(ctx context.Context) error

Run executes the collector main loop to gather data from external sources and writing to the database

type DataSource

type DataSource interface {
	Name() string
	GetID() uuid.UUID
	Init(dataSourceID uuid.UUID, generationID int, asyncEventChannel chan<- *async.AsyncChangeEvent)
	GetGenerationID() int
	IncrGenerationID() int
}

DataSource represents the operations required to be supported by any objects implementing a data collection backend.

func NewAlarmsDataSource

func NewAlarmsDataSource() (DataSource, error)

NewAlarmsDataSource creates a new AlarmsDataSource

func NewK8SDataSource

func NewK8SDataSource(cloudID uuid.UUID, extensions []string) (DataSource, error)

NewK8SDataSource creates a new instance of an K8S data source collector whose purpose is to collect data from the Kubernetes API to be included in the node cluster, node cluster type, cluster resource and cluster resource type tables.

type K8SDataSource

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

K8SDataSource defines an instance of a data source collector that interacts with the Kubernetes API

func (*K8SDataSource) GetGenerationID

func (d *K8SDataSource) GetGenerationID() int

GetGenerationID retrieves the current generation id for this data source.

func (*K8SDataSource) GetID

func (d *K8SDataSource) GetID() uuid.UUID

GetID returns the data source ID for this data source

func (*K8SDataSource) HandleAsyncEvent

func (d *K8SDataSource) HandleAsyncEvent(ctx context.Context, obj interface{}, eventType async.AsyncEventType) (uuid.UUID, error)

HandleAsyncEvent handles an add/update/delete to an object received by from the Reflector.

func (*K8SDataSource) HandleSyncComplete

func (d *K8SDataSource) HandleSyncComplete(ctx context.Context, objectType runtime.Object, keys []uuid.UUID) error

HandleSyncComplete handles the end of a sync operation by sending an event down to the Collector.

func (*K8SDataSource) IncrGenerationID

func (d *K8SDataSource) IncrGenerationID() int

IncrGenerationID increments the current generation id for this data source.

func (*K8SDataSource) Init

func (d *K8SDataSource) Init(uuid uuid.UUID, generationID int, asyncEventChannel chan<- *async.AsyncChangeEvent)

Init initializes the data source with its configuration data; including the ID, the GenerationID, and its extension values if provided.

func (*K8SDataSource) MakeClusterResourceType

func (d *K8SDataSource) MakeClusterResourceType(resource *models.ClusterResource) (*models.ClusterResourceType, error)

MakeClusterResourceType creates an instance of a ResourceType from a Resource object.

func (*K8SDataSource) MakeNodeClusterType

func (d *K8SDataSource) MakeNodeClusterType(resource *models.NodeCluster) (*models.NodeClusterType, error)

MakeNodeClusterType creates an instance of a NodeClusterType from a NodeCluster object.

func (*K8SDataSource) Name

func (d *K8SDataSource) Name() string

Name returns the name of this data source

func (*K8SDataSource) Watch

func (d *K8SDataSource) Watch(ctx context.Context) error

Watch starts a watcher for each of the resources supported by this data source. The watch is dispatched to a go routine. If the context is canceled, then the watchers are stopped.

type NotificationHandler

type NotificationHandler interface {
	Notify(ctx context.Context, event *notifier.Notification)
}

NotificationHandler defines an interface over which notifications are published.

type NotificationTransformer

type NotificationTransformer struct {
}

NotificationTransformer is responsible for transforming notification to add subscription-specific details before being published to the subscriber.

func NewNotificationTransformer

func NewNotificationTransformer() *NotificationTransformer

NewNotificationTransformer creates a new NotificationTransformer

func (*NotificationTransformer) Transform

func (t *NotificationTransformer) Transform(subscription *notifier.SubscriptionInfo, notification *notifier.Notification) (*notifier.Notification, error)

Transform provides a mechanism to augment a notification with subscription-specific information. If no transformation is possible or necessary, then the original notification is returned.

type WatchableDataSource

type WatchableDataSource interface {
	Watch(ctx context.Context) error
}

WatchableDataSource defines an interface of a data source capable of watching for async events.

Jump to

Keyboard shortcuts

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