console

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: Apache-2.0 Imports: 24 Imported by: 0

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 added in v1.6.0

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 added in v1.6.0

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

LFSConsumer consumes events from the __lfs_ops_state topic

func NewLFSConsumer added in v1.6.0

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 added in v1.6.0

func (c *LFSConsumer) Close() error

Close stops the consumer and releases resources

func (*LFSConsumer) Start added in v1.6.0

func (c *LFSConsumer) Start()

Start begins consuming events

func (*LFSConsumer) Status added in v1.6.0

func (c *LFSConsumer) Status() LFSConsumerStatus

Status returns the current consumer status.

type LFSConsumerConfig added in v1.6.0

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

LFSConsumerConfig holds configuration for the LFS consumer

type LFSConsumerStatus added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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

LFSHandlers provides HTTP handlers for LFS admin APIs

func NewLFSHandlers added in v1.6.0

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

NewLFSHandlers creates a new LFS handlers instance

func (*LFSHandlers) HandleEvents added in v1.6.0

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

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

func (*LFSHandlers) HandleObjects added in v1.6.0

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

HandleObjects handles GET /ui/api/lfs/objects

func (*LFSHandlers) HandleOrphans added in v1.6.0

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

HandleOrphans handles GET /ui/api/lfs/orphans

func (*LFSHandlers) HandleS3Browse added in v1.6.0

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

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

func (*LFSHandlers) HandleS3Presign added in v1.6.0

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

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

func (*LFSHandlers) HandleStatus added in v1.6.0

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

HandleStatus handles GET /ui/api/lfs/status

func (*LFSHandlers) HandleTopicDetail added in v1.6.0

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

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

func (*LFSHandlers) HandleTopics added in v1.6.0

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

HandleTopics handles GET /ui/api/lfs/topics

func (*LFSHandlers) ProcessEvent added in v1.6.0

func (h *LFSHandlers) ProcessEvent(event LFSEvent)

ProcessEvent handles an incoming tracker event

func (*LFSHandlers) ResetStats added in v1.6.0

func (h *LFSHandlers) ResetStats()

ResetStats resets the 24h rolling statistics (call periodically)

func (*LFSHandlers) SetConsumer added in v1.6.0

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

SetConsumer sets the LFS tracker consumer

func (*LFSHandlers) SetS3Client added in v1.6.0

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

SetS3Client sets the S3 client for browsing

type LFSObject added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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

LFSS3Client provides S3 operations for the LFS admin console

func NewLFSS3Client added in v1.6.0

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 added in v1.6.0

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

HeadObject checks if an object exists and returns its metadata

func (*LFSS3Client) ListObjects added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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

LFSS3Config holds configuration for the S3 client

type LFSStats added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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

LFSTopicDetailResponse represents a single topic detail response

type LFSTopicStats added in v1.6.0

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 added in v1.6.0

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 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
	OperatorMetricsAvailable           bool
}

type S3BrowseResponse added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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 added in v1.6.0

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
}

Jump to

Keyboard shortcuts

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