Skip to content

Commit

Permalink
prom: fix dropped errors (ccfos#1727)
Browse files Browse the repository at this point in the history
  • Loading branch information
alrs authored Sep 27, 2023
1 parent 960ed6b commit 7ebb70b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions prom/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ func (pc *PromClientMap) loadFromDatabase() {
var err error
if !pc.ctx.IsCenter {
datasources, err = poster.GetByUrls[[]*models.Datasource](pc.ctx, "/v1/n9e/datasources?typ="+models.PROMETHEUS)
if err != nil {
logger.Errorf("failed to get datasources, error: %v", err)
return
}
lokiDatasource, err := poster.GetByUrls[[]*models.Datasource](pc.ctx, "/v1/n9e/datasources?typ="+models.LOKI)
datasources = append(datasources, lokiDatasource...)
if err != nil {
Expand All @@ -54,6 +58,10 @@ func (pc *PromClientMap) loadFromDatabase() {
}
} else {
datasources, err = models.GetDatasourcesGetsBy(pc.ctx, models.PROMETHEUS, "", "", "")
if err != nil {
logger.Errorf("failed to get datasources, error: %v", err)
return
}
lokiDatasource, err := models.GetDatasourcesGetsBy(pc.ctx, models.LOKI, "", "", "")
datasources = append(datasources, lokiDatasource...)
if err != nil {
Expand Down

0 comments on commit 7ebb70b

Please sign in to comment.