feat(models): add source metadata to analysis result

Closes #7
This commit is contained in:
Mikhail Chusavitin
2026-02-04 10:09:15 +03:00
parent d38d0c9d30
commit 596eda709c
4 changed files with 221 additions and 33 deletions

View File

@@ -2,13 +2,22 @@ package models
import "time"
const (
SourceTypeArchive = "archive"
SourceTypeAPI = "api"
)
// AnalysisResult contains all parsed data from an archive
type AnalysisResult struct {
Filename string `json:"filename"`
Events []Event `json:"events"`
FRU []FRUInfo `json:"fru"`
Sensors []SensorReading `json:"sensors"`
Hardware *HardwareConfig `json:"hardware"`
Filename string `json:"filename"`
SourceType string `json:"source_type,omitempty"` // archive | api
Protocol string `json:"protocol,omitempty"` // redfish | ipmi
TargetHost string `json:"target_host,omitempty"` // BMC host for live collect
CollectedAt time.Time `json:"collected_at,omitempty"` // Collection/upload timestamp
Events []Event `json:"events"`
FRU []FRUInfo `json:"fru"`
Sensors []SensorReading `json:"sensors"`
Hardware *HardwareConfig `json:"hardware"`
}
// Event represents a single log event
@@ -164,21 +173,21 @@ type NIC struct {
// PSU represents a power supply unit
type PSU struct {
Slot string `json:"slot"`
Present bool `json:"present"`
Model string `json:"model"`
Vendor string `json:"vendor,omitempty"`
WattageW int `json:"wattage_w,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
PartNumber string `json:"part_number,omitempty"`
Firmware string `json:"firmware,omitempty"`
Status string `json:"status,omitempty"`
InputType string `json:"input_type,omitempty"`
InputPowerW int `json:"input_power_w,omitempty"`
OutputPowerW int `json:"output_power_w,omitempty"`
InputVoltage float64 `json:"input_voltage,omitempty"`
OutputVoltage float64 `json:"output_voltage,omitempty"`
TemperatureC int `json:"temperature_c,omitempty"`
Slot string `json:"slot"`
Present bool `json:"present"`
Model string `json:"model"`
Vendor string `json:"vendor,omitempty"`
WattageW int `json:"wattage_w,omitempty"`
SerialNumber string `json:"serial_number,omitempty"`
PartNumber string `json:"part_number,omitempty"`
Firmware string `json:"firmware,omitempty"`
Status string `json:"status,omitempty"`
InputType string `json:"input_type,omitempty"`
InputPowerW int `json:"input_power_w,omitempty"`
OutputPowerW int `json:"output_power_w,omitempty"`
InputVoltage float64 `json:"input_voltage,omitempty"`
OutputVoltage float64 `json:"output_voltage,omitempty"`
TemperatureC int `json:"temperature_c,omitempty"`
}
// GPU represents a graphics processing unit
@@ -200,11 +209,11 @@ type GPU struct {
DMASize string `json:"dma_size,omitempty"`
DMAMask string `json:"dma_mask,omitempty"`
DeviceMinor int `json:"device_minor,omitempty"`
Temperature int `json:"temperature,omitempty"` // GPU core temp
MemTemperature int `json:"mem_temperature,omitempty"` // GPU memory temp
Power int `json:"power,omitempty"` // Current power draw (W)
MaxPower int `json:"max_power,omitempty"` // TDP (W)
ClockSpeed int `json:"clock_speed,omitempty"` // Operating speed MHz
Temperature int `json:"temperature,omitempty"` // GPU core temp
MemTemperature int `json:"mem_temperature,omitempty"` // GPU memory temp
Power int `json:"power,omitempty"` // Current power draw (W)
MaxPower int `json:"max_power,omitempty"` // TDP (W)
ClockSpeed int `json:"clock_speed,omitempty"` // Operating speed MHz
MaxLinkWidth int `json:"max_link_width,omitempty"`
MaxLinkSpeed string `json:"max_link_speed,omitempty"`
CurrentLinkWidth int `json:"current_link_width,omitempty"`