Help us shape the future of Go! Take the 2026 Go Developer Survey

pilot

package
v1.12.10 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package pilot ships the migrated dashboard contributor used to validate the contract end-to-end: extensions.list, services.list, services.detail, and the metrics.summary subscription, all wired against the existing collector and contributor registry.

See SLICE_C_DESIGN.md in the parent contract directory for the spec.

Index

Constants

View Source
const DefaultMetricsInterval = 5 * time.Second

DefaultMetricsInterval is the production tick rate for metrics.summary.

Variables

This section is empty.

Functions

func Register

func Register(d *dispatcher.Dispatcher, contractReg contract.Registry, wreg contract.WardenRegistry, deps Deps) error

Register loads the embedded pilot manifest, validates it, registers it with the contract registry, and binds the four handlers against the dispatcher. Idempotent: calling twice on the same registries returns the duplicate- registration error from the second call.

Types

type AppInfo added in v1.6.6

type AppInfo struct {
	Contributor string `json:"contributor"`
	DisplayName string `json:"displayName"`
	Slug        string `json:"slug,omitempty"`
	Root        bool   `json:"root,omitempty"`
	Icon        string `json:"icon,omitempty"`
	Priority    int    `json:"priority"`
	Home        string `json:"home,omitempty"`
}

AppInfo is the wire shape of one app-switcher entry: contract.AppInfo joined with the owning contributor's name so a caller can group nav items by app without a second lookup.

For root apps (Root=true), Slug is empty and Home stays unprefixed — the platform app owns the bare URL space (/, /health, ...). For other apps Home is projected to /@<slug><home>.

