metric

package
v0.1.10 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client is the Wails-bound client exposing metric methods to the frontend.

func NewClient

func NewClient(controller Controller) *Client

func (*Client) GetProviders

func (c *Client) GetProviders() []MetricProviderSummary

func (*Client) GetProvidersForResource

func (c *Client) GetProvidersForResource(resourceKey string) []MetricProviderSummary

func (*Client) Query

func (c *Client) Query(
	pluginID, connectionID string,
	req sdkmetric.QueryRequest,
) (*sdkmetric.QueryResponse, error)

func (*Client) QueryAll

func (c *Client) QueryAll(
	connectionID, resourceKey, resourceID, namespace string,
	resourceData map[string]interface{},
	metricIDs []string,
	shape sdkmetric.MetricShape,
	startTime, endTime time.Time,
	step time.Duration,
) (map[string]*sdkmetric.QueryResponse, error)

func (*Client) Subscribe

func (c *Client) Subscribe(
	pluginID, connectionID string,
	req SubscribeRequest,
) (string, error)

func (*Client) Unsubscribe

func (c *Client) Unsubscribe(subscriptionID string) error

type Controller

type Controller interface {
	internaltypes.Controller
	Run(ctx context.Context)

	// Discovery
	GetProviders() []MetricProviderSummary
	GetProvidersForResource(resourceKey string) []MetricProviderSummary

	// Querying
	Query(pluginID, connectionID string, req metric.QueryRequest) (*metric.QueryResponse, error)
	QueryAll(connectionID, resourceKey, resourceID, namespace string,
		resourceData map[string]interface{}, metricIDs []string,
		shape metric.MetricShape, startTime, endTime time.Time, step time.Duration,
	) (map[string]*metric.QueryResponse, error)

	// Streaming
	Subscribe(pluginID, connectionID string, req SubscribeRequest) (string, error)
	Unsubscribe(subscriptionID string) error
}

Controller manages metric providers across all plugins.

func NewController

func NewController(
	logger *zap.SugaredLogger,
	sp pkgsettings.Provider,
	resourceClient resource.IClient,
) Controller

type MetricProviderSummary

type MetricProviderSummary struct {
	PluginID    string           `json:"plugin_id"`
	ProviderID  string           `json:"provider_id"`
	Name        string           `json:"name"`
	Icon        string           `json:"icon"`
	Description string           `json:"description"`
	Handlers    []metric.Handler `json:"handlers"`
}

MetricProviderSummary is a lightweight summary of a metric provider, exposed to the frontend.

type SubscribeRequest

type SubscribeRequest struct {
	ResourceKey       string                 `json:"resource_key"`
	ResourceID        string                 `json:"resource_id"`
	ResourceNamespace string                 `json:"resource_namespace"`
	ResourceData      map[string]interface{} `json:"resource_data"`
	MetricIDs         []string               `json:"metric_ids"`
	Interval          time.Duration          `json:"interval"`
}

SubscribeRequest contains parameters for subscribing to a metric stream.

Jump to

Keyboard shortcuts

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