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

Commit 2189c2b

Browse files
Luiz Reisluiz-nogueira
authored andcommitted
fix(elasticsearch.go): add logs
1 parent f667bdb commit 2189c2b

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/elasticsearch/elasticsearch.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func (d recordDatabase) Insert(records []*models.ElasticRecord) (*InsertResponse
8989
return &InsertResponse{AlreadyExists: nil, Retry: records, Backoff: true}, nil
9090
}
9191
if err != nil {
92+
level.Debug(d.logger).Log("message", "something went wrong with elasticsearch", "err", err)
9293
return nil, err
9394
}
9495
if res.Errors {
@@ -112,16 +113,19 @@ func (d recordDatabase) Insert(records []*models.ElasticRecord) (*InsertResponse
112113
}
113114
for _, f := range failed {
114115
if f.Status == http.StatusBadRequest {
116+
level.Debug(d.logger).Log("message", "elasticsearch bad requests", "err", f)
115117
d.metricsPublisher.ElasticsearchBadRequests(1)
116118
continue
117119
}
118120
if f.Status == http.StatusConflict {
121+
level.Debug(d.logger).Log("message", "elasticsearch conflicts", "err", f)
119122
d.metricsPublisher.ElasticsearchConflicts(1)
120123
continue
121124
}
122125
retry = append(retry, recordMap[f.Id])
123126
if f.Status == http.StatusTooManyRequests {
124127
//es is overloaded, backoff
128+
level.Debug(d.logger).Log("message", "es is overloaded, backoff")
125129
overloaded = true
126130
}
127131
}

0 commit comments

Comments
 (0)