Skip to content
This repository was archived by the owner on Oct 7, 2022. It is now read-only.

Commit cb42068

Browse files
committed
chore(logging): make elasticsearch logging less verbose
1 parent 940f907 commit cb42068

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/elasticsearch/elasticsearch.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,11 @@ func (d recordDatabase) Insert(records []*models.ElasticRecord) (*InsertResponse
7474
for _, c := range created {
7575
if c.Status == http.StatusConflict {
7676
alreadyExistsIds = append(alreadyExistsIds, c.Id)
77-
level.Warn(d.logger).Log("message", "document already exists", "id", c.Id)
7877
}
7978
}
79+
if len(alreadyExistsIds) > 0 {
80+
level.Warn(d.logger).Log("message", "document already exists", "doc_count", len(alreadyExistsIds))
81+
}
8082
failed := res.Failed()
8183
var retry []*models.ElasticRecord
8284
if len(failed) > 0 {
@@ -87,10 +89,10 @@ func (d recordDatabase) Insert(records []*models.ElasticRecord) (*InsertResponse
8789
for _, f := range failed {
8890
if f.Status == http.StatusTooManyRequests {
8991
//es is overloaded, backoff
90-
level.Warn(d.logger).Log("message", "insert failed: elasticsearch is overloaded", "failed_id", f.Id)
9192
retry = append(retry, recordMap[f.Id])
9293
}
9394
}
95+
level.Warn(d.logger).Log("message", "insert failed: elasticsearch is overloaded", "retry_count", len(retry))
9496
}
9597
return &InsertResponse{alreadyExistsIds, retry}, nil
9698
}

0 commit comments

Comments
 (0)