system

package
v0.0.14 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2026 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ActiveLegacyDatabaseSources added in v0.0.14

func ActiveLegacyDatabaseSources(configuredPath string, status masterhistorybackfill.Status) []string

func MarkHistorySourceDeleted added in v0.0.14

func MarkHistorySourceDeleted(ctx context.Context, core *gorm.DB, deletedAtUnix int64) error

func ReconcileHistorySourceDeletion added in v0.0.14

func ReconcileHistorySourceDeletion(ctx context.Context, path string, markDeleted func(context.Context) error) error

Types

type BYOKSystemBaseURLsResponse added in v0.0.2

type BYOKSystemBaseURLsResponse struct {
	URLs []string `json:"urls"`
}

BYOKSystemBaseURLsResponse lists code-pinned default BaseURL prefixes for BYOK. The admin Settings page renders these as "read-only system recommended" alongside the editable byok_base_url_allowlist setting (admin extra). Both are union-merged at validation time (see private_channel.validateBaseURLAllowlist).

type CleanupPreviewRequest

type CleanupPreviewRequest struct {
	Target     string `form:"target" binding:"required,oneof=traces logs hourly_buckets"`
	RetainDays int    `form:"retain_days" binding:"required,min=1"`
}

type CleanupPreviewResponse

type CleanupPreviewResponse struct {
	Target     string                `json:"target"`
	RetainDays int                   `json:"retain_days"`
	Total      int64                 `json:"total"`
	ToDelete   int64                 `json:"to_delete"`
	Tables     []CleanupTablePreview `json:"tables,omitempty"`
	CutoffUnix int64                 `json:"cutoff_unix"`
	CutoffDate string                `json:"cutoff_date"`
}

type CleanupRequest

type CleanupRequest struct {
	Target     string `json:"target" binding:"required,oneof=traces logs hourly_buckets"`
	RetainDays int    `json:"retain_days" binding:"required,min=1"`
	CutoffUnix int64  `json:"cutoff_unix" binding:"required,min=1"`
}

type CleanupResponse

type CleanupResponse struct {
	Deleted int64 `json:"deleted"`
}

type CleanupTablePreview added in v0.0.14

type CleanupTablePreview struct {
	Name     string `json:"name"`
	Total    int64  `json:"total"`
	ToDelete int64  `json:"to_delete"`
}

type ClearLogBacklogRequest added in v0.0.14

type ClearLogBacklogRequest struct {
	Confirm bool `form:"confirm"`
}

type ClearLogBacklogResponse added in v0.0.14

type ClearLogBacklogResponse struct {
	Pending int   `json:"pending"`
	Retry   int   `json:"retry"`
	Dropped int   `json:"dropped"`
	Bytes   int64 `json:"bytes"`
}

type CompleteHistoryBackfillRequest added in v0.0.14

type CompleteHistoryBackfillRequest struct {
	Confirm bool `json:"confirm"`
}

type CompleteHistoryBackfillResponse added in v0.0.14

type CompleteHistoryBackfillResponse struct {
	Completed bool `json:"completed"`
}

type DatabaseStatus added in v0.0.14

type DatabaseStatus struct {
	Status          string `json:"status"`
	Path            string `json:"path"`
	SchemaVersion   string `json:"schema_version"`
	LastError       string `json:"last_error"`
	SizeBytes       int64  `json:"size_bytes"`
	OpenConnections int    `json:"open_connections"`
}

type DeleteLegacyFileRequest added in v0.0.14

type DeleteLegacyFileRequest struct {
	Confirmation string `form:"confirmation"`
}

type DeleteLegacyFileResponse added in v0.0.14

type DeleteLegacyFileResponse struct {
	Deleted bool `json:"deleted"`
}

type GetSettingsRequest

type GetSettingsRequest struct{}

type Handler

type Handler struct {
	ConnectedCount                func() int
	RefreshProbeTimings           func(context.Context)
	CoreDatabasePath              string
	LogDatabasePath               string
	LegacyDatabasePath            string
	CoreDatabase                  func() *gorm.DB
	LogDatabase                   func() *gorm.DB
	LogDatabaseReady              func() bool
	LogDatabaseError              func() string
	LogQueueSnapshot              func() LogQueueStatus
	RetryLogQueue                 func()
	ClearLogQueueBacklog          func() (ClearLogBacklogResponse, error)
	LegacyArtifactSnapshot        func() (masterdatabase.LegacyArtifact, error)
	HistoryBackfillSnapshot       func() masterhistorybackfill.Status
	RetryHistoryBackfill          func()
	SkipHistoryBackfill           func(context.Context) error
	CompleteHistoryBackfill       func(context.Context) error
	DeleteLegacySource            func(string) error
	DeleteLegacyArtifact          func(string) error
	MarkHistorySourceDeleted      func(context.Context) error
	ReconcileHistorySourceDeleted func(context.Context, string) error
	// contains filtered or unexported fields
}

func (*Handler) BYOKSystemBaseURLs added in v0.0.2

func (h *Handler) BYOKSystemBaseURLs(_ *app.Context, _ api.EmptyRequest) (BYOKSystemBaseURLsResponse, error)

BYOKSystemBaseURLs returns the code-pinned system default BYOK base URLs. Pure read; no DB access. Mutating this list requires editing internal/consts/byok.go and re-deploying.

func (*Handler) Cleanup

func (h *Handler) Cleanup(c *app.Context, req CleanupRequest) (CleanupResponse, error)

func (*Handler) CleanupPreview

func (h *Handler) CleanupPreview(c *app.Context, req CleanupPreviewRequest) (CleanupPreviewResponse, error)

func (*Handler) ClearLogBacklog added in v0.0.14

func (h *Handler) ClearLogBacklog(c *app.Context, req ClearLogBacklogRequest) (ClearLogBacklogResponse, error)

func (*Handler) CompleteHistoryBackfillNow added in v0.0.14

func (h *Handler) CompleteHistoryBackfillNow(c *app.Context, req CompleteHistoryBackfillRequest) (CompleteHistoryBackfillResponse, error)

func (*Handler) DeleteHistoryBackfillLegacyArtifact added in v0.0.14

func (h *Handler) DeleteHistoryBackfillLegacyArtifact(c *app.Context, req DeleteLegacyFileRequest) (DeleteLegacyFileResponse, error)

func (*Handler) DeleteHistoryBackfillSource added in v0.0.14

func (h *Handler) DeleteHistoryBackfillSource(c *app.Context, req DeleteLegacyFileRequest) (DeleteLegacyFileResponse, error)

func (*Handler) GetSettings

func (h *Handler) GetSettings(c *app.Context, _ GetSettingsRequest) (SettingsResponse, error)

func (*Handler) PublicConfig added in v0.0.6

func (h *Handler) PublicConfig(c *app.Context, _ api.EmptyRequest) (PublicConfigResponse, error)

PublicConfig 暴露登录前/登录后前端都需要的平台开关。公开端点,无鉴权。

func (*Handler) RetryHistoryBackfillNow added in v0.0.14

func (*Handler) RetryLogQueueNow added in v0.0.14

func (h *Handler) RetryLogQueueNow(c *app.Context, _ RetryLogQueueRequest) (RetryLogQueueResponse, error)

func (*Handler) SkipHistoryBackfillRemaining added in v0.0.14

func (h *Handler) SkipHistoryBackfillRemaining(c *app.Context, req SkipHistoryBackfillRequest) (SkipHistoryBackfillResponse, error)

func (*Handler) Stats

func (h *Handler) Stats(c *app.Context, _ StatsRequest) (StatsResponse, error)

func (*Handler) UpdateSettings

func (h *Handler) UpdateSettings(c *app.Context, req UpdateSettingsRequest) (SettingsResponse, error)

type LogQueueStatus added in v0.0.14

type LogQueueStatus struct {
	Pending       int    `json:"pending"`
	Retry         int    `json:"retry"`
	Inflight      int    `json:"inflight"`
	Bytes         int64  `json:"bytes"`
	OldestSeconds int64  `json:"oldest_seconds"`
	Dropped       uint64 `json:"dropped"`
	LastError     string `json:"last_error"`
}

func LogQueueStatusFrom added in v0.0.14

func LogQueueStatusFrom(status masterlogqueue.DeliveryStatus) LogQueueStatus

type PublicConfigResponse added in v0.0.6

type PublicConfigResponse struct {
	RegistrationEnabled bool `json:"registration_enabled"`
	InviteEnabled       bool `json:"invite_enabled"`
	// InviteUserMaxCodes 是普通用户名下有效邀请码数量上限;0 表示禁止普通用户建码。
	// 前端据此(结合 isAdmin)决定是否展示邀请入口。
	InviteUserMaxCodes int `json:"invite_user_max_codes"`
}

PublicConfigResponse 是无需鉴权即可读取的平台公开配置/特性开关。 后续同类公开 flag 直接往这里加字段。

type RetryHistoryBackfillRequest added in v0.0.14

type RetryHistoryBackfillRequest struct{}

type RetryHistoryBackfillResponse added in v0.0.14

type RetryHistoryBackfillResponse struct {
	Woken bool `json:"woken"`
}

type RetryLogQueueRequest added in v0.0.14

type RetryLogQueueRequest struct{}

type RetryLogQueueResponse added in v0.0.14

type RetryLogQueueResponse struct {
	Woken bool `json:"woken"`
}

type SettingsResponse

type SettingsResponse struct {
	Settings map[string]string `json:"settings"`
}

type SkipHistoryBackfillRequest added in v0.0.14

type SkipHistoryBackfillRequest struct {
	Confirm bool `form:"confirm"`
}

type SkipHistoryBackfillResponse added in v0.0.14

type SkipHistoryBackfillResponse struct {
	Skipped bool `json:"skipped"`
}

type StatsRequest

type StatsRequest struct{}

type StatsResponse

type StatsResponse struct {
	Tables  []TableStats  `json:"tables"`
	System  SystemInfo    `json:"system"`
	Storage StorageStatus `json:"storage"`
}

type StorageStatus added in v0.0.14

type StorageStatus struct {
	CoreDB          DatabaseStatus                `json:"core_db"`
	LogDB           DatabaseStatus                `json:"log_db"`
	LegacyDB        DatabaseStatus                `json:"legacy_db"`
	LegacyArtifact  masterdatabase.LegacyArtifact `json:"legacy_artifact"`
	LogQueue        LogQueueStatus                `json:"log_delivery_queue"`
	HistoryBackfill masterhistorybackfill.Status  `json:"history_backfill"`
}

type SystemInfo

type SystemInfo struct {
	Version      string `json:"version"`
	GoVersion    string `json:"go_version"`
	StartTime    int64  `json:"start_time"`
	UptimeSec    int64  `json:"uptime_sec"`
	MemoryAlloc  uint64 `json:"memory_alloc"`
	MemorySys    uint64 `json:"memory_sys"`
	NumGC        uint32 `json:"num_gc"`
	NumGoroutine int    `json:"num_goroutine"`
	OnlineAgents int    `json:"online_agents"`
}

type TableStats

type TableStats struct {
	Name  string `json:"name"`
	Count int64  `json:"count"`
}

type UpdateSettingsRequest

type UpdateSettingsRequest struct {
	Settings map[string]string `json:"settings" binding:"required"`
}

Jump to

Keyboard shortcuts

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