metric

package
v0.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdapterV1 added in v0.2.0

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

AdapterV1 wraps SDK v1 metric.Provider as the engine canonical MetricProvider. For v1, all methods are direct delegation (types identical). When v2 ships and canonical types diverge, AdapterV1 translates v1 → canonical.

func NewAdapterV1 added in v0.2.0

func NewAdapterV1(inner metric.Provider) *AdapterV1

NewAdapterV1 creates a new v1 adapter wrapping the given SDK metric provider.

func (*AdapterV1) GetSupportedResources added in v0.2.0

func (a *AdapterV1) GetSupportedResources(ctx *types.PluginContext) (*metric.ProviderInfo, []metric.Handler)

func (*AdapterV1) Query added in v0.2.0

func (*AdapterV1) StreamMetrics added in v0.2.0

func (a *AdapterV1) StreamMetrics(ctx context.Context, in chan metric.StreamInput) (chan metric.StreamOutput, error)

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 logging.Logger,
	sp pkgsettings.Provider,
	resourceClient resource.Service,
) Controller

type MetricProvider added in v0.2.0

type MetricProvider interface {
	GetSupportedResources(ctx *types.PluginContext) (*metric.ProviderInfo, []metric.Handler)
	Query(ctx *types.PluginContext, req metric.QueryRequest) (*metric.QueryResponse, error)
	StreamMetrics(ctx context.Context, in chan metric.StreamInput) (chan metric.StreamOutput, error)
}

MetricProvider is the engine's version-independent interface for metric plugins. For v1, method signatures match SDK metric.Provider exactly (doc 20 §13.7). When v2 redesigns metric (context.Context, interfaces), this diverges.

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