Documentation
¶
Overview ¶
Package adminhandler implements the oteldb admin panel API (see internal/adminapi) and serves a minimal embedded web UI on top of it.
Index ¶
- func UIMiddleware() httpmiddleware.Middleware
- type AdminAPI
- func (a *AdminAPI) GetEfficiency(ctx context.Context) (*adminapi.EfficiencyStats, error)
- func (a *AdminAPI) GetHealth(ctx context.Context) (*adminapi.HealthReport, error)
- func (a *AdminAPI) GetInfo(_ context.Context) (*adminapi.InstanceInfo, error)
- func (a *AdminAPI) GetRuntime(_ context.Context) (*adminapi.RuntimeStats, error)
- func (a *AdminAPI) GetStorage(ctx context.Context) (*adminapi.StorageStats, error)
- func (a *AdminAPI) NewError(_ context.Context, err error) *adminapi.ErrorStatusCode
- func (a *AdminAPI) RunAction(ctx context.Context, params adminapi.RunActionParams) (*adminapi.ActionResult, error)
- type BuildInfo
- type CHStorageStats
- type Component
- type EngineStatsProvider
- type Options
- type StorageStatsCollector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func UIMiddleware ¶
func UIMiddleware() httpmiddleware.Middleware
UIMiddleware serves the embedded admin SPA for non-API requests, delegating everything under /api/ to the next handler (the ogen server). Unknown paths fall back to index.html so client-side routing works. When the SPA was not built, a placeholder page is served instead.
Types ¶
type AdminAPI ¶
type AdminAPI struct {
// contains filtered or unexported fields
}
AdminAPI implements adminapi.Handler.
func NewAdminAPI ¶
NewAdminAPI creates a new admin API handler.
func (*AdminAPI) GetEfficiency ¶
GetEfficiency implements getEfficiency operation.
func (*AdminAPI) GetRuntime ¶
GetRuntime implements getRuntime operation.
func (*AdminAPI) GetStorage ¶
GetStorage implements getStorage operation.
func (*AdminAPI) RunAction ¶
func (a *AdminAPI) RunAction(ctx context.Context, params adminapi.RunActionParams) (*adminapi.ActionResult, error)
RunAction implements runAction operation.
type CHStorageStats ¶
type CHStorageStats struct {
// contains filtered or unexported fields
}
CHStorageStats collects per-table statistics from ClickHouse system tables.
func NewCHStorageStats ¶
func NewCHStorageStats(client chstorage.ClickHouseClient) *CHStorageStats
NewCHStorageStats creates a ClickHouse-backed storage stats collector.
func (*CHStorageStats) CollectStorageStats ¶
func (c *CHStorageStats) CollectStorageStats(ctx context.Context) ([]adminapi.TableStats, error)
CollectStorageStats reads active-part aggregates from system.parts for every table in the current database.
type Component ¶
type Component struct {
// Name is the service key (e.g. "loki", "otelcol").
Name string
// Addr is the listen address, when the component is an HTTP server.
Addr string
// Check optionally probes liveness; a nil Check reports the component as healthy.
Check func(ctx context.Context) error
}
Component describes a wired oteldb service for the health report.
type EngineStatsProvider ¶
type EngineStatsProvider interface {
Inspect() storage.StoreStats
EfficiencyStats(ctx context.Context) ([]storage.TenantEfficiency, error)
}
EngineStatsProvider exposes embedded-storage engine statistics: the in-memory Inspect snapshot and the I/O-bound efficiency breakdown.
type Options ¶
type Options struct {
// Info is static build information about the running binary.
Info BuildInfo
// StartTime is the process start time, used to compute uptime.
StartTime time.Time
// Engine provides embedded oteldb/storage statistics. It is the primary storage view and is nil
// only when no signal is served from the embedded engine.
Engine EngineStatsProvider
// StorageBackend is the embedded engine backend ("memory", "file", "s3"), when Engine is set.
StorageBackend string
// Maintain triggers an on-demand embedded-storage maintenance cycle. Nil when unavailable.
Maintain func(ctx context.Context) error
// ClickHouseEnabled reports whether the deprecated ClickHouse storage is active.
ClickHouseEnabled bool
// Signals describes per-signal backend configuration.
Signals []adminapi.SignalInfo
// Components lists the wired services for the health report.
Components []Component
// CHStorage collects deprecated ClickHouse storage statistics. Nil when no signal is served from
// ClickHouse.
CHStorage StorageStatsCollector
}
Options configures the admin API handler.
type StorageStatsCollector ¶
type StorageStatsCollector interface {
CollectStorageStats(ctx context.Context) ([]adminapi.TableStats, error)
}
StorageStatsCollector collects per-table ClickHouse storage statistics.