console

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2026 License: Apache-2.0 Imports: 33 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMux

func NewMux(opts ServerOptions) (http.Handler, error)

NewMux constructs the console HTTP mux with the supplied dependencies.

func StartServer

func StartServer(ctx context.Context, addr string, opts ServerOptions) error

StartServer launches the HTTP console on the provided address. When store is nil, the server falls back to mock responses so the UI still functions.

Types

type AuthConfig

type AuthConfig struct {
	Username string
	Password string
}

type BrokerRuntime

type BrokerRuntime struct {
	CPUPercent float64
	MemBytes   int64
}

type LFSConfig

type LFSConfig struct {
	Enabled      bool
	TrackerTopic string
	KafkaBrokers []string
	S3Bucket     string
	S3Region     string
	S3Endpoint   string
	S3AccessKey  string
	S3SecretKey  string
	PresignTTL   int // seconds
}

LFSConfig holds configuration for LFS console features

type LFSConsumer

type LFSConsumer struct {
	// contains filtered or unexported fields
}

LFSConsumer consumes events from the __lfs_ops_state topic

func NewLFSConsumer

func NewLFSConsumer(ctx context.Context, cfg LFSConsumerConfig, handlers *LFSHandlers, logger *log.Logger) (*LFSConsumer, error)

NewLFSConsumer creates a new LFS tracker events consumer

func (*LFSConsumer) Close

func (c *LFSConsumer) Close() error

Close stops the consumer and releases resources

func (*LFSConsumer) Start

func (c *LFSConsumer) Start()

Start begins consuming events

func (*LFSConsumer) Status

func (c *LFSConsumer) Status() LFSConsumerStatus

Status returns the current consumer status.

type LFSConsumerConfig

type LFSConsumerConfig struct {
	Brokers []string
	Topic   string
	GroupID string
}

LFSConsumerConfig holds configuration for the LFS consumer

type LFSConsumerStatus

type LFSConsumerStatus struct {
	Connected   bool   `json:"connected"`
	LastError   string `json:"last_error,omitempty"`
	LastErrorAt string `json:"last_error_at,omitempty"`
	LastPollAt  string `json:"last_poll_at,omitempty"`
}

LFSConsumerStatus represents the tracker consumer health.

type LFSEvent

type LFSEvent struct {
	EventType  string `json:"event_type"`
	EventID    string `json:"event_id"`
	Timestamp  string `json:"timestamp"`
	ProxyID    string `json:"proxy_id"`
	RequestID  string `json:"request_id"`
	Topic      string `json:"topic,omitempty"`
	S3Key      string `json:"s3_key,omitempty"`
	Size       int64  `json:"size,omitempty"`
	DurationMs int64  `json:"duration_ms,omitempty"`
	ErrorCode  string `json:"error_code,omitempty"`
	Mode       string `json:"mode,omitempty"`
}

LFSEvent represents a tracker event

type LFSHandlers

type LFSHandlers struct {
	// contains filtered or unexported fields
}

LFSHandlers provides HTTP handlers for LFS admin APIs

func NewLFSHandlers

func NewLFSHandlers(cfg LFSConfig, logger *log.Logger) *LFSHandlers

NewLFSHandlers creates a new LFS handlers instance

func (*LFSHandlers) HandleEvents

func (h *LFSHandlers) HandleEvents(w http.ResponseWriter, r *http.Request)

HandleEvents handles GET /ui/api/lfs/events (SSE)

func (*LFSHandlers) HandleObjects

func (h *LFSHandlers) HandleObjects(w http.ResponseWriter, r *http.Request)

HandleObjects handles GET /ui/api/lfs/objects

func (*LFSHandlers) HandleOrphans

func (h *LFSHandlers) HandleOrphans(w http.ResponseWriter, r *http.Request)

HandleOrphans handles GET /ui/api/lfs/orphans

func (*LFSHandlers) HandleS3Browse

func (h *LFSHandlers) HandleS3Browse(w http.ResponseWriter, r *http.Request)

HandleS3Browse handles GET /ui/api/lfs/s3/browse

func (*LFSHandlers) HandleS3Presign

func (h *LFSHandlers) HandleS3Presign(w http.ResponseWriter, r *http.Request)

HandleS3Presign handles POST /ui/api/lfs/s3/presign

func (*LFSHandlers) HandleStatus

func (h *LFSHandlers) HandleStatus(w http.ResponseWriter, r *http.Request)

HandleStatus handles GET /ui/api/lfs/status. A nil handler reports LFS disabled.

func (*LFSHandlers) HandleTopicDetail

func (h *LFSHandlers) HandleTopicDetail(w http.ResponseWriter, r *http.Request)

HandleTopicDetail handles GET /ui/api/lfs/topics/{name}

