Documentation
¶
Overview ¶
Package management provides deterministic, opt-in production management probes and HTTP endpoints without a global registry.
Index ¶
- Constants
- type Access
- type ApplicationModule
- type Check
- type Component
- type ConfigurationProperty
- type ConfigurationReport
- type Endpoint
- type Group
- type HTTPMetrics
- type HTTPMetricsSnapshot
- type HTTPRouteMetric
- type Handler
- type HandlerOptions
- type Manager
- type ModuleDefinition
- type ModuleEdge
- type ModuleReport
- type NamedInterface
- type Probe
- type Report
- type Status
- type StatusCount
Constants ¶
const MaxHTTPMetricRoutes = 4096
MaxHTTPMetricRoutes is the hard cardinality bound for one collector.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationModule ¶
type ApplicationModule struct {
ID string `json:"id"`
RootPackage string `json:"root_package"`
Packages []string `json:"packages"`
DefaultAPI string `json:"default_api"`
NamedInterfaces []NamedInterface `json:"named_interfaces"`
AllowedDependencies []string `json:"allowed_dependencies"`
ObservedDependencies []string `json:"observed_dependencies"`
}
ApplicationModule is one deterministic client-facing module canvas.
type Check ¶
Check declares one named probe in one or more management groups. Module is optional ownership metadata and is safe to expose.
type Component ¶
type Component struct {
Name string `json:"name"`
Module string `json:"module,omitempty"`
Status Status `json:"status"`
}
Component is one safe client-facing check result. Probe errors are intentionally excluded.
type ConfigurationProperty ¶
type ConfigurationProperty struct {
Key string `json:"key"`
Kind config.Kind `json:"kind"`
Module string `json:"module,omitempty"`
Value string `json:"value,omitempty"`
Source string `json:"source,omitempty"`
Resolved bool `json:"resolved"`
Default bool `json:"default,omitempty"`
Secret bool `json:"secret,omitempty"`
}
ConfigurationProperty is one safe resolved configuration entry. Secret values are always redacted.
type ConfigurationReport ¶
type ConfigurationReport struct {
Properties []ConfigurationProperty `json:"properties"`
}
ConfigurationReport is a deterministic generated configuration view.
func NewConfigurationReport ¶
func NewConfigurationReport( schema config.Schema, snapshot config.Snapshot, ) (ConfigurationReport, error)
NewConfigurationReport combines one generated schema and its resolved snapshot without exposing raw secret values.
type Endpoint ¶
type Endpoint string
Endpoint identifies one explicitly exposed management HTTP endpoint.
const ( // EndpointHealth exposes the aggregate health report. EndpointHealth Endpoint = "health" // EndpointLiveness exposes the process liveness report. EndpointLiveness Endpoint = "liveness" // EndpointReadiness exposes the traffic readiness report. EndpointReadiness Endpoint = "readiness" // EndpointInfo exposes caller-owned static application metadata. EndpointInfo Endpoint = "info" // EndpointMetrics exposes generated-route HTTP metrics. EndpointMetrics Endpoint = "metrics" // EndpointConfigProps exposes redacted generated configuration metadata. EndpointConfigProps Endpoint = "configprops" // EndpointModules exposes the generated application-module canvas. EndpointModules Endpoint = "modules" // EndpointLoggers exposes instance-owned logging levels and loopback-only // runtime updates. EndpointLoggers Endpoint = "loggers" )
type Group ¶
type Group string
Group identifies one independently queryable health concern.
const ( // GroupHealth contains broad application health checks. GroupHealth Group = "health" // GroupLiveness contains checks that decide whether a process is alive. GroupLiveness Group = "liveness" // GroupReadiness contains checks that decide whether traffic is safe. GroupReadiness Group = "readiness" )
type HTTPMetrics ¶
type HTTPMetrics struct {
// contains filtered or unexported fields
}
HTTPMetrics is an instance-owned, concurrency-safe generated-route metrics collector. Its labels come only from compiler-generated route metadata.
func NewHTTPMetrics ¶
func NewHTTPMetrics() *HTTPMetrics
NewHTTPMetrics creates an empty generated-route metrics collector.
func (*HTTPMetrics) BeginHTTP ¶
func (metrics *HTTPMetrics) BeginHTTP( ctx context.Context, route web.RouteMetadata, ) (context.Context, func(web.HTTPResult))
BeginHTTP implements web.HTTPObserver.
func (*HTTPMetrics) Snapshot ¶
func (metrics *HTTPMetrics) Snapshot() HTTPMetricsSnapshot
Snapshot returns route and response status metrics in stable order.
type HTTPMetricsSnapshot ¶
type HTTPMetricsSnapshot struct {
Routes []HTTPRouteMetric `json:"routes"`
DroppedObservations uint64 `json:"dropped_observations"`
}
HTTPMetricsSnapshot is a deterministic immutable metrics view.
type HTTPRouteMetric ¶
type HTTPRouteMetric struct {
Route web.RouteMetadata `json:"route"`
Requests uint64 `json:"requests"`
InFlight int64 `json:"in_flight"`
Responses []StatusCount `json:"responses"`
Bytes uint64 `json:"bytes"`
TotalDurationNanos int64 `json:"total_duration_nanos"`
MaxDurationNanos int64 `json:"max_duration_nanos"`
Panics uint64 `json:"panics"`
}
HTTPRouteMetric is one immutable route metrics snapshot.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves one isolated set of management endpoints.
func NewHandler ¶
func NewHandler(options HandlerOptions) (*Handler, error)
NewHandler constructs exactly the explicitly exposed management endpoints.
func (*Handler) Pattern ¶
Pattern returns the GET-only ServeMux subtree pattern used to mount this handler. Restricting the method prevents a management subtree from conflicting with an application's ordinary GET root route.
type HandlerOptions ¶
type HandlerOptions struct {
BasePath string
Manager *Manager
Info map[string]string
Metrics *HTTPMetrics
Configuration *ConfigurationReport
Modules *ModuleReport
Logging *spicelogging.Controller
Expose []Endpoint
Access Access
}
HandlerOptions configures one isolated management HTTP handler.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an immutable collection of validated health checks.
type ModuleDefinition ¶
type ModuleDefinition struct {
ID string
RootPackage string
Packages []string
NamedInterfaces []NamedInterface
AllowedDependencies []string
}
ModuleDefinition is generated input for one validated application module.
type ModuleEdge ¶
type ModuleEdge struct {
FromModule string `json:"from_module"`
ToModule string `json:"to_module"`
API string `json:"api"`
FromPackage string `json:"from_package"`
ToPackage string `json:"to_package"`
}
ModuleEdge is one observed cross-module Go import.
type ModuleReport ¶
type ModuleReport struct {
Schema string `json:"schema"`
Modules []ApplicationModule `json:"modules"`
Edges []ModuleEdge `json:"edges"`
UnassignedPackages []string `json:"unassigned_packages"`
}
ModuleReport is the portable runtime application-module canvas.
func NewModuleReport ¶
func NewModuleReport( definitions []ModuleDefinition, edges []ModuleEdge, unassignedPackages []string, ) (ModuleReport, error)
NewModuleReport validates and copies generated module metadata. The returned report uses the same schema and ordering as the Spice module JSON canvas.
type NamedInterface ¶
NamedInterface identifies one explicitly exported descendant package.
type Report ¶
type Report struct {
Group Group `json:"group"`
Status Status `json:"status"`
Components []Component `json:"components"`
}
Report is a deterministic group result.
type StatusCount ¶
StatusCount is one deterministic HTTP response-status count.