usage

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package usage answers cluster-wide resource questions: which sandboxes are consuming what, and which hosts are under pressure.

It reads from VictoriaMetrics rather than probing runners directly. Every runner already ships its sandbox metrics through the coordinator into one store, so a single query here sees the whole cluster with no fan-out, no per-node timeout budget, and no partial answer when a runner is unreachable. It also means a window can be historical: the spike that caused the page an hour ago is still there to be found, which no live probe could offer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Server

type Server struct {
	Log *slog.Logger

	// EC resolves what a sandbox is: which app, service and node explain it.
	EC *entityserver.Client

	// Reader resolves what a sandbox is doing. Nil disables usage figures
	// without disabling the listing, so a cluster with no metrics backend still
	// answers "what is running where" instead of failing outright.
	Reader *metrics.VictoriaMetricsReader
}

Server answers resource usage queries. It belongs on the coordinator, which is the only process holding both the entity store and a reader for the cluster's metrics.

func NewServer

func NewServer(log *slog.Logger, ec *entityserver.Client, reader *metrics.VictoriaMetricsReader) *Server

func (*Server) GetApp added in v0.16.0

GetApp is the RPC surface.

func (*Server) GetSandbox

func (s *Server) GetSandbox(ctx context.Context, state *usage_v1alpha.ResourceUsageGetSandbox) error

GetSandbox is the RPC surface.

func (*Server) HttpGetApp

func (s *Server) HttpGetApp(ctx context.Context, state *usage_v1alpha.ResourceUsageHttpGetApp) error

HttpGetApp serves GET /api/v1/usage/apps/{app}, addressing one app.

func (*Server) HttpGetNode

func (s *Server) HttpGetNode(ctx context.Context, state *usage_v1alpha.ResourceUsageHttpGetNode) error

HttpGetNode serves GET /api/v1/usage/nodes/{node}, addressing one host.

func (*Server) HttpGetSandbox

func (s *Server) HttpGetSandbox(ctx context.Context, state *usage_v1alpha.ResourceUsageHttpGetSandbox) error

HttpGetSandbox serves GET /api/v1/usage/sandboxes/{sandbox}.

func (*Server) HttpListApps

func (s *Server) HttpListApps(ctx context.Context, state *usage_v1alpha.ResourceUsageHttpListApps) error

HttpListApps serves GET /api/v1/usage/apps.

func (*Server) HttpListNodes

func (s *Server) HttpListNodes(ctx context.Context, state *usage_v1alpha.ResourceUsageHttpListNodes) error

HttpListNodes serves GET /api/v1/usage/nodes.

func (*Server) HttpListSandboxes

func (s *Server) HttpListSandboxes(ctx context.Context, state *usage_v1alpha.ResourceUsageHttpListSandboxes) error

HttpListSandboxes serves GET /api/v1/usage/sandboxes with flat query parameters.

func (*Server) ListApps

ListApps is the RPC surface.

func (*Server) ListNodes

func (s *Server) ListNodes(ctx context.Context, state *usage_v1alpha.ResourceUsageListNodes) error

ListNodes is the RPC surface.

func (*Server) ListSandboxes

func (s *Server) ListSandboxes(ctx context.Context, state *usage_v1alpha.ResourceUsageListSandboxes) error

ListSandboxes is the RPC surface: grouped arguments, no HTTP binding.

Jump to

Keyboard shortcuts

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