metric

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: AGPL-3.0 Imports: 17 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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