mirror of https://github.com/prometheus/prometheus
Merge pull request #9303 from LeviHarrison/backfill-return-1
Rules backfill: return 1 if unsuccessfulpull/9318/head
commit
bd24e2fb92
|
@ -935,20 +935,17 @@ func importRules(url *url.URL, start, end, outputDir string, evalInterval time.D
|
||||||
} else {
|
} else {
|
||||||
etime, err = parseTime(end)
|
etime, err = parseTime(end)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error parsing end time:", err)
|
return fmt.Errorf("error parsing end time: %v", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
stime, err = parseTime(start)
|
stime, err = parseTime(start)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "error parsing start time:", err)
|
return fmt.Errorf("error parsing start time: %v", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !stime.Before(etime) {
|
if !stime.Before(etime) {
|
||||||
fmt.Fprintln(os.Stderr, "start time is not before end time")
|
return errors.New("start time is not before end time")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cfg := ruleImporterConfig{
|
cfg := ruleImporterConfig{
|
||||||
|
@ -961,25 +958,24 @@ func importRules(url *url.URL, start, end, outputDir string, evalInterval time.D
|
||||||
Address: url.String(),
|
Address: url.String(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "new api client error", err)
|
return fmt.Errorf("new api client error: %v", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ruleImporter := newRuleImporter(log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)), cfg, v1.NewAPI(client))
|
ruleImporter := newRuleImporter(log.NewLogfmtLogger(log.NewSyncWriter(os.Stderr)), cfg, v1.NewAPI(client))
|
||||||
errs := ruleImporter.loadGroups(ctx, files)
|
errs := ruleImporter.loadGroups(ctx, files)
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Fprintln(os.Stderr, "rule importer parse error", err)
|
return fmt.Errorf("rule importer parse error: %v", err)
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
errs = ruleImporter.importAll(ctx)
|
errs = ruleImporter.importAll(ctx)
|
||||||
for _, err := range errs {
|
for _, err := range errs {
|
||||||
if err != nil {
|
fmt.Fprintln(os.Stderr, "rule importer error:", err)
|
||||||
fmt.Fprintln(os.Stderr, "rule importer error", err)
|
}
|
||||||
}
|
if len(errs) > 0 {
|
||||||
|
return errors.New("error importing rules")
|
||||||
}
|
}
|
||||||
|
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue