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
- func Register(d *dispatcher.Dispatcher, contractReg contract.Registry, ...) error
- type AppInfo
- type AppsListResponse
- type AuditListInput
- type AuditListResponse
- type AuditProvider
- type AuditRecordDTO
- type CollectorEntry
- type Deps
- type ExtensionInfo
- type ExtensionsList
- type HealthEntry
- type HealthList
- type HealthProvider
- type MetricEntryDTO
- type MetricsProvider
- type MetricsReportProvider
- type MetricsReportResponse
- type MetricsSummary
- type NavGroup
- type NavItem
- type NavigationResponse
- type OverviewProvider
- type OverviewResponse
- type ServiceDetailInput
- type ServiceDetailResponse
- type ServicesList
- type ServicesProvider
- type TraceDetailInput
- type TraceDetailResponse
- type TraceSummaryDTO
- type TracesList
- type TracesProvider
Constants ¶
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 one entry in the app switcher consumes. It's a projection of contract.AppInfo joined with the owning contributor's name so the React shell 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>.
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 {
ExtensionsRegistry *contributor.ContributorRegistry
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 ExtensionsRegistry / Services / Metrics. Slice (h) adds Overview / Health / MetricsReport / Traces so the pilot covers every page CoreContributor serves today; 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"`
Icon string `json:"icon,omitempty"`
Layout string `json:"layout,omitempty"`
PageCount int `json:"pageCount"`
WidgetCount int `json:"widgetCount"`
}
ExtensionInfo is a flattened summary of one registered contributor manifest.
type ExtensionsList ¶
type ExtensionsList struct {
Extensions []ExtensionInfo `json:"extensions"`
}
ExtensionsList is the response payload for the extensions.list query.
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 NavGroup ¶
type NavGroup struct {
}
NavGroup bundles items contributed under the same Nav.Group, sorted by priority. Group order follows navGroupOrder below; unknown groups go last.
type NavItem ¶
type NavItem struct {
}
NavItem is one renderable sidebar entry projected from a graph route's NavConfig. The shell joins href with its own basePath via NavLink so we emit the route as-is (no /dashboard prefix bound at server time).
Contributor is the contract contributor that owns the route; the React shell uses it to filter the sidebar when an app switcher is in play.
type NavigationResponse ¶
type NavigationResponse struct {
}
NavigationResponse is the wire shape of the navigation query.
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.