report

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientInfo

type ClientInfo struct {
	Name       string            `json:"name"`
	Type       string            `json:"type"`
	Image      string            `json:"image"`
	Entrypoint []string          `json:"entrypoint"`
	Cmd        []string          `json:"cmd"`
	Version    string            `json:"version"`
	EnvVars    map[string]string `json:"env_vars,omitempty"`
}

type Index

type Index struct {
	Generated int64        `json:"generated"`
	Entries   []IndexEntry `json:"entries"`
}

Index represents the complete index structure

type IndexClientInfo

type IndexClientInfo struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Image   string `json:"image"`
	Version string `json:"version"`
}

IndexClientInfo represents client information in the index

type IndexEntry

type IndexEntry struct {
	RunID               string            `json:"run_id"`
	Timestamp           int64             `json:"timestamp"`
	Network             string            `json:"network"`
	Labels              map[string]string `json:"labels,omitempty"`
	ExecutionClientInfo IndexClientInfo   `json:"execution_client_info"`
	ConsensusClientInfo IndexClientInfo   `json:"consensus_client_info"`
	SyncInfo            IndexSyncInfo     `json:"sync_info"`
	MainFile            string            `json:"main_file"`
	ProgressFile        string            `json:"progress_file"`
}

IndexEntry represents a single entry in the index

type IndexService

type IndexService interface {
	GenerateIndex(ctx context.Context, reportDir string) (*Index, error)
	SaveIndex(ctx context.Context, index *Index, outputPath string) error
}

IndexService defines the interface for index operations

func NewIndexService

func NewIndexService(log logrus.FieldLogger) IndexService

NewIndexService creates a new index service

type IndexSyncInfo

type IndexSyncInfo struct {
	Start         int64              `json:"start"`
	End           int64              `json:"end"`
	Duration      int64              `json:"duration"`
	Status        string             `json:"status,omitempty"`
	StatusMessage string             `json:"status_message,omitempty"`
	Block         uint64             `json:"block"`
	Slot          uint64             `json:"slot"`
	EntriesCount  int                `json:"entries_count"`
	LastEntry     *SyncProgressEntry `json:"last_entry,omitempty"`
}

IndexSyncInfo represents sync information in the index

type Result

type Result struct {
	RunID               string              `json:"run_id"`
	Timestamp           int64               `json:"timestamp"`
	Network             string              `json:"network"`
	Labels              map[string]string   `json:"labels,omitempty"`
	SyncStatus          SyncStatus          `json:"sync_status"`
	ExecutionClientInfo ClientInfo          `json:"execution_client_info"`
	ConsensusClientInfo ClientInfo          `json:"consensus_client_info"`
	SystemInfo          *sysinfo.SystemInfo `json:"system_info,omitempty"`
}

type Service

type Service interface {
	Start(ctx context.Context) error
	AddSyncProgressEntry(ctx context.Context, entry SyncProgressEntry) error
	SetConsensusClientInfo(ctx context.Context, info *ClientInfo) error
	SetExecutionClientInfo(ctx context.Context, info *ClientInfo) error
	SetBlockNumber(ctx context.Context, blockNumber uint64) error
	SetSlotNumber(ctx context.Context, slotNumber uint64) error
	SetSyncStatus(ctx context.Context, status string, message string) error
	SetLabels(ctx context.Context, labels map[string]string) error
	SetNetwork(ctx context.Context, network string) error
	SetSystemInfo(ctx context.Context, info *sysinfo.SystemInfo) error
	SaveReportToFiles(ctx context.Context, baseFilename string, reportDir string) error
	Stop(ctx context.Context) error

	// Temporary report methods for recovery
	SaveTempReport(ctx context.Context, report *Result) error
	LoadTempReport(ctx context.Context, network, elClient, clClient string) (*Result, error)
	RemoveTempReport(ctx context.Context, network, elClient, clClient string) error
	ListTempReports(ctx context.Context) ([]string, error)

	// Get current report state
	GetCurrentReport(ctx context.Context) (*Result, error)

	// Restore report state from recovered data
	RestoreReportState(ctx context.Context, restoredReport *Result) error
}

Service defines the interface for report generation

func NewService

func NewService(log logrus.FieldLogger) Service

NewService creates a new report service

type SyncProgressEntry

type SyncProgressEntry struct {
	T     int64  `json:"t"` // Timestamp
	Block uint64 `json:"b"` // Execution client block number
	Slot  uint64 `json:"s"` // Consensus client slot number

	PeersExecutionClient uint64 `json:"pe"` // Execution client peers
	PeersConsensusClient uint64 `json:"pc"` // Consensus client peers

	// Docker metrics for execution client
	DiskUsageExecutionClient       uint64  `json:"de"`  // Execution client disk usage (bytes)
	MemoryUsageExecutionClient     uint64  `json:"me"`  // Execution client memory usage (bytes)
	BlockIOReadExecutionClient     uint64  `json:"bre"` // Execution client block IO read (bytes)
	BlockIOWriteExecutionClient    uint64  `json:"bwe"` // Execution client block IO write (bytes)
	CPUUsagePercentExecutionClient float64 `json:"ce"`  // Execution client CPU usage (percent)

	// Docker metrics for consensus client
	DiskUsageConsensusClient       uint64  `json:"dc"`  // Consensus client disk usage (bytes)
	MemoryUsageConsensusClient     uint64  `json:"mc"`  // Consensus client memory usage (bytes)
	BlockIOReadConsensusClient     uint64  `json:"brc"` // Consensus client block IO read (bytes)
	BlockIOWriteConsensusClient    uint64  `json:"bwc"` // Consensus client block IO write (bytes)
	CPUUsagePercentConsensusClient float64 `json:"cc"`  // Consensus client CPU usage (percent)
}

SyncProgressEntry represents the progress data at a specific timestamp

type SyncStatus

type SyncStatus struct {
	Start            int64                  `json:"start"`
	End              int64                  `json:"end"`
	Status           string                 `json:"status"`                   // "success", "timeout", "cancelled", "error"
	StatusMessage    string                 `json:"status_message,omitempty"` // Detailed message about the status
	Block            uint64                 `json:"block"`
	Slot             uint64                 `json:"slot"`
	SyncProgress     []SyncProgressEntry    `json:"sync_progress,omitempty"`
	SyncProgressFile string                 `json:"sync_progress_file,omitempty"`
	LastEntry        *SyncProgressEntry     `json:"last_entry,omitempty"`
	EntriesCount     int                    `json:"entries_count"`
	ErrorDetails     map[string]interface{} `json:"error_details,omitempty"`
}

Jump to

Keyboard shortcuts

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