adminhandler

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 16 Imported by: 0

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

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

func NewAdminAPI(opts Options) *AdminAPI

NewAdminAPI creates a new admin API handler.

func (*AdminAPI) GetEfficiency

func (a *AdminAPI) GetEfficiency(ctx context.Context) (*adminapi.EfficiencyStats, error)

GetEfficiency implements getEfficiency operation.

func (*AdminAPI) GetHealth

func (a *AdminAPI) GetHealth(ctx context.Context) (*adminapi.HealthReport, error)

GetHealth implements getHealth operation.

func (*AdminAPI) GetInfo

func (a *AdminAPI) GetInfo(_ context.Context) (*adminapi.InstanceInfo, error)

GetInfo implements getInfo operation.

func (*AdminAPI) GetRuntime

func (a *AdminAPI) GetRuntime(_ context.Context) (*adminapi.RuntimeStats, error)

GetRuntime implements getRuntime operation.

func (*AdminAPI) GetStorage

func (a *AdminAPI) GetStorage(ctx context.Context) (*adminapi.StorageStats, error)

GetStorage implements getStorage operation.

func (*AdminAPI) NewError

func (a *AdminAPI) NewError(_ context.Context, err error) *adminapi.ErrorStatusCode

NewError creates *ErrorStatusCode from error returned by handler.

func (*AdminAPI) RunAction

RunAction implements runAction operation.

type BuildInfo

type BuildInfo struct {
	Version   string
	Commit    string
	GoVersion string
}

BuildInfo is static build information about the running binary.

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.

Jump to

Keyboard shortcuts

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