func (*LFSHandlers) HandleTopics

func (h *LFSHandlers) HandleTopics(w http.ResponseWriter, r *http.Request)

HandleTopics handles GET /ui/api/lfs/topics

func (*LFSHandlers) ProcessEvent

func (h *LFSHandlers) ProcessEvent(event LFSEvent)

ProcessEvent handles an incoming tracker event

func (*LFSHandlers) ResetStats

func (h *LFSHandlers) ResetStats()

ResetStats resets the 24h rolling statistics (call periodically)

func (*LFSHandlers) SetConsumer

func (h *LFSHandlers) SetConsumer(consumer *LFSConsumer)

SetConsumer sets the LFS tracker consumer

func (*LFSHandlers) SetS3Client

func (h *LFSHandlers) SetS3Client(client *LFSS3Client)

SetS3Client sets the S3 client for browsing

type LFSObject

type LFSObject struct {
	S3Key       string `json:"s3_key"`
	Topic       string `json:"topic"`
	Partition   int32  `json:"partition"`
	KafkaOffset int64  `json:"kafka_offset,omitempty"`
	Size        int64  `json:"size"`
	SHA256      string `json:"sha256"`
	ContentType string `json:"content_type,omitempty"`
	CreatedAt   string `json:"created_at"`
	ProxyID     string `json:"proxy_id,omitempty"`
}

LFSObject represents an LFS object in the browser

type LFSObjectsResponse

type LFSObjectsResponse struct {
	Objects    []LFSObject `json:"objects"`
	NextCursor string      `json:"next_cursor,omitempty"`
	TotalCount int64       `json:"total_count"`
}

LFSObjectsResponse represents the response for /ui/api/lfs/objects

type LFSOrphan

type LFSOrphan struct {
	S3Key      string `json:"s3_key"`
	S3Bucket   string `json:"s3_bucket"`
	Topic      string `json:"topic"`
	Size       int64  `json:"size"`
	DetectedAt string `json:"detected_at"`
	Reason     string `json:"reason"`
	AgeHours   int    `json:"age_hours"`
}

LFSOrphan represents an orphaned S3 object

type LFSOrphansResponse

type LFSOrphansResponse struct {
	Orphans   []LFSOrphan `json:"orphans"`
	TotalSize int64       `json:"total_size"`
	Count     int         `json:"count"`
}

LFSOrphansResponse represents the response for /ui/api/lfs/orphans

type LFSS3Client

type LFSS3Client struct {
	// contains filtered or unexported fields
}

LFSS3Client provides S3 operations for the LFS admin console

func NewLFSS3Client

func NewLFSS3Client(ctx context.Context, cfg LFSS3Config, logger *log.Logger) (*LFSS3Client, error)

NewLFSS3Client creates a new S3 client for LFS admin operations

func (*LFSS3Client) HeadObject

func (c *LFSS3Client) HeadObject(ctx context.Context, key string) (*S3Object, error)

HeadObject checks if an object exists and returns its metadata

func (*LFSS3Client) ListObjects

func (c *LFSS3Client) ListObjects(ctx context.Context, prefix, delimiter string, maxKeys int) ([]S3Object, []string, bool, error)

ListObjects lists objects in S3 with the given prefix

func (*LFSS3Client) PresignGetObject

func (c *LFSS3Client) PresignGetObject(ctx context.Context, key string, ttl time.Duration) (string, error)

PresignGetObject generates a presigned URL for downloading an object

type LFSS3Config

type LFSS3Config struct {
	Bucket         string
	Region         string
	Endpoint       string
	AccessKey      string
	SecretKey      string
	ForcePathStyle bool
}

LFSS3Config holds configuration for the S3 client

type LFSStats

type LFSStats struct {
	TotalObjects   int64   `json:"total_objects"`
	TotalBytes     int64   `json:"total_bytes"`
	Uploads24h     int64   `json:"uploads_24h"`
	Downloads24h   int64   `json:"downloads_24h"`
	Errors24h      int64   `json:"errors_24h"`
	OrphansPending int64   `json:"orphans_pending"`
	AvgUploadMs    float64 `json:"avg_upload_ms"`
	AvgDownloadMs  float64 `json:"avg_download_ms"`
}

LFSStats represents aggregate LFS statistics

type LFSStatusResponse

type LFSStatusResponse struct {
	Enabled        bool              `json:"enabled"`
	ProxyCount     int               `json:"proxy_count"`
	S3Bucket       string            `json:"s3_bucket"`
	TopicsWithLFS  []string          `json:"topics_with_lfs"`
	Stats          LFSStats          `json:"stats"`
	TrackerTopic   string            `json:"tracker_topic"`
	TrackerEnabled bool              `json:"tracker_enabled"`
	ConsumerStatus LFSConsumerStatus `json:"consumer_status"`
}

