Documentation
¶
Overview ¶
Package ops is the panel's own diagnostics and data lifecycle for the owner: the log ring and its level, retention of the tables the sweep prunes, a scrubbed export, and the /metrics endpoint; and two reads for every admin, the panel's own resources and the fleet's load (internal/panel/capacity). It is the OpsService of proto/mistgate/ops/v1, a package of its own so the Cloudflare edition's admin Worker does not link it; that edition mounts a stub that answers UNIMPLEMENTED (internal/panel/app/ops_wiring_js.go).
Everything that leaves the process passes through Scrubber: addresses, the panel's secret names, key-shaped values, and only an allow-list of log attribute keys. The ring itself keeps raw records and never leaves this package unscrubbed.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Store *store.Store
// Ring and Level are the process logger's (logring.New). A panel built without them (a test) has no logs to show.
Ring *logring.Ring
Level *slog.LevelVar
DefaultLevel slog.Level
Format string // "text" or "json"
// Secrets are the panel's secret names (the agent SNI and the secret path prefixes), removed from everything that leaves.
Secrets []string
// StepUp is the fresh sign-in check (auth.Service.RequireStepUp) that retention changes, the export and the metrics switch ask for.
StepUp func(context.Context) error
// Fleet, Health and Relay are the raw admin services /metrics reads (no session in front of them: the metrics handler has its
// own token). nil leaves that part of the metrics out.
Fleet, Health, Relay http.Handler
// Debug starts and stops the on-demand debug captures of a node (the fleet). nil answers UNIMPLEMENTED for them.
Debug DebugBackend
// RPC is the admin API's call counter that the HTTP middleware fills (httpserver.Config.RPCStats); nil leaves the RPC
// load of GetPanelResources empty.
RPC *rpcstat.Window
// Capacity reads the nodes for GetFleetLoad over a window of hours (fleet.CapacityNodes); nil answers with no nodes.
Capacity func(ctx context.Context, hours int) ([]capacity.Node, error)
Now func() time.Time
Log *slog.Logger
}
Config configures Service.
type DebugBackend ¶
type DebugBackend interface {
StartDebugCapture(ctx context.Context, in fleet.DebugStart) (store.DebugCaptureRow, error)
StopDebugCapture(ctx context.Context, captureID string) (store.DebugCaptureRow, error)
}
DebugBackend is what the service needs of the fleet.
type Scrubber ¶
type Scrubber struct {
// contains filtered or unexported fields
}
Scrubber cleans text that leaves the panel. Its order matters: secret names first (they may sit inside an address-like string), then addresses, then the MCP scrubbers for credential-shaped text.
func NewScrubber ¶
NewScrubber takes the panel's secret names (SNI, path prefixes); names shorter than minSecret are ignored.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the OpsService.
func (*Service) Handler ¶
Handler is the Connect handler, mounted at /api/mistgate.ops.v1.OpsService/ behind the session middleware.
func (*Service) MetricsHandler ¶
MetricsHandler serves /metrics and reports whether it answered. Off, or with no token made yet, it writes nothing and returns false, so the admin answers as for any unknown path. A missing or wrong token: 401.