report

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Pending    jobStatus = "pending"
	InProgress jobStatus = "build in progress"
	Success    jobStatus = "build successful"
	Failed     jobStatus = "build failed"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message struct {
	Type     MessageType
	Severity Severity
	Text     string
}

func (Message) MarshalJSON

func (m Message) MarshalJSON() ([]byte, error)

func (Message) String

func (m Message) String() string

type MessageType

type MessageType string
const (
	GlobalMessage     MessageType = "global"
	IngestorMessage   MessageType = "ingestor"
	PrecomputeMessage MessageType = "precompute"
	ComputeMessage    MessageType = "compute"
)

type PerformanceStats

type PerformanceStats struct {
	DataFetchingDuration time.Duration `json:"data_fetching_duration"`
	PrecomputeDuration   time.Duration `json:"precompute_duration"`
	ComputeDuration      time.Duration `json:"compute_duration"`
	BuildDuration        time.Duration `json:"build_duration"`
}

PerformanceStats contains durations of each step of the build pipeline.

func (PerformanceStats) Log

func (p PerformanceStats) Log()

Log print stats to terminal.

func (*PerformanceStats) MarshalJSON

func (p *PerformanceStats) MarshalJSON() ([]byte, error)

MarshalJSON overrides PerformanceStats JSON to pretty print the duration.

type Report

type Report struct {
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`

	Status jobStatus `json:"status"`
	Stats  Stats     `json:"stats"`

	Logs map[MessageType][]Message `json:"logs"`
	// contains filtered or unexported fields
}

func NewReport

func NewReport() *Report

NewReport creates and initializes a new Report.

func (*Report) ToJSON

func (r *Report) ToJSON() ([]byte, error)

func (*Report) Watch

func (r *Report) Watch(messageChan <-chan Message)

Watch watches for log messages coming from the different workers. It ends when the channel is closed. This function is concurrent-safe.

type Repository

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

func NewRepository

func NewRepository() Repository

func (*Repository) GetLastCompleteJSON

func (r *Repository) GetLastCompleteJSON() ([]byte, error)

func (*Repository) GetLastJSON

func (r *Repository) GetLastJSON() ([]byte, error)

func (*Repository) GetLastSuccessfulJSON

func (r *Repository) GetLastSuccessfulJSON() ([]byte, error)

func (*Repository) MarkAsComplete

func (r *Repository) MarkAsComplete()

func (*Repository) MarkAsSuccessful

func (r *Repository) MarkAsSuccessful()

func (*Repository) StartNewReport

func (r *Repository) StartNewReport()

func (*Repository) UpdateStats

func (r *Repository) UpdateStats(stats Stats)

func (*Repository) UpdateStatus

func (r *Repository) UpdateStatus(status jobStatus)

func (*Repository) Watch

func (r *Repository) Watch(messageChan <-chan Message)

type Severity

type Severity string
const (
	Info    Severity = "info"
	Warning Severity = "warn"
	Error   Severity = "error"
)

type Stats

type Stats struct {
	BuiltDevicesCount uint32           `json:"built_devices"`
	Performance       PerformanceStats `json:"performance"`
}

func (Stats) Log

func (s Stats) Log()

Jump to

Keyboard shortcuts

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