LFSStatusResponse represents the response for /ui/api/lfs/status

type LFSTopicDetailResponse

type LFSTopicDetailResponse struct {
	Topic  LFSTopicStats `json:"topic"`
	Events []LFSEvent    `json:"events,omitempty"`
}

LFSTopicDetailResponse represents a single topic detail response

type LFSTopicStats

type LFSTopicStats struct {
	Name          string `json:"name"`
	HasLFS        bool   `json:"has_lfs"`
	ObjectCount   int64  `json:"object_count"`
	TotalBytes    int64  `json:"total_bytes"`
	AvgObjectSize int64  `json:"avg_object_size"`
	Uploads24h    int64  `json:"uploads_24h"`
	Downloads24h  int64  `json:"downloads_24h"`
	Errors24h     int64  `json:"errors_24h"`
	Orphans       int64  `json:"orphans_detected"`
	FirstObject   string `json:"first_object,omitempty"`
	LastObject    string `json:"last_object,omitempty"`
	LastUpload    string `json:"last_upload,omitempty"`
	LastDownload  string `json:"last_download,omitempty"`
	LastError     string `json:"last_error,omitempty"`
	LastEvent     string `json:"last_event,omitempty"`
}

LFSTopicStats represents per-topic LFS statistics

type LFSTopicsResponse

type LFSTopicsResponse struct {
	Topics []LFSTopicStats `json:"topics"`
}

LFSTopicsResponse represents the response for /ui/api/lfs/topics

type MetricsProvider

type MetricsProvider interface {
	Snapshot(ctx context.Context) (*MetricsSnapshot, error)
}

func NewAggregatedPromMetricsClient

func NewAggregatedPromMetricsClient(store metadata.Store, metricsURL string) MetricsProvider

func NewCompositeMetricsProvider

func NewCompositeMetricsProvider(broker MetricsProvider, operatorURL string) MetricsProvider

func NewDiscoveredCompositeMetricsProvider

func NewDiscoveredCompositeMetricsProvider(broker MetricsProvider, metricsURL string) MetricsProvider

NewDiscoveredCompositeMetricsProvider scrapes each address of a headless operator metrics Service. Direct endpoint overrides use NewCompositeMetricsProvider.

func NewPromMetricsClient

func NewPromMetricsClient(url string) MetricsProvider

type MetricsSnapshot

type MetricsSnapshot struct {
	S3State                            string
	S3LatencyMS                        int
	S3ErrorRate                        float64
	ProduceRPS                         float64
	FetchRPS                           float64
	AdminRequestsTotal                 float64
	AdminRequestErrorsTotal            float64
	AdminRequestLatencyMS              float64
	BrokerCPUPercent                   float64
	BrokerMemBytes                     int64
	BrokerRuntime                      map[string]BrokerRuntime
	OperatorClusters                   float64
	OperatorEtcdSnapshotAgeSeconds     float64
	OperatorEtcdSnapshotLastSuccessTS  float64
	OperatorEtcdSnapshotLastScheduleTS float64
	OperatorEtcdSnapshotStale          float64
	OperatorEtcdSnapshotAccessOK       float64
	OperatorEtcdSnapshotAccessReported bool
	OperatorMetricsAvailable           bool
	BrokerMetricsAvailable             bool
	// contains filtered or unexported fields
}

type S3BrowseResponse

type S3BrowseResponse struct {
	Objects        []S3Object `json:"objects"`
	CommonPrefixes []string   `json:"common_prefixes"`
	IsTruncated    bool       `json:"is_truncated"`
}

S3BrowseResponse represents the response for /ui/api/lfs/s3/browse

type S3Object

type S3Object struct {
	Key          string `json:"key"`
	Size         int64  `json:"size"`
	LastModified string `json:"last_modified"`
	ETag         string `json:"etag,omitempty"`
}

S3Object represents an object in S3 browser

type S3PresignRequest

type S3PresignRequest struct {
	S3Key      string `json:"s3_key"`
	TTLSeconds int    `json:"ttl_seconds,omitempty"`
}

S3PresignRequest represents the request for /ui/api/lfs/s3/presign

type S3PresignResponse

type S3PresignResponse struct {
	URL       string `json:"url"`
	ExpiresAt string `json:"expires_at"`
}

S3PresignResponse represents the response for /ui/api/lfs/s3/presign

type ServerOptions

type ServerOptions struct {
	Store       metadata.Store
	Metrics     MetricsProvider
	Logger      *log.Logger
	Auth        AuthConfig
	LFSHandlers *LFSHandlers
	S3Namespace string
}

Jump to

Keyboard shortcuts

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