Documentation
¶
Overview ¶
Package admin serves OpticTrace's control-plane HTTP surface, deliberately on a separate listener from proxied traffic so it can be firewalled independently:
GET /metrics Prometheus exposition
GET /healthz liveness
GET /api/logs filtered request log query
GET /api/logs/{id} single captured exchange
GET /api/stats aggregates for the dashboard (window/bucket)
GET /api/config current optic.yaml (raw + summary)
POST /api/config/validate lint a candidate optic.yaml (dashboard editor)
POST /api/reload re-read optic.yaml from disk, hot-swap engine
POST /api/ingest telemetry records from framework SDKs
POST /api/applogs/ingest application log lines, correlated by span id
GET /api/applogs log lines a request wrote (?trace= / ?span=)
GET / embedded developer dashboard
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
Logger *slog.Logger
Collector *metrics.Collector
Reader store.LogStore // queries (may be nil when driver=none)
// AppLogs governs application log lines; nil or disabled means the ingest
// endpoint refuses with a clear reason rather than silently accepting and
// discarding. AppLogStore is the optional store side — a driver without
// it is a valid driver, so this may be nil while Reader is not.
AppLogs *applog.Governor
AppLogStore store.AppLogStore
// Spans governs inner spans — the queries, cache lookups and outbound
// calls made while serving a request. SpanStore is the optional store
// side, so this may be nil while Reader is not.
Spans *spans.Governor
SpanStore store.SpanStore
Writer *store.AsyncWriter // ingest path
Dispatcher *export.Dispatcher // output plugins (may be nil)
ConfigPath string
Reload func() error // hot-reload hook installed by main
UIDir string // static dashboard directory (optional)
Version string
// AuthToken protects every endpoint when non-empty. HealthOpen keeps
// /healthz reachable for orchestrator probes.
AuthToken string
HealthOpen bool
// CORSOrigins lists browser origins allowed to call the API
// cross-origin. Empty means no CORS headers are sent at all.
CORSOrigins []string
// AnalysisMaxRows bounds how many records /api/scan and /api/spec read.
// 0 uses store.DefaultAnalysisMaxRows.
AnalysisMaxRows int
// Detectors are org-specific scan patterns from optic.yaml, added to the
// built-in set.
Detectors []scan.Detector
// contains filtered or unexported fields
}
Server wires the admin endpoints to their backing components. Any field may be nil; the corresponding endpoints then return 404/501.
Click to show internal directories.
Click to hide internal directories.