Nothing consumes this yet: apps.list has no TypeScript caller, and definePlugin declares plugin routes bare rather than under /@<slug>/*. Read the /@<slug> form as a proposal, not as the plugin routing contract. A later wave decides whether definePlugin adopts the prefix or the projection goes.

type AppsListResponse added in v1.6.6

type AppsListResponse struct {
	Apps []AppInfo `json:"apps"`
}

AppsListResponse is the response of the apps.list query.

type AuditListInput

type AuditListInput struct {
	Limit       int    `json:"limit,omitempty"`
	Contributor string `json:"contributor,omitempty"`
	Intent      string `json:"intent,omitempty"`
	User        string `json:"user,omitempty"`
	Result      string `json:"result,omitempty"`
}

AuditListInput is the wire input for the audit.list query.

type AuditListResponse

type AuditListResponse struct {
	Records []AuditRecordDTO `json:"records"`
	Total   int              `json:"total"`
}

AuditListResponse is the wire output of audit.list.

type AuditProvider

type AuditProvider interface {
	List(filter contract.AuditFilter) []contract.AuditRecord
	Subscribe() (<-chan contract.AuditRecord, func())
}

AuditProvider is the slice of contract.AuditStore the audit handlers need. Defined here (not as a type alias) so tests can supply a stub without importing the full contract package surface.

type AuditRecordDTO

type AuditRecordDTO struct {
	Time          string `json:"time"`
	Contributor   string `json:"contributor"`
	Intent        string `json:"intent"`
	IntentVersion int    `json:"intentVersion,omitempty"`
	Subject       string `json:"subject,omitempty"`
	User          string `json:"user,omitempty"`
	Result        string `json:"result"`
	LatencyMs     int64  `json:"latencyMs"`
	CorrelationID string `json:"correlationID,omitempty"`
}

AuditRecordDTO is the wire shape for one audit record. Timestamps are RFC3339Nano strings and the payload field is omitted (slice (k) keeps the store free of payload data; per-intent redaction is a slice (l) concern).

type CollectorEntry

type CollectorEntry struct {
	Name           string `json:"name"`
	Type           string `json:"type"`
	MetricsCount   int    `json:"metricsCount"`
	Status         string `json:"status"`
	LastCollection string `json:"lastCollection,omitempty"`
}

CollectorEntry is one row of the metrics-report collectors list.

type Deps

type Deps struct {
	Extensions    ExtensionsProvider
	Services      ServicesProvider
	Metrics       MetricsProvider
	Overview      OverviewProvider
	Health        HealthProvider
	MetricsReport MetricsReportProvider
	Traces        TracesProvider
	// Audit is the slice (k) audit store. nil yields CodeUnavailable on
	// audit.list / audit.tail; the rest of the pilot stays functional.
	Audit AuditProvider
	// MetricsInterval is how often metrics.summary emits. Zero defaults to
	// DefaultMetricsInterval. Tests use millisecond values.
	MetricsInterval time.Duration
}

Deps bundles the data sources the pilot handlers need. The dashboard extension constructs this when it wires the pilot at startup.

Slice (c) introduced Extensions / Services / Metrics. Slice (h) adds Overview / Health / MetricsReport / Traces so the pilot's intents cover the same data every one of the old core pages rendered; nil providers are tolerated and the corresponding handlers return CodeUnavailable.

type ExtensionInfo

type ExtensionInfo struct {
	Name        string `json:"name"`
	DisplayName string `json:"displayName"`
	Version     string `json:"version"`
	Description string `json:"description,omitempty"`
	// PageCount and WidgetCount counted server-rendered dashboard pages and
	// widgets, which no longer exist. Both are always zero. They stay in the
	// payload only so clients that still read them keep working.
	PageCount   int `json:"pageCount"`
	WidgetCount int `json:"widgetCount"`
}

ExtensionInfo summarises one extension registered with the app.

type ExtensionsList

type ExtensionsList struct {
	Extensions []ExtensionInfo `json:"extensions"`
}

ExtensionsList is the response payload for the extensions.list query.

type ExtensionsProvider added in v1.12.0

type ExtensionsProvider interface {
	ListExtensions() []ExtensionInfo
}

ExtensionsProvider lists the extensions registered with the app.

type HealthEntry

type HealthEntry struct {
	Name       string `json:"name"`
	Status     string `json:"status"`
	Message    string `json:"message,omitempty"`
	DurationMs int64  `json:"durationMs"`
	Critical   bool   `json:"critical"`
}

HealthEntry is one row of the health.list query — flattened from the per- service map the collector returns so resource.list can render it.

type HealthList

type HealthList struct {
	OverallStatus  string        `json:"overallStatus"`
	HealthySummary int           `json:"healthySummary"`
	Total          int           `json:"total"`
	Services       []HealthEntry `json:"services"`
}

HealthList is the response payload for the health query.

type HealthProvider

type HealthProvider interface {
	CollectHealth(ctx context.Context) *collector.HealthData
}

HealthProvider is the slice of DataCollector health.go reads.

type MetricEntryDTO

type MetricEntryDTO struct {
	Name  string `json:"name"`
	Type  string `json:"type"`
	Value any    `json:"value,omitempty"`
}

MetricEntryDTO is one row of the metrics-report top metrics list.

type MetricsProvider

type MetricsProvider interface {
	CollectMetrics(ctx context.Context) *collector.MetricsData
}

MetricsProvider is the slice of DataCollector the metrics.summary handler needs.

type MetricsReportProvider

type MetricsReportProvider interface {
	CollectMetricsReport(ctx context.Context) *collector.MetricsReport
}

MetricsReportProvider is the slice of DataCollector metrics_report.go reads.

type MetricsReportResponse

type MetricsReportResponse struct {
	TotalMetrics  int              `json:"totalMetrics"`
	MetricsByType map[string]int   `json:"metricsByType"`
	Collectors    []CollectorEntry `json:"collectors"`
	TopMetrics    []MetricEntryDTO `json:"topMetrics"`
}

MetricsReportResponse is the wire shape for the metrics-report query.

type MetricsSummary

type MetricsSummary struct {
	TotalMetrics int   `json:"totalMetrics"`
	Counters     int   `json:"counters"`
	Gauges       int   `json:"gauges"`
	Histograms   int   `json:"histograms"`
	TS           int64 `json:"ts"` // unix seconds
}

MetricsSummary is the per-event payload for the metrics.summary subscription.

type OverviewProvider

type OverviewProvider interface {
	CollectOverview(ctx context.Context) *collector.OverviewData
}

OverviewProvider is the slice of DataCollector overview.go reads. Splitting the surface keeps tests fixture-friendly without dragging in the full DataCollector wiring.

type OverviewResponse

type OverviewResponse struct {
	OverallHealth   string         `json:"overallHealth"`
	TotalServices   int            `json:"totalServices"`
	HealthyServices int            `json:"healthyServices"`
	TotalMetrics    int            `json:"totalMetrics"`
	UptimeSeconds   int64          `json:"uptimeSeconds"`
	Version         string         `json:"version"`
	Environment     string         `json:"environment"`
	Summary         map[string]any `json:"summary,omitempty"`
}

OverviewResponse is the wire shape for the overview query.

type ServiceDetailInput

type ServiceDetailInput struct {
	Name string `json:"name"`
}

ServiceDetailInput is the input payload for services.detail.

type ServiceDetailResponse

type ServiceDetailResponse = collector.ServiceDetail

ServiceDetailResponse is the response payload for services.detail. (collector.ServiceDetail is reused as-is.)

type ServicesList

type ServicesList struct {
	Services []collector.ServiceInfo `json:"services"`
}

ServicesList is the response payload for the services.list query.

type ServicesProvider

type ServicesProvider interface {
	CollectServices(ctx context.Context) []collector.ServiceInfo
	CollectServiceDetail(ctx context.Context, name string) *collector.ServiceDetail
}

ServicesProvider is the slice of the collector's API the pilot calls. Splitting it out lets tests stub the collector without the full DataCollector.

type TraceDetailInput

type TraceDetailInput struct {
	ID string `json:"id"`
}

TraceDetailInput is the input for traces.detail.

type TraceDetailResponse

type TraceDetailResponse = collector.TraceDetail

TraceDetailResponse is the wire shape for traces.detail. We reuse the collector's TraceDetail because its JSON tags are stable.

type TraceSummaryDTO

type TraceSummaryDTO struct {
	TraceID      string `json:"traceID"`
	RootSpanName string `json:"rootSpanName"`
	SpanCount    int    `json:"spanCount"`
	DurationMs   int64  `json:"durationMs"`
	Status       string `json:"status"`
	StartTime    string `json:"startTime"`
	Protocol     string `json:"protocol"`
}

TraceSummaryDTO is one row of traces.list.

type TracesList

type TracesList struct {
	Traces []TraceSummaryDTO `json:"traces"`
	Total  int               `json:"total"`
}

TracesList is the response for traces.list.

type TracesProvider

type TracesProvider interface {
	ListTraces(filter collector.TraceFilter) ([]collector.TraceSummary, collector.TraceStats)
	GetTrace(traceID string) *collector.TraceDetail
}

TracesProvider is the slice of TraceStore traces.go reads.

Jump to

Keyboard shortcuts

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