metric

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: AGPL-3.0 Imports: 21 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 AdapterV1 added in v0.2.0

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

AdapterV1 wraps SDK v1 metric.Provider as the engine canonical Provider. 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 Controller

type Controller interface {
	internaltypes.Controller
	ServiceStartup(ctx context.Context, options application.ServiceOptions) error
	ServiceShutdown() error

	// 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 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 Provider added in v0.4.0

type Provider 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)
}

Provider 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 ServiceWrapper added in v0.4.0

type ServiceWrapper struct {
	Ctrl Controller
}

ServiceWrapper is an explicit delegation wrapper around metric.Controller. Excluded: OnPluginInit, OnPluginStart, OnPluginStop, OnPluginShutdown,

OnPluginDestroy

func (*ServiceWrapper) GetProviders added in v0.4.0

func (s *ServiceWrapper) GetProviders() []MetricProviderSummary

func (*ServiceWrapper) GetProvidersForResource added in v0.4.0

func (s *ServiceWrapper) GetProvidersForResource(resourceKey string) []MetricProviderSummary

func (*ServiceWrapper) HasPlugin added in v0.4.0

func (s *ServiceWrapper) HasPlugin(pluginID string) bool

func (*ServiceWrapper) ListPlugins added in v0.4.0

func (s *ServiceWrapper) ListPlugins() ([]string, error)

func (*ServiceWrapper) Query added in v0.4.0

func (s *ServiceWrapper) Query(
	pluginID, connectionID string,
	req metricsdk.QueryRequest,
) (*metricsdk.QueryResponse, error)

func (*ServiceWrapper) QueryAll added in v0.4.0

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

func (*ServiceWrapper) ServiceShutdown added in v0.4.0

func (s *ServiceWrapper) ServiceShutdown() error

func (*ServiceWrapper) ServiceStartup added in v0.4.0

func (s *ServiceWrapper) ServiceStartup(ctx context.Context, options application.ServiceOptions) error

func (*ServiceWrapper) Subscribe added in v0.4.0

func (s *ServiceWrapper) Subscribe(pluginID, connectionID string, req SubscribeRequest) (string, error)

func (*ServiceWrapper) Unsubscribe added in v0.4.0

func (s *ServiceWrapper) Unsubscribe(subscriptionID string) error

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