feat(go): expose retained incident views
This commit is contained in:
parent
eff31b3a82
commit
6355fb403d
6 changed files with 166 additions and 7 deletions
|
|
@ -55,6 +55,22 @@ type Stats struct {
|
|||
LastAlert *string
|
||||
}
|
||||
|
||||
// LoadReport reads one retained snapshot for read-only incident views.
|
||||
func LoadReport(path string) (Report, error) {
|
||||
raw, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
return Report{}, err
|
||||
}
|
||||
var report Report
|
||||
if err := json.Unmarshal(raw, &report); err != nil {
|
||||
return Report{}, err
|
||||
}
|
||||
if report.Schema != Schema {
|
||||
return Report{}, fmt.Errorf("unexpected snapshot schema %q", report.Schema)
|
||||
}
|
||||
return report, nil
|
||||
}
|
||||
|
||||
type Store struct {
|
||||
Dir string
|
||||
ProcRoot string
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue