metric

package
v0.27.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 23 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 delegates the unchanged utility cohort and explicitly selects the canonical resource stream extension; it never falls back to native Struct.

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) StreamResourceMetrics added in v0.12.0

func (a *AdapterV1) StreamResourceMetrics(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
	SetReferenceAdmitter(resource.ReferenceAdmitter)
	SetUIReferenceAdmitter(resource.ReferenceAdmitter)

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

	// Querying
	Query(pluginID, connectionID string, req metric.QueryRequest) (*metric.QueryResponse, error)
	QueryAll(connectionID string, req metric.QueryRequest) (map[string]*metric.QueryResponse, error)
	ReadResourceMetrics(ctx context.Context, pluginID string, req metric.QueryRequest) (*metric.QueryResponse, error)

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

Controller manages metric providers across all plugins.

func NewController

func NewController(
	logger logging.Logger,
	sp pkgsettings.Provider,
	resourceClient resource.ConnectionReader,
) 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)
	StreamResourceMetrics(ctx context.Context, in chan metric.StreamInput) (chan metric.StreamOutput, error)
}

Provider is the host's metric utility boundary. Mixed resource/nonresource streams use the explicitly negotiated canonical resource lane.

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,
	encoded string,
) (*metricsdk.QueryResponse, error)

func (*ServiceWrapper) QueryAll added in v0.4.0

func (s *ServiceWrapper) QueryAll(connectionID, encoded string) (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, encoded string) (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      *resourcev2.Value             `json:"resource_data,omitempty"`
	Reference         *resourcev2.ResourceReference `json:"reference,omitempty"`
	Route             *resourcev2.AccessRoute       `json:"route,omitempty"`
	MetricIDs         []string                      `json:"metric_ids"`
	Interval          time.Duration                 `json:"interval"`
	Params            map[string]string             `json:"params,omitempty"`
}

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